source: networking/connect/dhcp.xml@ 095d076

trunk
Last change on this file since 095d076 was 095d076, checked in by Ken Moffat <ken@…>, 3 months ago

Fix dhcp for merged usr.

Prompted by:
mv: '/usr/sbin/dhclient' and '/sbin/dhclient' are the same file

  • Property mode set to 100644
File size: 18.3 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
7 <!ENTITY dhcp-download-http " ">
8 <!ENTITY dhcp-download-ftp "ftp://ftp.isc.org/isc/dhcp/&dhcp-version;/dhcp-&dhcp-version;.tar.gz">
9 <!ENTITY dhcp-md5sum "2afdaf8498dc1edaf3012efdd589b3e1">
10 <!ENTITY dhcp-size "9.4 MB">
11 <!ENTITY dhcp-buildsize "115 MB">
12 <!ENTITY dhcp-time "0.4 SBU">
13]>
14
15<sect1 id="dhcp" xreflabel="DHCP-&dhcp-version;">
16 <?dbhtml filename="dhcp.html"?>
17
18 <sect1info>
19 <date>$Date$</date>
20 </sect1info>
21
22 <title>DHCP-&dhcp-version;</title>
23
24 <indexterm zone="dhcp">
25 <primary sortas="a-DHCP">DHCP</primary>
26 </indexterm>
27
28 <sect2 role="package">
29 <title>Introduction to ISC DHCP</title>
30
31 <para>
32 The <application>ISC DHCP</application> package contains both the client
33 and server programs for DHCP. <command>dhclient</command> (the client) is
34 used for connecting to a network which uses DHCP to assign network
35 addresses. <command>dhcpd</command> (the server) is used for assigning
36 network addresses on private networks.
37 </para>
38
39 &lfs101_checked;
40
41 <bridgehead renderas="sect3">Package Information</bridgehead>
42 <itemizedlist spacing="compact">
43 <listitem>
44 <para>
45 Download (HTTP): <ulink url="&dhcp-download-http;"/>
46 </para>
47 </listitem>
48 <listitem>
49 <para>
50 Download (FTP): <ulink url="&dhcp-download-ftp;"/>
51 </para>
52 </listitem>
53 <listitem>
54 <para>
55 Download MD5 sum: &dhcp-md5sum;
56 </para>
57 </listitem>
58 <listitem>
59 <para>
60 Download size: &dhcp-size;
61 </para>
62 </listitem>
63 <listitem>
64 <para>
65 Estimated disk space required: &dhcp-buildsize;
66 </para>
67 </listitem>
68 <listitem>
69 <para>
70 Estimated build time: &dhcp-time;
71 </para>
72 </listitem>
73 </itemizedlist>
74<!--
75 <bridgehead renderas="sect3">Additional Downloads</bridgehead>
76 <itemizedlist spacing="compact">
77 <listitem>
78 <para>
79 Required patch:
80 <ulink url="&patch-root;/dhcp-&dhcp-version;-client_script-1.patch"/>
81 </para>
82 </listitem>
83 <listitem>
84 <para>
85 Optional patch:
86 <ulink url="&patch-root;/dhcp-&dhcp-version;-missing_ipv6-1.patch"/>
87 </para>
88 </listitem>
89 </itemizedlist>
90-->
91 <para condition="html" role="usernotes">User Notes:
92 <ulink url="&blfs-wiki;/dhcp"/>
93 </para>
94 </sect2>
95
96 <sect2 role="kernel" id="dhcp-kernel">
97 <title>Kernel Configuration</title>
98
99 <para>
100 You must have Packet Socket support. IPv6 support is optional.
101 </para>
102
103<screen><literal>[*] Networking support ---&gt; [CONFIG_NET]
104 Networking options ---&gt;
105 &lt;*&gt; Packet socket [CONFIG_PACKET]
106 &lt;*&gt; The IPv6 Protocol ---&gt; [CONFIG_IPV6]</literal></screen>
107<!--
108 <para>
109 If you do not have IPv6 support:
110 </para>
111
112<screen><literal>[*] Networking support - - -&gt; [CONFIG_NET]
113 Networking Options - - -&gt;
114 &lt;*&gt; The IPv6 Protocol - - -&gt; [CONFIG_IPV6]</literal></screen>
115
116 <para>
117 compiled in, then you must use the <quote>missing_ipv6</quote> patch.
118 </para>
119-->
120 <indexterm zone="dhcp dhcp-kernel">
121 <primary sortas="d-DHCP">DHCP</primary>
122 </indexterm>
123
124 </sect2>
125
126 <sect2 role="installation">
127 <title>Installation of ISC DHCP</title>
128
129 <para>
130 First, fix a build issue with GCC 10 and later:
131 </para>
132
133<screen><userinput>sed -i '/o.*dhcp_type/d' server/mdb.c &amp;&amp;
134sed -r '/u.*(local|remote)_port/d' \
135 -i client/dhclient.c \
136 relay/dhcrelay.c</userinput></screen>
137
138 <note>
139 <para>
140 This package does not support parallel build.
141 </para>
142 </note>
143<!-- This should not be needed any more. Visual check appears to handle it.
144 <para>
145 If you have not compiled IPv6 support into the kernel, apply the
146 missing_ipv6 patch:
147 </para>
148
149<screen><userinput>patch -Np1 -i ../dhcp-&dhcp-version;-missing_ipv6-1.patch</userinput></screen>
150-->
151 <note>
152 <para>
153 Be careful with the instructions below. The single and
154 double quotes are important because the defined
155 variables are used verbatim in the code.
156 </para>
157 </note>
158
159 <para>
160 Install <application>ISC DHCP</application> by running
161 the following commands:
162 </para>
163
164<!--
165 Running ( export CFLAGS=... ./configure ... ) in a subshell
166 preserves CFLAGS if they are set in environment
167-->
168<screen><userinput>( export CFLAGS="${CFLAGS:--g -O2} -Wall -fno-strict-aliasing \
169 -D_PATH_DHCLIENT_SCRIPT='\"/usr/sbin/dhclient-script\"' \
170 -D_PATH_DHCPD_CONF='\"/etc/dhcp/dhcpd.conf\"' \
171 -D_PATH_DHCLIENT_CONF='\"/etc/dhcp/dhclient.conf\"'" &amp;&amp;
172
173./configure --prefix=/usr \
174 --sysconfdir=/etc/dhcp \
175 --localstatedir=/var \
176 --with-srv-lease-file=/var/lib/dhcpd/dhcpd.leases \
177 --with-srv6-lease-file=/var/lib/dhcpd/dhcpd6.leases \
178 --with-cli-lease-file=/var/lib/dhclient/dhclient.leases \
179 --with-cli6-lease-file=/var/lib/dhclient/dhclient6.leases
180) &amp;&amp;
181make -j1</userinput></screen>
182
183 <para>
184 <!-- Note: make check builds a library, but otherwise does nothing. -->
185 This package does not come with a test suite.
186 </para>
187
188 <para>
189 If you only want to install the <application>ISC DHCP</application> client,
190 issue the following commands as the
191 <systemitem class="username">root</systemitem> user:
192 </para>
193
194<screen role="root"><userinput>make -C client install &amp;&amp;
195install -v -m755 client/scripts/linux /usr/sbin/dhclient-script</userinput></screen>
196
197 <para>
198 Skip to <xref linkend="dhclient-config"/> in order to configure the
199 client
200 </para>
201
202 <para>
203 If you only want to install the <application>ISC DHCP</application> server,
204 issue the following command as the
205 <systemitem class="username">root</systemitem> user:
206 </para>
207
208<screen role="root"><userinput>make -C server install</userinput></screen>
209
210 <para>
211 Skip to <xref linkend="dhcpd-config"/> in order to configure the server.
212 </para>
213
214 <para>
215 Alternatively, you can install whole package which includes the client,
216 server, relay, static libraries and development headers by running the
217 following commands as the
218 <systemitem class="username">root</systemitem> user:
219 </para>
220
221<screen role="root"><userinput>make install &amp;&amp;
222install -v -m755 client/scripts/linux /usr/sbin/dhclient-script</userinput></screen>
223
224 </sect2>
225
226 <sect2 role="configuration">
227 <title>Configuring ISC DHCP</title>
228
229 <sect3 id="dhcp-config">
230 <title>Config Files</title>
231
232 <para>
233 <filename>/etc/dhcp/dhclient.conf</filename> and
234 <filename>/etc/dhcp/dhcpd.conf</filename>
235 </para>
236
237 <indexterm zone="dhcp dhcp-config">
238 <primary sortas="e-etc-dhcp-dhclient.conf">/etc/dhcp/dhclient.conf</primary>
239 </indexterm>
240
241 <indexterm zone="dhcp dhcp-config">
242 <primary sortas="e-etc-dhcp-dhcpd.conf">/etc/dhcp/dhcpd.conf</primary>
243 </indexterm>
244
245 </sect3>
246
247 <sect3 id="dhclient-config">
248 <title>Client Configuration</title>
249
250 <para>
251 Create a basic <filename>/etc/dhcp/dhclient.conf</filename>
252 by running the following command as the
253 <systemitem class="username">root</systemitem> user:
254 </para>
255
256<screen role="root"><userinput>install -vdm755 /etc/dhcp &amp;&amp;
257cat &gt; /etc/dhcp/dhclient.conf &lt;&lt; "EOF"
258<literal># Begin /etc/dhcp/dhclient.conf
259#
260# Basic dhclient.conf(5)
261
262#prepend domain-name-servers 127.0.0.1;
263request subnet-mask, broadcast-address, time-offset, routers,
264 domain-name, domain-name-servers, domain-search, host-name,
265 netbios-name-servers, netbios-scope, interface-mtu,
266 ntp-servers;
267require subnet-mask, domain-name-servers;
268#timeout 60;
269#retry 60;
270#reboot 10;
271#select-timeout 5;
272#initial-interval 2;
273
274# End /etc/dhcp/dhclient.conf</literal>
275EOF</userinput></screen>
276
277 <para>
278 See <command>man 5 dhclient.conf</command> for additional options.
279 </para>
280
281 <para>
282 Now create the <filename class="directory">/var/lib/dhclient</filename>
283 directory which will contain DHCP Client leases by running the following
284 command as the <systemitem class="username">root</systemitem> user:
285 </para>
286
287<screen role="root"><userinput>install -v -dm 755 /var/lib/dhclient</userinput></screen>
288
289 <para id="dhclient-service-sysd" revision="systemd">
290 If you want to configure network interfaces at boot using
291 <command>dhclient</command>, you need to install the
292 <filename>dhclient@.service</filename> unit included in the
293 <xref linkend="systemd-units"/> package by running the following
294 command as the <systemitem class="username">root</systemitem> user:
295 </para>
296
297 <indexterm zone="dhcp dhclient-service-sysd" revision="systemd">
298 <primary sortas="f-dhclient">dhclient@.service</primary>
299 </indexterm>
300
301<screen role="root" revision="systemd"><userinput>make install-dhclient</userinput></screen>
302
303 <note revision="systemd">
304 <para>
305 Make sure that you disable the <command>systemd-networkd</command>
306 service or configure it not to manage the interfaces you want to
307 manage with <command>dhclient</command>.
308 </para>
309 </note>
310
311 <para>
312 At this point you can test if <command>dhclient</command> is
313 behaving as expected by running the following command as the
314 <systemitem class="username">root</systemitem> user:
315 </para>
316
317<screen role="root" revision="sysv"><userinput>dhclient <replaceable>&lt;eth0&gt;</replaceable></userinput></screen>
318
319<screen role="root" revision="systemd"><userinput>systemctl start dhclient@<replaceable>eth0</replaceable></userinput></screen>
320
321 <para revision="sysv">
322 Replace <replaceable>&lt;eth0&gt;</replaceable> with your
323 desired interface. If you want more verbose output, add the
324 <command>-v</command> parameter to the command above.
325 </para>
326
327 <para id="dhclient-service" revision="sysv">
328 If you want to configure network interfaces at boot using
329 <command>dhclient</command>, you need to install the
330 <filename>/lib/services/dhclient</filename> script
331 included in <xref linkend="bootscripts"/> package:
332 </para>
333
334<screen role="root" revision="sysv"><userinput>make install-service-dhclient</userinput></screen>
335
336 <indexterm zone="dhcp dhclient-service" revision="sysv">
337 <primary sortas="f-dhclient">dhclient (service script)</primary>
338 </indexterm>
339
340 <para id="dhclient-ifconfig" revision="sysv">
341 Next, create the <filename>/etc/sysconfig/ifconfig.eth0</filename>
342 configuration file with the following commands as the
343 <systemitem class="username">root</systemitem> user:
344 </para>
345
346<screen role="root" revision="sysv"><userinput>cat &gt; /etc/sysconfig/ifconfig.eth0 &lt;&lt; "EOF"
347<literal>ONBOOT="yes"
348IFACE="eth0"
349SERVICE="dhclient"
350DHCP_START=""
351DHCP_STOP=""
352
353# Set PRINTIP="yes" to have the script print
354# the DHCP assigned IP address
355PRINTIP="no"
356
357# Set PRINTALL="yes" to print the DHCP assigned values for
358# IP, SM, DG, and 1st NS. This requires PRINTIP="yes".
359PRINTALL="no"</literal>
360EOF</userinput></screen>
361
362 <indexterm zone="dhcp dhclient-ifconfig" revision="sysv">
363 <primary sortas="e-etc-sysconfig-...-dhclient">/etc/sysconfig/ifconfig.eth0</primary>
364 </indexterm>
365
366 <para revision="sysv">
367 Adjust the file to suit your needs.
368 </para>
369
370 <para revision="sysv">
371 For more information on the appropriate <envar>DHCP_START</envar>
372 and <envar>DHCP_STOP</envar> values see
373 <command>man 8 dhclient</command>.
374 </para>
375
376 <para revision="systemd">
377 To start <command>dhclient</command> on a specific interface
378 at boot, enable the previously installed systemd unit by
379 running the following command as the
380 <systemitem class="username">root</systemitem> user:
381 </para>
382
383<screen role="root" revision="systemd"><userinput>systemctl enable dhclient@<replaceable>eth0</replaceable></userinput></screen>
384
385 <para revision="systemd">
386 Replace <replaceable>eth0</replaceable> with the actual interface name.
387 </para>
388
389 </sect3>
390
391 <sect3 id="dhcpd-config">
392 <title>Server Configuration</title>
393
394 <para>
395 Note that you only need the DHCP server if you want to issue
396 LAN addresses over your network. The DHCP client doesn't need
397 the server in order to function properly.
398 </para>
399
400 <para>
401 Start with creating <filename>/etc/dhcp/dhcpd.conf</filename>
402 by running the following command as the
403 <systemitem class="username">root</systemitem> user:
404 </para>
405
406<screen role="root"><userinput>cat &gt; /etc/dhcp/dhcpd.conf &lt;&lt; "EOF"
407<literal># Begin /etc/dhcp/dhcpd.conf
408#
409# Example dhcpd.conf(5)
410
411# Use this to enable / disable dynamic dns updates globally.
412ddns-update-style none;
413
414# option definitions common to all supported networks...
415option domain-name "example.org";
416option domain-name-servers ns1.example.org, ns2.example.org;
417
418default-lease-time 600;
419max-lease-time 7200;
420
421# This is a very basic subnet declaration.
422subnet 10.254.239.0 netmask 255.255.255.224 {
423 range 10.254.239.10 10.254.239.20;
424 option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
425}
426
427# End /etc/dhcp/dhcpd.conf</literal>
428EOF</userinput></screen>
429
430 <para>
431 Adjust the file to suit your needs. See
432 <command>man 5 dhcpd.conf</command> for additional options.
433 </para>
434
435 <para>
436 Now create the <filename class="directory">/var/lib/dhcpd</filename>
437 directory which will contain DHCP Server leases by running the following
438 command as the <systemitem class="username">root</systemitem> user:
439 </para>
440
441<screen role="root"><userinput>install -v -dm 755 /var/lib/dhcpd</userinput></screen>
442
443 <para>
444 If you want to start the DHCP Server at boot, install the
445 <phrase revision="sysv"><filename>/etc/rc.d/init.d/dhcpd</filename>
446 inti script</phrase>
447 <phrase revision="systemd"><filename>dhcpd.service</filename>
448 unit</phrase> included in the
449 <xref linkend="bootscripts" revision="sysv"/>
450 <xref linkend="systemd-units" revision="systemd"/>
451 package:
452 </para>
453
454<screen role="root"><userinput>make install-dhcpd</userinput></screen>
455
456 <indexterm zone="dhcp dhcpd-config">
457 <primary sortas="f-dhcpd">dhcpd</primary>
458 </indexterm>
459
460 <para>
461 You will need to edit the
462 <phrase revision="sysv"><filename>/etc/sysconfig/dhcpd</filename></phrase>
463 <phrase revision="systemd"><filename>/etc/default/dhcpd</filename></phrase>
464 in order to set the interface on which <command>dhcpd</command>
465 will serve the DHCP requests.
466 </para>
467
468 </sect3>
469
470 </sect2>
471
472 <sect2 role="content">
473 <title>Contents</title>
474
475 <segmentedlist>
476 <segtitle>Installed Programs</segtitle>
477 <segtitle>Installed Libraries</segtitle>
478 <segtitle>Installed Directories</segtitle>
479
480 <seglistitem>
481 <seg>
482 dhclient, dhclient-script, dhcpd, dhcrelay and omshell
483 </seg>
484 <seg>
485 libdhcpctl.a and libomapi.a
486 </seg>
487 <seg>
488 /etc/dhcp,
489 /usr/include/dhcpctl,
490 /usr/include/isc-dhcp,
491 /usr/include/omapip,
492 /var/lib/dhclient and
493 /var/lib/dhcpd
494 </seg>
495 </seglistitem>
496 </segmentedlist>
497
498 <variablelist>
499 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
500 <?dbfo list-presentation="list"?>
501 <?dbhtml list-presentation="table"?>
502
503 <varlistentry id="dhclient">
504 <term><command>dhclient</command></term>
505 <listitem>
506 <para>
507 is the implementation of the DHCP client
508 </para>
509 <indexterm zone="dhcp dhclient">
510 <primary sortas="b-dhclient">dhclient</primary>
511 </indexterm>
512 </listitem>
513 </varlistentry>
514
515 <varlistentry id="dhclient-script">
516 <term><command>dhclient-script</command></term>
517 <listitem>
518 <para>
519 is used by dhclient to (re)configure interfaces. It can make
520 extra changes by invoking custom dhclient-{entry,exit}-hooks
521 </para>
522 <indexterm zone="dhcp dhclient-script">
523 <primary sortas="b-dhclient-script">dhclient-script</primary>
524 </indexterm>
525 </listitem>
526 </varlistentry>
527
528 <varlistentry id="dhcpd">
529 <term><command>dhcpd</command></term>
530 <listitem>
531 <para>
532 implements Dynamic Host Configuration Protocol (DHCP) and
533 Internet Bootstrap Protocol (BOOTP) requests for network
534 addresses
535 </para>
536 <indexterm zone="dhcp dhcpd">
537 <primary sortas="b-dhcpd">dhcpd</primary>
538 </indexterm>
539 </listitem>
540 </varlistentry>
541
542 <varlistentry id="dhcrelay">
543 <term><command>dhcrelay</command></term>
544 <listitem>
545 <para>
546 provides a means to accept DHCP and BOOTP requests on a subnet
547 without a DHCP server and relay them to a DHCP server on another
548 subnet
549 </para>
550 <indexterm zone="dhcp dhcrelay">
551 <primary sortas="b-dhcrelay">dhcrelay</primary>
552 </indexterm>
553 </listitem>
554 </varlistentry>
555
556 <varlistentry id="omshell">
557 <term><command>omshell</command></term>
558 <listitem>
559 <para>
560 provides an interactive way to connect to, query and
561 possibly change the ISC DHCP Server's state via OMAPI, the
562 Object Management API
563 </para>
564 <indexterm zone="dhcp omshell">
565 <primary sortas="b-omshell">omshell</primary>
566 </indexterm>
567 </listitem>
568 </varlistentry>
569
570 </variablelist>
571
572 </sect2>
573
574</sect1>
Note: See TracBrowser for help on using the repository browser.