Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 162553 - gateway doesn't get set after changing ro dhcp from static ip config + fix
Summary: gateway doesn't get set after changing ro dhcp from static ip config + fix
Status: CLOSED DUPLICATE of bug 149780
Alias: None
Product: Fedora
Classification: Fedora
Component: system-config-network
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Harald Hoyer
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2005-07-06 09:05 UTC by Hans de Goede
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2006-05-19 10:37:05 UTC

Attachments (Terms of Use)

Description Hans de Goede 2005-07-06 09:05:17 UTC
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.

Comment 1 Radek Vokal 2005-08-10 07:58:50 UTC
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
gateway setting. 

Comment 2 Hans de Goede 2005-08-10 08:57:13 UTC
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?

Comment 3 Harald Hoyer 2006-05-19 10:37:05 UTC

*** This bug has been marked as a duplicate of 149780 ***

Note You need to log in before you can comment on or make changes to this bug.