Typo
[linux_from_scratch_hints.git] / OLD / dhcpd2.txt
blob5c01ea4d8bf83ee43bda34b50abb653b4da8d27b
1 TITLE:          DHCP client daemon
2 LFS VERSION:    2.4.3
3 AUTHOR:         Thinus Pollard <thinusp@olienhout.org.za>
5 SYNOPSIS:
6         How to setup a DHCP client daemon. This is used with cable modems and some (most?) networks.
8 HINT:
9 I've got a DHCP based network, and after installing the 
10 DHCP client deamon according to Simon Perreault's <nomis80@videotron.ca> hint, 
11 I discovered a few things that makes it much better.
13 How to install and configure the DHCP client daemon according to the LFS 
14 standards. This works for a network card, I'm not sure about the cable 
15 modems. Gimme a shout if it doesn't work for you. I think the deamon goes 
16 and look for your network interface (compiled into the kernel) and sets it 
17 up accordingly. I don't know, i've only got one network card and no modems ;)
19 1. Get dhcpcd-1.3.19-pl2.tar.gz at ftp://ftp.phystech.com/pub/ . Unpack.
21 2. Execute the following in the source directory:
23 The archive contains some cache file that plays havoc with an LFS install ;) 
24 (or at least it did on mine)
26     rm config.cache
28 Configure it:
30     ./configure --prefix=/usr
32 There is now a bug in the Makefile that installs the config file directory 
33 to /usr/etc and the deamon wants it in /etc, so.......
34         
35     sed "s/\${prefix}\/etc/\/etc/" Makefile > Makefile2
36     mv Makefile2 Makefile
37         
38 Make and install it:
39         
40     make
41     make install
42         
43 As Simon said before, the deamon wants the /etc/dhcpc directory, not the 
44 /etc/dhcpcd dir that's created during install... (and we all know what 
45 happens when Simon says)
47     mv /etc/dhcpcd /etc/dhcpc
48         
49 3. And now for the magic.... by executing /usr/sbin/dhcpcd it automagically 
50 sets up your network card without any help from /etc/init.d/ethnet or 
51 /etc/sysconfig/network or  /etc/sysconfig/network-scripts/ifcfg-eth0 
52 or whatever
53    
54 Create the /etc/init.d/dhcpcd script containing the following:
55    
56     #!/bin/sh
57     # Begin /etc/init.d/dhcpcd
59     source /etc/init.d/functions
60    
61     case "$1" in
62         start)
63             echo -n "Starting DHCP client deamon..."
64             loadproc /usr/sbin/dhcpcd
65             ;;
66         stop)
67             echo -n "Stopping DHCP client deamon..."
68             killproc /usr/sbin/dhcpcd
69             ;;
70         restart)
71             $0 stop
72             /usr/bin/sleep 1
73             $0 start
74             ;;
75         status)
76             statusproc /usr/sbin/dhcpcd
77             ;;
78         *)
79             echo "Usage: $0 {start|stop|restart|status}"
80             exit 1
81             ;;
82     esac
83    
84     # End /etc/init.d/dhcpcd
85    
86 4. Execute:
88     chmod 754 /etc/init.d/dhcpcd
89         
90     cd /etc/rc0.d
91     ln -s ../init.d/dhcpcd K80dhcpcd
92     cd /etc/rc1.d
93     ln -s ../init.d/dhcpcd K80dhcpcd
94     cd /etc/rc2.d
95     ln -s ../init.d/dhcpcd K80dhcpcd
96     cd /etc/rc3.d
97     ln -s ../init.d/dhcpcd S05dhcpcd
98     cd /etc/rc4.d
99     ln -s ../init.d/dhcpcd S05dhcpcd
100     cd /etc/rc5.d
101     ln -s ../init.d/dhcpcd S05dhcpcd
102     cd /etc/rc6.d
103     ln -s ../init.d/dhcpcd K80dhcpcd
105 5. Remove all the ethnet symlinks you can find in the rc?.d directories
107 6. Alas, i still don't know what to do with /etc/hosts. I've noticed 
108 that SuSE sets it up like this:
110     127.0.0.1 localhost.localdomain localhost
111     127.0.0.2 <your hostname>.<your domain> <your hostname>
112         
113     Everything seems to be working
114    
115 7. I don't know what else depends on /etc/sysconfig/network (except the 
116 network boot scripts) Your ethernet interface doesn't need it anymore ;)
118 8. This is actually a pretty neat way of doing things. after you've 
119 run dhcpcd, take a look at ifconfig and route. You should see your setup 
120 in a working order if your dhcp server is set up correctly. Now kill 
121 the deamon and have another look... you should only see your loopback 
122 interface. Pretty nifty...
123    
124 I hope this helps somebody out there ;) My thanks to Simon for the 
125 original version of the DHCP hint. Please let me know what you 
126 think/suggestions by mailing to thinusp@olienhout.org.za