[RESOLVED] Default Gateway chgs to eth0 from bond0 on reboot

Issues related to configuring your network
Post Reply
i am yeti
Posts: 3
Joined: 2015/02/05 22:05:43

[RESOLVED] Default Gateway chgs to eth0 from bond0 on reboot

Post by i am yeti » 2015/02/05 22:20:37

Hello,

The default gateway keeps changing to eth0 from bond0 on reboot. Can anyone help identify the problem?

Route output (after reboot):

Destination Gateway Genmask Flags Metric Ref Use Iface
10.10.0.0 * 255.255.0.0 U 0 0 0 bond0
10.10.0.0 * 255.255.0.0 U 1 0 0 eth1
10.10.0.0 * 255.255.0.0 U 1 0 0 eth2
10.10.0.0 * 255.255.0.0 U 1 0 0 eth0
link-local * 255.255.0.0 U 1005 0 0 bond0
default 10.10.1.254 0.0.0.0 UG 0 0 0 eth0

I've tried adding/removing settings from '/etc/sysconfig/network-scripts/ifcfg-bond0' and '/etc/sysconfig/network' with no success. Below is what I've currently got:

/etc/sysconfig/network

NETWORKING=yes
HOSTNAME=centos01.domain.local
GATEWAYDEV=bond0
GATEWAY=10.10.1.254
NTPSERVERARGS=iburst

/etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
IPADDR=10.10.1.16
NETWORK=10.10.0.0
NETMASK=255.255.0.0
GATEWAY=10.10.1.254
USERCTL=no
BONDING_OPTS="mode=6 miimon=100"
TYPE=Ethernet
PREFIX=16
DNS1=10.10.1.11
DOMAIN=domain.local
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System bond0"
UUID=ad33d8b0-1f7b-cab9-9447-ba07f855b143
LAST_CONNECT=1420665973

/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
MASTER=bond0
SLAVE=yes
USERCTL=no
ONBOOT=yes
BOOTPROTO=none

/etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
MASTER=bond0
SLAVE=yes
USERCTL=no
ONBOOT=yes
BOOTPROTO=none

/etc/sysconfig/network-scripts/ifcfg-eth2

DEVICE=eth2
MASTER=bond0
SLAVE=yes
USERCTL=no
ONBOOT=yes
BOOTPROTO=none

When rebooting, I get 2-3 ping responses from a remote network address mid boot. Interestingly (maybe)... service network restart completely drops the server from the network and I have to reboot to restore the connection.

Any help greatly appreciated!
Last edited by i am yeti on 2015/02/17 23:33:56, edited 1 time in total.

poky
Posts: 108
Joined: 2013/03/27 12:18:03

Re: Default Gateway changes to eth0 from bond0 on reboot

Post by poky » 2015/02/06 19:02:18

/etc/sysconfig/network-scripts/ifcfg-xxx:

NM_CONTROLLED=no

i am yeti
Posts: 3
Joined: 2015/02/05 22:05:43

Re: Default Gateway changes to eth0 from bond0 on reboot

Post by i am yeti » 2015/02/09 01:15:47

Thanks for the reply :D

I've added NM_CONTROLLED to all ifcfg-xxx files. Unfortunately, the gateway is still changing to eth0 after a reboot... but 'service network restart' now works and sets the gateway correctly.

route after reboot:
Destination Gateway Genmask Flags Metric Ref Use Iface
10.10.0.0 * 255.255.0.0 U 0 0 0 bond0
10.10.0.0 * 255.255.0.0 U 1 0 0 eth1
10.10.0.0 * 255.255.0.0 U 1 0 0 eth2
10.10.0.0 * 255.255.0.0 U 1 0 0 eth0
link-local * 255.255.0.0 U 1005 0 0 bond0
default 10.10.1.254 0.0.0.0 UG 0 0 0 eth0

route after service network restart
Destination Gateway Genmask Flags Metric Ref Use Iface
10.10.0.0 * 255.255.0.0 U 0 0 0 bond0
link-local * 255.255.0.0 U 1005 0 0 bond0
default 10.10.1.254 0.0.0.0 UG 0 0 0 bond0

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: Default Gateway changes to eth0 from bond0 on reboot

Post by aks » 2015/02/09 17:14:27

I suggest:

1) Taking all the GATEWAY entries out of /etc/sysconfig/network
2) Taking the GATEWAY=10.10.1.254 and DEFROUTE=yes out of /etc/sysconfig/network-scripts/ifcfg-bond0
3) Changing NAME="System bond0" to NAME="bond0" in /etc/sysconfig/network-scripts/ifcfg-bond0
4) Adding /etc/sysconfig/network-scripts/route-bond0 with an entry like default via 10.10.1.254 dev bond0

Also if you get something like "RTNETLINK answers: File exists" or 'Error: either "to" is a duplicate, or "X.X.X.X" is a garbage.' you've probably got a duplicate gateway entry.

i am yeti
Posts: 3
Joined: 2015/02/05 22:05:43

Re: Default Gateway changes to eth0 from bond0 on reboot

Post by i am yeti » 2015/02/10 21:25:45

Right, we're up and running :)

Followed the advice from aks and did get 'Error: either "to" is a duplicate, or "X.X.X.X" is a garbage.'. So I removed the route-bond0 file and added GATEWAY=10.10.1.254 back into etc/sysconfig/network. Looks to have done the trick.

Thanks for the help.

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: Default Gateway changes to eth0 from bond0 on reboot

Post by aks » 2015/02/11 19:15:20

Cool. :D

Post Reply