Red Hat Bugzilla – Bug 162553
gateway doesn't get set after changing ro dhcp from static ip config + fix
Last modified: 2007-11-30 17:11:09 EST
Our sysadmin put my machine on a different net yesterday and for the new net I
must use dhcp, so I changed eth0 to dhcp in system-config-network, deactived it
and reactived it.
After that it got an IP fine, but it didn't set a default gateway,
/var/lib/dhcp/dhclient-eth.leases showed that the dhcp-server did provide one.
Much debugging has lead me to /sbin/dhclient-script (so I might have selected
the wrong component for this bug). /sbin/dhclient-script contains:
if [[ ( ( -z "$GATEWAYDEV" ) || ( "$GATEWAYDEV" = "$interface" ) && ( ( -z
"$GATEWAY" ) || ( ( -n "$DHCLIENT_IGNORE_GATEWAY" ) && (
"$DHCLIENT_IGNORE_GATEWAY" = [Yy]* ) ) ) ]]; then
for router in $new_routers; do
add_default_gateway $router && break;
Because I changed my ipconfig in system-config-network from static to dhcp
/etc/sysconfig/network-scripts/ifcfg-eth0 still contained a GATEWAY=x.x.x.x line
and system-config-network did not add a DHCLIENT_IGNORE_GATEWAY=Y line, so
dhclient-script tried to set my gateway to the gateway for the old static config.
I believe the proper fix for this for system-config-network to add
DHCLIENT_IGNORE_GATEWAY=Y to /etc/sysconfig/network-scripts/ifcfg-eth0
if one selects dhcp. Or /sbin/dhclient-script needs to be changed.
For now I've worked around this by reselecting static clearing the gateway
editbox and then reselecting dhcp again, save, ifdown, ifup, fixed.
Also reported in bug #155299 . IMHO this is not initscripts bug that it sets
gateway according to dhclient first and than sets the one from initscript as it
should be intentional to overide dhcp settings. s-c-network should either remove
this line (GATEWAY) from the config file or use the above line to supress the
I agree (this is a s-c-network bug), hence I selected it as a component. The fix
is obvious: Add DHCLIENT_IGNORE_GATEWAY=Y when dhcp is selected in s-c-network.
This is better then removing GATEWAY, since the othersettings are kept by
s-c-network (although greyed out), so keeping gateway too seems consistent this
also allows for easy switching between dhcp and a static IP.
Since the fix is obvious can this be fixed please?
*** This bug has been marked as a duplicate of 149780 ***