Dual connection to Internet with help of iproute

August 2, 2005

Usually when you configure your linux box to connect to a network you enter one single default gateway. That means that all all packages sent from your box to an unknown network is sent to this single gateway. But when you have multiple Internet connection to a single machine it won't work, you have to send the responce from the same ip-address that the request was retreived on.

So, enough of introduction, iproute solves all of this. And thats nice :)

This is how I did...
I have the machine directly connected to internet with ip And then a local network with ip and a gateway on that network with ip acting as a router to Internet on an other line.

ip rule add from lookup 1
ip route add 0/0 via table 1

ip rule add from lookup 2
ip route add via table 2
ip route add 0/0 via table 2

This will make an own lookup routing table for each network interface and send the responce to the correct router. Also note that I don't specify any default gateway here. The default gateway will be uses when something from this machine tries to make a connection to any unknown ip. But since it is added with help of DHCP when I get the ip I won't have to add it again.

Maybe this might help someone...


RSS feed for comments on this post.

The URI to TrackBack this entry is: http://www.kozz.org/bblog/trackback.php/4/

Leave a Comment

Sorry, Comments have been disabled for this post