Quantcast
Channel: Linux adds the wrong default route - Server Fault
Viewing all articles
Browse latest Browse all 4

Linux adds the wrong default route

$
0
0

For some reason my Centos 5.9 Linux 2.6.18 x86_64 wants me to have two default routes.

Whenever I reboot the server, my routing table looks like this:

[root@server1 ~]# route -nKernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Iface255.255.255.255 0.0.0.0         255.255.255.255 UH    0      0        0 bond0192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 bond1192.168.10.0    0.0.0.0         255.255.255.0   U     0      0        0 bond0169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 bond10.0.0.0         192.168.10.1    0.0.0.0         UG    0      0        0 bond00.0.0.0         192.168.0.254   0.0.0.0         UG    0      0        0 bond1

bond1 is a local network, so having a last default route pointing to this network makes all internet requests fail.

It is easily fixed by executing route del default gw 192.168.0.254 and I could possibly add that command to some startup script. I would however like to understand what's going on and get to the root of the problem.

I hope anyone can tell me, why this happens. My research confirm that there should always be only one default gateway, but I can find no answer to why there would automatically be two of them.

Here is some config files:

[root@server1 ~]# cat /etc/sysconfig/networkNETWORKING=yesNETWORKING_IPV6=noHOSTNAME=myhostname.com[root@server1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0DEVICE=bond0IPADDR=192.168.10.11NETMASK=255.255.255.0NETWORK=192.168.10.0BROADCAST=192.168.10.255GATEWAY=192.168.10.1ONBOOT=yesBOOTPROTO=noneUSERCTL=no[root@server1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond1DEVICE=bond1IPADDR=192.168.0.15NETMASK=255.255.255.0NETWORK=192.168.0.0BROADCAST=192.168.0.255GATEWAY=192.168.0.254ONBOOT=yesBOOTPROTO=noneUSERCTL=no

I understand that swapping bond0 and bond1 would make the two default routes switch place as well, effectively giving me internet access on boot. But I still think it's not the good solution.

Around the internet people are talking about files at /etc/sysconfig/network-scripts/route-X, I don't have any of those though.

Thanks for your time.


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>