Typo
[linux_from_scratch_hints.git] / OLD / dhcpd.txt
blob7fdfd0eb9fc1b1c7ee4e7c4476aaf3536a4a6033
1 TITLE:          DHCP client daemon
2 LFS VERSION:    2.3
3 AUTHOR:         Simon Perreault <nomis80@videotron.ca>
5 SYNOPSIS:
6         How to setup a DHCP client daemon (this is used with cable modems, and possibly others).
8 HINT:
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
11 modems).
14 How to install and configure the DHCP client daemon according to the LFS
15 standards.
17 1. Get dhcpcd at ftp://ftp.phystech.com/pub/ . Unpack.
19 2. Execute
20     ./configure --prefix=/usr
21     make
22     make install
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.)
27 3. Execute
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
31 it will complain.
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
42     #!/bin/sh
43     # Begin /etc/init.d/dhcpcd
44     . /etc/init.d/functions
45     case "$1" in
46      start)
47       echo -n "Starting DHCP client daemon..."
48       start-stop-daemon -S -q -o -x /usr/sbin/dhcpcd
49       evaluate_retval
50       ;;
51      stop)
52       echo -n "Stopping DHCP client daemon..."
53       start-stop-daemon -K -q -o -p /var/run/dhcpcd-eth0.pid >/dev/null 2>&1
54       evaluate_retval
55       ;;
56      restart)
57       $0 stop
58       sleep 1
59       $0 start
60       ;;
61      *)
62       echo "Usage: $0 {start|stop|restart}"
63       exit 1
64       ;;
65     esac
66     # End /etc/init.d/dhcpcd
68 6. Execute
69     chmod 744 /etc/init.d/dhcpcd
70     cd /etc/rc3.d
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
79     <snip>
80      echo -n "Bringing up the eth0 interface..."
81      /sbin/ifconfig eth0 $IPADDR netmask $NETMASK
82      evaluate_retval
83     <snip>
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.