Bug 162553 - gateway doesn't get set after changing ro dhcp from static ip config + fix
gateway doesn't get set after changing ro dhcp from static ip config + fix
Status: CLOSED DUPLICATE of bug 149780
Product: Fedora
Classification: Fedora
Component: system-config-network (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Harald Hoyer
Depends On:
  Show dependency treegraph
Reported: 2005-07-06 05:05 EDT by Hans de Goede
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-05-19 06:37:05 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Hans de Goede 2005-07-06 05:05:17 EDT
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 03:58:50 EDT
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 04:57:13 EDT
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 06:37:05 EDT

*** 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.