scrounge.org

Using dhcpcd instead of pump

10/16/2001 I wrote this page several years ago when Red Hat and Linux were version 6.X. See addendum at the end for a user contribution that contains information that is more up to date.


Recent versions of Linux install pump as the dhcp client. Many people have had problems with pump. This document tells you how to install the dhcpcd client program in place of pump.

You should be logged in as root for the entire procedure.

First, stop pump from running:

ifdown eth0(Assuming that 'eth0' is the network device that is connected to the cable modem.)

Then install the dhcpcd program from your Red Hat or Mandrake CD.

Insert the CD. Mount it, if needed. (mount /mnt/cdrom). Change to /mnt/cdrom/RedHat/RPMS. Find the exact name of the dhcpcd rpm file. (ls *dhcpcd*.rpm) Then type "rpm -Uvh dhdpcd_filename.rpm" to install it. Change back to the hard drive. (cd /) and unmount the CD. (umount /mnt/cdrom.)

Then, you must create the directory /etc/dhcpc, because dhcpcd uses this directory, but doesn't create it when dhcpcd is installed. (mkdir /etc/dhcpc)

Next, you must edit /etc/sysconfig/network-scripts/ifup. Search for the reference to pump.

if [ -n "$PUMP" ]; then
    echo -n "Determining IP information for $DEVICE..."
    if /sbin/pump -i $DEVICE ; then
        echo " done."

Change it to

if [ -n "$PUMP" ]; then
    echo -n "Determining IP information for $DEVICE..."
#    if /sbin/pump -i $DEVICE ; then
    if /sbin/dhcpcd $DEVICE  ; then
        echo " done."

(Don't forget to "comment out" the line that starts pump!)

I had seen references to phrase the dhcpcd line like this:

    if /sbin/dhcpcd $DEVICE -h $HOSTNAME  ; then

When I did, then dhcpcd failed on bootup. Apparently, the -h $HOSTNAME clause is needed in some cable modem systems, but flat out doesn't work at all on my system. You can try it either way. Use the version that works.

You also must modify /etc/sysconfig/network-scripts/ifdown. This step is often not mentioned in a lot of postings about dhcpcd. Look for

if [ "$BOOTPROTO" = bootp -o "$BOOTPROTO" = dhcp ]; then
       pump -r -i ${DEVICE}

and change it to

if [ "$BOOTPROTO" = bootp -o "$BOOTPROTO" = dhcp ]; then
#       pump -r -i ${DEVICE}
        /sbin/dhcpcd $DEVICE -k

You can test this now by typing

ifup eth0

It should give a civilized display and not complain about failing. Then try to bring it down.

ifdown eth0

And back up again

ifup eth0

Check to see if it has been configured properly. Type ifconfig and see what is displayed for eth0. Then try ping yahoo.com to see if your connection works. (Ctrl-C to exit ping.)

Then try re-booting and see if eth0 initializes OK.

Look at /etc/dhcpc/dhcpcd-eth0.info This will list all the network parameters that dhcpcd set. (IP address, DNS server, lease time, etc.)

I have also noted some misinformation about resolv.conf. Older versions of dhcpcd created resolv.conf in /etc/dhcpc and required a symbolic link to make it appear in /etc. The version of dhcpcd that comes with RH 6 creates /etc/resolv.conf directly.


Configure Syslog to log DHCP messages

Optional. You might want to change the default logfile where syslog sends DHCP messages to. (By default it goes to /var/log/messages.) To do this, edit your /etc/syslog.conf file and add this to it:

# Log dhcpcd operations
local0.*                        /var/log/dhcpcd.log

Remember to use tabs and NOT spaces in your syslog.conf file. Otherwise it won't work.

The system will now log DHCP messages to both /var/log/messages as well as to /var/log/dhcpcd.log, so now you have to tell it not to log DHCP messages to /var/log/messages. To do this, add ;local0.none to your /var/log/messages line. It should look something like this:

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;local0.none              /var/log/messages

For the changes to take effect, you'll need to restart the syslog daemon. To do so, just do a

killall -HUP syslogd

That will force syslogd to re-read its config file for the changes to take effect.

See man syslog.conf -S 5 for more information.

Syslog information courtesy of Bruce A. Buhler


Joe Kidd (cassiusdrow@yahoo.com) contributed:

Wayne, 

On your "Using dhcpcd instead of pump" page you give
some instructions that are no longer necessary for
RedHat 7.1.  The new ipup and ifdown scripts already
include the code for dhcpcd along side the code for
pump.  All that is required is to confirm that the
file /sbin/dhcpcd exists (dhcpcd is installed), and
to delete or rename the file /sbin/pump.  The new
scripts will automatically fall back to dhcpcd.

I wrote a little script that should be run as root to automate the
process.  It looks like this:

#!/bin/bash
#
# Switch from pump to dhcpcd
if [ -x /sbin/dhcpcd ] && [ -x /sbin/pump ];
then
    echo -n Switching from pump to dhcpcd...
    ifdown eth0
    chmod 644 /sbin/pump
    ifup eth0
    echo DONE.
fi

It makes sure that both dhcpcd & pump are executable, and then brings down
eth0, removes the executable flag from pump, then brings eth0 back up.  The
ifup/ifdown scripts will automatically use dhcpcd.

That's all there is to it

Thanks Joe.


Back to the scrounge.org home page.