source: networking/connect/dhcp.xml@ edfde25

10.0 10.1 11.0 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind ken/refactor-virt lazarus perl-modules qt5new trunk xry111/git-date xry111/git-date-for-trunk xry111/git-date-test
Last change on this file since edfde25 was edfde25, checked in by Thomas Trepl <thomas@…>, 4 years ago

Upgrade to dhcp-4.4.0.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@19733 af4574ff-66df-0310-9fd7-8a98e5e911e0

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