[olug] dhcpcd vs. dhclient

VincentR vincentr at cox.net
Sat Mar 30 17:09:35 UTC 2002

I don't know if anyone else has had trouble with Cox changing your ip
address several times a day lately, but I think I've found an answer for it.
This is mostly referring to a Redhat 7.2 system.

By default Redhat uses dhcpcd, which releases it's IP and requests a new one
when the lease expires.  This may be just coincidemce, but it looks like
Cox's dhcp server holds an IP for a while after it's been released and you
get a new one, instead of your old one.  For some reason dhcpcd also gets
the domain name screwed up too.  It should be "om.om.cox.net" (according to
reverse DNS lookups), but dhcpcd gets "om.cox.net".  Oh well...

I've tested with ISC's dhclient and it simply sends a renew request for your
current address when the lease expires.  This seems to behave much better
with Cox.

Many distros (mandrake, suse) now use dhclient, but for Redhat systems,
there's some work to be done.
Here's how I implemented it:

Find and install these (or newer) packages (from http://rpmfind.net):

in /etc/sysconfig/network-scripts/ifcfg-eth0

Add the following to (around line 105) /etc/init.d/network:

if LANG=C egrep -L "^DHCLIENT=\"?[Yy][Ee][Ss]\"?" ifcfg-$i > /dev/null ;
        /sbin/dhclient $i

And finally here's a little script to notify you of address changes:


IPADDR_NEW=`/sbin/ifconfig $EXTETH | grep "inet addr" | cut -d: -f2 | awk
'{print $1}'`

if [ "$IPADDR_OLD" = "$IPADDR_NEW" ]; then
        exit 0
        sendmail "username.pager at company.com" <<END
Your new IP address is $IPADDR_NEW
        echo $IPADDR_NEW > $IPADDR_FILE

I hope that's useful to someone!


For help contact olug-help at olug.org - run by ezmlm
to unsubscribe, send mail to olug-unsubscribe at olug.org
or `mail olug-unsubscribe at olug.org < /dev/null`
(c)1998-2002 OLUG http://www.olug.org


More information about the OLUG mailing list