I am trying to set static routes and I did not succeed.

My situation:

  • 2 Nics 4 ports.
  • Eth0 + Eth1 = bond0 (Class c)
  • Eth2 - Active (Class b)
  • Eth3 - Not Active
  • All traffic goes through bond0 (default gateway)
  • Nothing goes through eth2

What I need:

  • All traffic goes through eth2 (default gateway)
  • Exept traffic to segment 1.2.3.X/24 to go through bond0

ip route command shows that the default gateway interface is bond0

What I have tried:

  • Changing /etc/sysconfig/network file with GATEWAY / GATEWAYDEV parameters - not succeed
  • Setting static route for the segment to go through bond 0 - succeed
  • changing Network bringing up interfaces order: eth2 before&after bond0 - none of them succeed
  • the commands: ip route dell default and then ip route add default via dev eth2 - succeed but changed again after reboot\network restart

What should I do to solve that ?

How to set the default gateway interface to eth2 (somehting I have not tried yet?)

Thank you!

  • which version of RHEL or centos are you on? – chicks Jan 18 '16 at 19:44
  • The OS is Redhat 6.5 – Oz Bar-Shalom Jan 18 '16 at 19:45

The will vary depending on if you're using NetworkManager or the legacy network service. The below should work for network.

You will need to first make sure you set bond0 as your default gateway. To do this make sure you have a gateway set in /etc/sysconfig/network

After that you'll want to create /etc/sysconfig/network-scripts/route-eth2. In the file add this line: via
| improve this answer | |

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.