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 -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
255.255.255.255 0.0.0.0 255.255.255.255 UH 0 0 0 bond0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 bond1
192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 bond0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 bond1
0.0.0.0 192.168.10.1 0.0.0.0 UG 0 0 0 bond0
0.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/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=myhostname.com
[root@server1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.10.11
NETMASK=255.255.255.0
NETWORK=192.168.10.0
BROADCAST=192.168.10.255
GATEWAY=192.168.10.1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
[root@server1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond1
DEVICE=bond1
IPADDR=192.168.0.15
NETMASK=255.255.255.0
NETWORK=192.168.0.0
BROADCAST=192.168.0.255
GATEWAY=192.168.0.254
ONBOOT=yes
BOOTPROTO=none
USERCTL=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.