Some of my users have laptops with both wired and wireless network connections. While at their desk (for example) they want to use the wired port, but when they are at lunch or in a meeting they want to use the wireless network.

To rig this up, so it was dummy proof, I have both cards configured at all times with each card providing a default route. This can easily be done by using the CONFIG_IP_ROUTE_MULTIPATH kernel option. However, in order for this multi-path stuff to actually work some scripts from mandrake had to be altered. (Last laptop I configured was around mdk8.1 so there is no point in me including diffs for the scripts)

Here is the minimal stuff that needs to be tweeked for 2 default static routes to work.

for example, if <ip1> was 192.168.1.23 and it's gw <ip1-gw> was 192.168.1.1 and <ip2> was 10.1.2.23 and it's gw <ip1-gw> was 10.1.2.1 and we wanted seemless switching between the two.

When starting up an interface the gateway needs to be set by /sbin/ip... NOT by ifconfig.

When adding the default routes it must be done like this:
/sbin/ip route append default via <ip1-gw> equalize
/sbin/ip route append default via <ip2-gw> equalize

in /etc/sysctl.conf:
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 0
net.ipv4.route.gc_timeout = 5

This allows seemless switching from wired and wireless networking without any interaction from the user. The gc_timeout keeps the routing cache very fresh. If this is not done it could take hours for the new connections to fail over to the alternate network connection (when you unplug the wire and walk to a meeting down the hall you don't want to wait 2 hours for the cache to flush so you can fire up your browser).

To timeout existing connections faster than normal you can tweek some extra stuff...

net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl = 10

I'm sure I forgot to mention something... if anyone gives this a try and has problems I'd be happy to help!

--
Bryan Whitehead
SysAdmin - JPL - Interferometry and Large Optical Systems
Phone: 818 354 2903
[EMAIL PROTECTED]




Reply via email to