1 TITLE: DHCP client daemon
3 AUTHOR: Simon Perreault <nomis80@videotron.ca>
6 How to setup a DHCP client daemon (this is used with cable modems, and possibly others).
9 I wrote this because the network boot scripts section didn't ever mention
10 that it may be done otherwise for those with dhcp-based access (most cable
14 How to install and configure the DHCP client daemon according to the LFS
17 1. Get dhcpcd at ftp://ftp.phystech.com/pub/ . Unpack.
20 ./configure --prefix=/usr
24 (Optimizations may be used, but as I told Ian Chilton, I disagree with
25 the use of the -e switch. Do what you want.)
28 mv /etc/dhcpcd /etc/dhcpc
29 This is done because there is a bug in the installation, and it creates
30 the directory as dhcpcd instead of dhcpc. The program needs dhcpc, or else
33 4. Add those two lines to /etc/sysconfdir/network
34 IPADDR=$(head -n 1 /etc/dhcpc/dhcpcd-eth0.info | cut -c 8-)
35 NETMASK=$(head -n 2 /etc/dhcpc/dhcpcd-eth0.info | tail -n 1 | cut -c 9-)
37 You may also add a BROADCAST value, but I think dhcp-based connections
38 don't need those. If you need one, create it yourself. We're learning, and
39 head, tail and cut are must-understand tools.
41 5. Create /etc/init.d/dhcpcd containing the following
43 # Begin /etc/init.d/dhcpcd
44 . /etc/init.d/functions
47 echo -n "Starting DHCP client daemon..."
48 start-stop-daemon -S -q -o -x /usr/sbin/dhcpcd
52 echo -n "Stopping DHCP client daemon..."
53 start-stop-daemon -K -q -o -p /var/run/dhcpcd-eth0.pid >/dev/null 2>&1
62 echo "Usage: $0 {start|stop|restart}"
66 # End /etc/init.d/dhcpcd
69 chmod 744 /etc/init.d/dhcpcd
71 ln -s ../init.d/dhcpcd S05dhcpcd
73 7. I think the right host version is the "no network card" version (at least
74 it works for me), because your IP is not static. I haven't found a way to
75 deal with it so that the IP may vary.
77 8. If you haven't set a BROADCAST value in /etc/sysconfig/network, remove
78 the BROADCAST part in /etc/init.d/ethnet, so that it looks like this
80 echo -n "Bringing up the eth0 interface..."
81 /sbin/ifconfig eth0 $IPADDR netmask $NETMASK
85 9. If your dhcp server assigns you a hostname, you may (should) edit
86 /etc/sysconfig/network so that it is based on the
87 /etc/dhcpc/dhcpcd-eth0.info file like other variables.
89 10. I think that's about it. Important info about your connection can be
90 obtained in /etc/dhcpc/dhcpcd-eth0.info and can be used easily in scripts.
92 PLEASE feel free to send me comments and suggestions.