RedHat - default gateway static route

2

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 1.1.1.138 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!

Oz Bar-Shalom

Posted 2016-01-16T18:14:59.760

Reputation: 186

which version of RHEL or centos are you on? – chicks – 2016-01-18T19:44:12.807

The OS is Redhat 6.5 – Oz Bar-Shalom – 2016-01-18T19:45:16.260

Answers

0

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:

1.2.4.0/24 via 1.2.3.1

screff

Posted 2016-01-16T18:14:59.760

Reputation: 1