Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
1  
Just a tip: you could change default gw with one command - "ip ro change default via 128.83.188.193" –  ALex_hha Jul 25 '13 at 14:32
    
But I want the change to be permanent. –  jsp Jul 25 '13 at 15:16
    
Oh, right, you just meant that I could do this instead of using two route commands. –  jsp Jul 25 '13 at 16:10
add comment

2 Answers

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.

share|improve this answer
add comment

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

share|improve this answer
    
/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 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
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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