[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):
dhcp-client-3.0.1rc6-1.cra.i386.rpm
dhcp-3.0.1rc6-1cra..i386.rpm

Replace
"BOOTPROTO=dhcp"
in /etc/sysconfig/network-scripts/ifcfg-eth0
with
"DHCLIENT=yes"

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

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

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

#!/bin/bash
#/root/bin/notify_ipaddress_change

EXTETH=eth0
IPADDR_FILE=/root/bin/tmp/IPADDR
IPADDR_OLD=`cat $IPADDR_FILE`
IPADDR_NEW=`/sbin/ifconfig $EXTETH | grep "inet addr" | cut -d: -f2 | awk
'{print $1}'`

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

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