Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I will set up a multipath route in a box that has three Internet Connections, so hat the load is balanced. eth1 is 1536 kbps, eth2 is 1536 kbps and eth3 is 768 kbps
When the interfaces go on-line, they will use dhcp to configure themselves.
That will create three default gws in the routing table.
If I add another multipath route using the three devices as their nexthops, will it be treated as THE prefered default gw?
Say something like:
Code:
ip route add default nexthop dev eth1 weight 2 nexthop dev eth2 weight 2 nexthop dev eth3 weight 1
I've been thinking about it. I think the command I posted will not work... not even if it's taken as the default route.
That's because packets will be sent out throw a given device... but won't be sent to the gateway. In other words, I have to include the GWs addresses in the commmand (nexthop via x dev y). Do you agree?
eth0 = 192.168.1.200 (Sprint)
eth2 = 192.168.0.200 (Telus)
In /etc/iproute2/rt_tables, add:
1 Sprint
2 Telus
ip route add 192.168.1.0/24 dev eth0 src 192.168.1.200 table Sprint
ip route add default via 192.168.1.1 table Sprint
ip route add 192.168.0.0/24 dev eth2 src 192.168.0.200 table Telus
ip route add default via 192.168.0.1 table Telus
ip route show table Telus
ip route show table Sprint
ip rule add from 192.168.1.200 table Sprint
ip rule add from 192.168.0.200 table Telus
ip route add default scope global nexthop via 192.168.1.1 dev eth0 weight 1 \
nexthop via 192.168.0.1 dev eth2 weight 1
[root@wifi root]# ip route
192.168.1.0/24 dev eth0 scope link
192.168.0.0/24 dev eth2 proto kernel scope link src 192.168.0.200
127.0.0.0/8 dev lo scope link
default
nexthop via 192.168.1.1 dev eth0 weight 1
nexthop via 192.168.0.1 dev eth2 weight 1
[root@wifi root]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
192.168.0.0 * 255.255.255.0 U 0 0 0 eth2
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
[root@wifi root]# ip rule
0: from all lookup local
32764: from 192.168.0.200 lookup Telus
32765: from 192.168.1.200 lookup Sprint
32766: from all lookup main
32767: from all lookup default
[root@wifi root]# traceroute -m 5 google.ca
traceroute: Warning: google.ca has multiple addresses; using 216.239.57.104
traceroute to google.ca (216.239.57.104), 5 hops max, 38 byte packets
1 674895464.globetrotter.net (207.134.5.97) 1.642 ms 1.379 ms 1.363 ms
2 207.134.34.201 (207.134.34.201) 18.712 ms 18.588 ms 16.905 ms
3 142.169.173.131 (142.169.173.131) 19.910 ms 17.179 ms 17.939 ms
4 mtrlpqfbgr00.bb.telus.com (154.11.7.5) 103.860 ms 122.291 ms 104.239 ms
MPLS Label=202 CoS=3 TTL=1 S=0
5 MTRLPQFBBR00.bb.telus.com (154.11.11.241) 105.419 ms 110.047 ms 102.544 ms
MPLS Label=297 CoS=3 TTL=1 S=0
[root@wifi root]# traceroute -m 5 wificountry.ca
traceroute to wificountry.ca (206.45.119.128), 5 hops max, 38 byte packets
1 6bdfug980..dedicated.sprintdsl.ca (149.99.14.185) 2.182 ms 1.780 ms 2.135 ms
2 mtl149-99-189-69.dedicated.sprintdsl.ca (149.99.189.69) 14.238 ms 9.683 ms 10.541 ms
3 g8-0-3-S1.bb1.mtl1.sprint-canada.net (207.107.254.1) 9.241 ms 12.278 ms g8-0-4-S1.bb1.mtl1.sprint-canada.net (207.107.254.65) 13.762 ms
4 g7-0-S1.bb2.mtl1.sprint-canada.net (204.50.128.110) 13.472 ms 11.159 ms 8.969 ms
5 as15290gw.mtl1.sprint-canada.net (209.5.21.18) 10.347 ms 13.975 ms 18.451 ms
Three things:
1st: Good you got it working... I hope to say the same in a short time.
2nd: I tried to follow those instructions yesterday, but didn't get it working. I later realized it was because the kernel I was using (knoppix's, because we were just testing) didn't have multipath support (I later tried with mdk, which did have it... and was succesful at trying a single default route with two nexthops). What distribution are you using?
3rd: There's another level of difficulty for my problem. You got static routes.... and that's cool. But I depend on addresses provided by dhcp.... therefore I guess I'll just have to make scripts to handle setting the addresses of the nexthop's via and so on whenever there's a change in the addresses.
I just wrote an Answer on this in the Networking section, it should appear shortly (I assume it's gotta get approved by a mod like an HCL Review, right...if not I just lost it :P )
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.