0

On a RHEL6 server I added a 2nd nic and have configured it to use a static ip on a different subnet.

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.157.32   0.0.0.0         255.255.255.224 U     1      0        0 eth1
128.83.188.192  0.0.0.0         255.255.255.192 U     1      0        0 eth0
0.0.0.0         172.16.157.33   0.0.0.0         UG    0      0        0 eth1

However, /etc/sysconfig/network states:

GATEWAY=128.83.188.193

Why is this statement getting ignored?

I can manually change the default route using the ip or route command, but when I restart the network, the default route still goes back to eth1.

jsp
  • 215
  • 1
  • 4
  • 11

2 Answers2

1

Just add the following line

GATEWAY=128.83.188.193

in to the /etc/sysconfig/network. Also check that there is no default gw in the /etc/sysconfig/network-scripts/ifcfg-eth1

ALex_hha
  • 7,193
  • 1
  • 25
  • 40
  • /etc/sysconfig/network already had the line `GATEWAY=128.83.188.193` in it. I had already tried to to removing the `GATEWAY` statement from /etc/sysconfig/network-scripts/ifcfg-eth1, but when I do that, the routing table shows the gateway at 128.83.188.193, but it shows the interface at eth1, and my network seems borked (can't see outside world or ssh in). – jsp Jul 25 '13 at 14:32
  • 1
    It's worth having a read of the [RHEL Deployment Guide](https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/index.html) for finding out how to do these things. – James O'Gorman Jul 25 '13 at 14:33
  • I have done what the deployment guide has recommended. It says that /etc/sysconfig/network contains the GATEWAY option, which sets the network's gateway. This option was already set correctly, but it seems to be getting ignored. – jsp Jul 25 '13 at 15:14
  • I have been seen the system where default gw was defined in ifcfg-ethX. Also check /etc/sysconfig/network-scripts/route-eth1 if one exist – ALex_hha Jul 25 '13 at 15:18
  • @ALex_hha As noted, I removed the GATEWAY option from ifcfg-eth1, but when I did this, it changed the default gateway ip to the correct value, but it left the interface at eth1. This seems to have had an ill effect on my network. – jsp Jul 25 '13 at 15:21
  • What do you mean by - "but it left the interface at eth1" ? Could you clarify what exactly doesn't work after all changes that you have done? – ALex_hha Jul 25 '13 at 15:32
  • @ALex_hha Sorry, yeah, I meant that when I do a `route -n`, under _destination_ it says `0.0.0.0` under _gateway_ it says `128.83.188.193`, and under _Iface_ `eth1`. When it is setup this way, I can't ssh in, and my browser doesn't work. If however, I make the changes with `route add default gw...`, `route -n` says `eth0` under _Iface_ and everything seems to work correctly. – jsp Jul 25 '13 at 15:49
  • (mini-markdown doesn't seem to allow me to put the output here in a helpful format) – jsp Jul 25 '13 at 15:56
  • It would be best to add such info into the first post – ALex_hha Jul 25 '13 at 16:14
0

When I entered the parameters for the new interface, I made the interface "available to all users". If I delete the interface and add it back without making it available to all users, the gateway stays at eth0.

jsp
  • 215
  • 1
  • 4
  • 11