0

I have a physical system with Centos 6 as OS. In eth0 I set IP, gateway and netmask as below and the physical port is attached to a switch port that its VLAN is 12.

  DEVICE=eth0
  TYPE=Ethernet
  UUID=20b60816-f5eb2e4
  ONBOOT=yes
  BOOTPROTO=static
  IPADDR=192.168.60.2
  GATEWAY=192.168.50.55
  NETMASK=255.255.255.0  

and in eth1 i set these and physical port is attached to switch port with VLAN 14.

  DEVICE=eth1
  TYPE=Ethernet
  UUID=9de7-14f13f5eb2e4
  ONBOOT=yes
  BOOTPROTO=static
  IPADDR=192.168.110.5
  GATEWAY=192.168.60.60
  NETMASK=255.255.255.224  

the default port is set on eth1 so when i run route the gateway is 192.168.60.60. but when i bond eth1 and eth2 ( eth2 VLAN is also 14) and the default port is still eth1 and i run route the gateway is 192.168.50.55!
why this happen and what should I do?

UPDATE:
based on answer below i found these documents.
Centos documentation
redhat documentation

2

Well, it seems gateway (also known as default gateway) is something different from what you think it is, since the way you have it configured looks incorrect to me.

The default gateway defines how the machine should try to reach an IP in a network it doesn't know about, which is not in any of the networks directly attached to this machine, or networks for which the machine has static routes configured to. In short, the default gateway is the way by which the machine can reach the Internet.

In particular, you most typically don't have default gateways in multiple interfaces (since typically only one interface goes to the Internet, the others go to internal networks.) So I'd expect to see a default gateway configured on either eth0 or eth1, but not both...

Furthermore, the default gateway typically should be configured in the interface where that IP belongs (since you want it to be configured as that interface is brought up.) So I'd expect GATEWAY=192.168.60.60 to be configured in the eth0 configuration, since that interface handles the 192.168.60.x network and it's the one where IP 192.168.60.60 is actually reachable.

(Of course, that's assuming 192.168.60.60 is actually the default gateway through which you can reach the Internet, otherwise you shouldn't list it at all.)

IP 192.168.50.55 looks problematic, since it's not an IP on either one of the two configured networks (192.168.60.x on eth0 or 192.168.110.x on eth1), so configuring such a default gateway will plainly not work, since it's not attached to any of the known networks, so your machine doesn't know how to reach it.

If you configure default gateways in the wrong places and configure many of them, it's quite possible that the network scripts will still configure them both and you might end up having one, the other or maybe both listed, resulting into a configuration that works, or doesn't work, or work sometimes. So what you report about settings getting mixed up when bonding gets involved doesn't surprise me.

My advice here is that you try to understand how default gateways work, reconfigure your files to only list the correct one in the correct place, retest it, then go back to setting up bonding on your VLAN 14.

If you have follow up questions, this site can be a good resource. In that case, you might want to further describe your network, the IP ranges and how it's connected to the Internet, you might get more specific recommendations then.

  • you are right. i did some searching and found answers. but i should wait till i can test them to see if they work. i will add what i found in my question. – BlackCrystal Nov 17 '18 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.