Red Hat Bugzilla – Bug 126393
dhclient was not properly setting the default gateway ip
Last modified: 2007-11-30 17:10:45 EST
Description of problem:
/sbin/dhclient-script was imporperly setting the default gateway ip
Version-Release number of selected component (if applicable):
This was 100% reproducible when the dhcp server was WGT634U (netgear
Steps to Reproduce:
1. from command line run netconfig as root
2. check "Use dynamic IP configuration (BOOTP/DHCP)"
** One can also manually edit nic config file
/etc/sysconfig/network-scripts/ifcfg-<interface><n> setting BOOTPROTO=dhcp
3. restart network service /etc/rc.d/init.d/network restart. or do a
ifdown <interface><n>;ifup <interface><n>
4. execute route from command line
default gateway ip addr was not correct
default gateway ip addr should have been correct
Commenting line 136: route add default dev $interface netmask 0.0.0.0
from /sbin/dhclient-script resolved this issue
I was able to reproduce this issue against another dhcp server.
Additionally, the reason why commenting line 136 works is that at
around line 220 the default gw are set there, but line 136 was
basically setting the default gw to '0.0.0.0' - commenting that out
prevents this. Of course one cannot set the default gw twice without
first deleting the previous one.
Actually, I think the section of code in question was this:
/sbin/dhclient-script, now lines 130-135:
elif [ $relmajor -lt 2 ] || ( [ $relmajor -eq 2 ] && [ $relminor -eq
0 ] ) then
ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
broadcast 255.255.255.255 up
# Add route to make broadcast work. Do not omit netmask.
route add default dev $interface netmask 0.0.0.0
Firstly, why are you running such an ancient kernel ?
Upgrading to a kernel > 2.0 will fix your problem.
These lines do NOT set the default gateway to 0.0.0.0, they
set the default route to be through the $interface, which at
that time is given address 0.0.0.0 (because we don't know
what other address to give it yet); when it is assigned an
address, the default route will still be through that interface.
Anyway, I agree that 2.0 kernels should be able to obtain a default
route from DHCP.
This is now fixed in dhcp-3.0.1-6 (requires initscripts-7.60-1).
QA_READY has been deprecated in favor of ON_QA. Please use ON_QA in the future.
Moving to ON_QA.
There's a version greater than dhcp-3.0.1-6 in FC5.