LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 06-01-2005, 11:25 AM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Rep: Reputation: 83
Question how are multiple default gateways handled?


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
 
Old 06-01-2005, 11:41 AM   #2
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
Since routes are cached what is likely to happen is that contacting a certain domain will go out eth1, then another domain out eth2 and so on.

After the routing cache expires (not sure how long that takes...a few minutes I think) it can start all over again.
 
Old 06-01-2005, 01:15 PM   #3
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
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?
 
Old 06-01-2005, 02:11 PM   #4
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
Here's how we do it:

Code:
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
 
Old 06-01-2005, 02:25 PM   #5
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
I see, I see.

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.

Let's see what I come up with.
 
Old 06-01-2005, 02:37 PM   #6
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
I have a very simple question. Why are two tables needed? Can't it be done with a single one?
 
Old 06-01-2005, 02:39 PM   #7
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
No, It can't each table has a different default gw.
 
Old 06-01-2005, 02:40 PM   #8
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
But then why create separate tables... if the last command would do the whole thing?

I think you can simply say:
Code:
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
What is the catch? I bet there's one.

Last edited by eantoranz; 06-01-2005 at 02:41 PM.
 
Old 06-01-2005, 03:03 PM   #9
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
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 )
 
Old 06-01-2005, 03:09 PM   #10
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
huh?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple default gateways jireson Linux - Networking 3 02-04-2006 02:24 AM
multiple gateways efm Linux - Newbie 4 06-10-2005 09:50 AM
Multiple Gateways Jon Doe Linux - Networking 9 03-07-2005 04:26 PM
Red Hat 7.3 and multiple gateways on multiple interfaces bluefmc Linux - Networking 2 11-19-2004 06:01 PM
multiple ips, multiple gateways, one interface drpixel Linux - Networking 6 12-04-2002 01:56 AM


All times are GMT -5. The time now is 09:14 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration