multiple default routes in linux
I have 4 NICs in a server running Ubuntu 11.04. It's sole purpose is dynamips. I'm seeing flaky behavior with routing (missing hops in traceroute, intermittent ping) and finally found the culprit:
Now I can manually delete a route using the command
But this is kind of a pain in the butt to do every time the server is rebooted.
Does anybody know how to fix this?
tyler@dynamipsBox:~$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 U 1 0 0 eth3 192.168.1.0 0.0.0.0 255.255.255.0 U 1 0 0 eth1 192.168.1.0 0.0.0.0 255.255.255.0 U 1 0 0 eth2 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth2 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth1 0.0.0.0 192.168.1.1 0.0.0.0 UG 100 0 0 eth0
Now I can manually delete a route using the command
sudo route del default dev eth0
But this is kind of a pain in the butt to do every time the server is rebooted.
Does anybody know how to fix this?
Climb a mountain, tell no one.
Comments
-
exampasser Member Posts: 718 ■■■□□□□□□□One way would be to make a simple script and have it run when it boots.
-
Met44 Member Posts: 194
0.0.0.0 192.168.1.1 0.0.0.0 UG [B]0[/B] 0 0 eth1 0.0.0.0 192.168.1.1 0.0.0.0 UG [B]100[/B] 0 0 eth0
Are you sure this is what the problem is? Does the problem stop when you remove the other route manually? Since the metrics are different, these routes are not actually duplicates. The route out of eth1 will always be used, so that is not likely behind any flaky/intermittent behavior -- there would be zero remote connectivity if it had the wrong default route (based on your routing table).
If you suspect the other default route is being used for some reason, check against the route cache or the "Use"/lookup counter when the behavior is occurring.
Also, why use four different interfaces on the same subnet? -
ehnde Member Posts: 1,103
0.0.0.0 192.168.1.1 0.0.0.0 UG [B]0[/B] 0 0 eth1 0.0.0.0 192.168.1.1 0.0.0.0 UG [B]100[/B] 0 0 eth0
Are you sure this is what the problem is? Does the problem stop when you remove the other route manually? Since the metrics are different, these routes are not actually duplicates. The route out of eth1 will always be used, so that is not likely behind any flaky/intermittent behavior -- there would be zero remote connectivity if it had the wrong default route (based on your routing table).
If you suspect the other default route is being used for some reason, check against the route cache or the "Use"/lookup counter when the behavior is occurring.
Also, why use four different interfaces on the same subnet?
I will take all of this into consideration, and you're right - why use all the same interfaces on the same subnet? This is a pretty fresh install and I hadn't configured these interfaces yet. Putting them on different networks or shutting the ones down I'm not using would be a good idea!! For now I'll shut them down because the intention is to set up one port as a trunk for QinQ.Climb a mountain, tell no one.