source: networking/connect/dhcp.xml@ 9fe7d58

10.0 10.1 11.0 9.0 9.1 ken/refactor-virt lazarus qt5new trunk xry111/git-date xry111/git-date-for-trunk xry111/git-date-test
Last change on this file since 9fe7d58 was 9fe7d58, checked in by Pierre Labastie <pieere@…>, 3 years ago

typo

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

  • Property mode set to 100644
File size: 18.1 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 "18c7f4dcbb0a63df25098216d47b1ede">
10 <!ENTITY dhcp-size "10 MB">
11 <!ENTITY dhcp-buildsize "171 MB">
12 <!ENTITY dhcp-time "0.8 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 &lfs84_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<!--
156 Running ( export CFLAGS=... ./configure ... ) in a subshell
157 preserves CFLAGS if they are set in environment
158-->
159<screen><userinput>( export CFLAGS="$CFLAGS -Wall -fno-strict-aliasing \
160 -D_PATH_DHCLIENT_SCRIPT='\"/sbin/dhclient-script\"' \
161 -D_PATH_DHCPD_CONF='\"/etc/dhcp/dhcpd.conf\"' \
162 -D_PATH_DHCLIENT_CONF='\"/etc/dhcp/dhclient.conf\"'" &amp;&amp;
163
164./configure --prefix=/usr \
165 --sysconfdir=/etc/dhcp \
166 --localstatedir=/var \
167 --with-srv-lease-file=/var/lib/dhcpd/dhcpd.leases \
168 --with-srv6-lease-file=/var/lib/dhcpd/dhcpd6.leases \
169 --with-cli-lease-file=/var/lib/dhclient/dhclient.leases \
170 --with-cli6-lease-file=/var/lib/dhclient/dhclient6.leases
171) &amp;&amp;
172make -j1</userinput></screen>
173
174 <para>
175 <!-- Note: make check builds a library, but otherwise does nothing. -->
176 This package does not come with a test suite.
177 </para>
178
179 <para>
180 If you only want to install the <application>ISC DHCP</application> client,
181 issue the following commands as the
182 <systemitem class="username">root</systemitem> user:
183 </para>
184
185<screen role="root"><userinput>make -C client install &amp;&amp;
186mv -v /usr/sbin/dhclient /sbin &amp;&amp;
187install -v -m755 client/scripts/linux /sbin/dhclient-script</userinput></screen>
188
189 <para>
190 Skip to <xref linkend="dhclient-config"/> in order to configure the
191 client
192 </para>
193
194 <para>
195 If you only want to install the <application>ISC DHCP</application> server,
196 issue the following command as the
197 <systemitem class="username">root</systemitem> user:
198 </para>
199
200<screen role="root"><userinput>make -C server install</userinput></screen>
201
202 <para>
203 Skip to <xref linkend="dhcpd-config"/> in order to configure the server.
204 </para>
205
206 <para>
207 Alternatively, you can install whole package which includes the client,
208 server, relay, static libraries and development headers by running the
209 following commands as the
210 <systemitem class="username">root</systemitem> user:
211 </para>
212
213<screen role="root"><userinput>make install &amp;&amp;
214mv -v /usr/sbin/dhclient /sbin &amp;&amp;
215install -v -m755 client/scripts/linux /sbin/dhclient-script</userinput></screen>
216
217 </sect2>
218
219 <sect2 role="configuration">
220 <title>Configuring ISC DHCP</title>
221
222 <sect3 id="dhcp-config">
223 <title>Config Files</title>
224
225 <para>
226 <filename>/etc/dhcp/dhclient.conf</filename> and
227 <filename>/etc/dhcp/dhcpd.conf</filename>
228 </para>
229
230 <indexterm zone="dhcp dhcp-config">
231 <primary sortas="e-etc-dhcp-dhclient.conf">/etc/dhcp/dhclient.conf</primary>
232 </indexterm>
233
234 <indexterm zone="dhcp dhcp-config">
235 <primary sortas="e-etc-dhcp-dhcpd.conf">/etc/dhcp/dhcpd.conf</primary>
236 </indexterm>
237
238 </sect3>
239
240 <sect3 id="dhclient-config">
241 <title>Client Configuration</title>
242
243 <para>
244 Create a basic <filename>/etc/dhcp/dhclient.conf</filename>
245 by running the following command as the
246 <systemitem class="username">root</systemitem> user:
247 </para>
248
249<screen role="root"><userinput>install -vdm755 /etc/dhcp &amp;&amp;
250cat &gt; /etc/dhcp/dhclient.conf &lt;&lt; "EOF"
251<literal># Begin /etc/dhcp/dhclient.conf
252#
253# Basic dhclient.conf(5)
254
255#prepend domain-name-servers 127.0.0.1;
256request subnet-mask, broadcast-address, time-offset, routers,
257 domain-name, domain-name-servers, domain-search, host-name,
258 netbios-name-servers, netbios-scope, interface-mtu,
259 ntp-servers;
260require subnet-mask, domain-name-servers;
261#timeout 60;
262#retry 60;
263#reboot 10;
264#select-timeout 5;
265#initial-interval 2;
266
267# End /etc/dhcp/dhclient.conf</literal>
268EOF</userinput></screen>
269
270 <para>
271 See <command>man 5 dhclient.conf</command> for additional options.
272 </para>
273
274 <para>
275 Now create the <filename class="directory">/var/lib/dhclient</filename>
276 directory which will contain DHCP Client leases by running the following
277 command as the <systemitem class="username">root</systemitem> user:
278 </para>
279
280<screen role="root"><userinput>install -v -dm 755 /var/lib/dhclient</userinput></screen>
281
282 <para id="dhclient-service-sysd" revision="systemd">
283 If you want to configure network interfaces at boot using
284 <command>dhclient</command>, you need to install the
285 <filename>dhclient@.service</filename> unit included in the
286 <xref linkend="systemd-units"/> package by running the following
287 command as the <systemitem class="username">root</systemitem> user:
288 </para>
289
290 <indexterm zone="dhcp dhclient-service-sysd" revision="systemd">
291 <primary sortas="f-dhclient">dhclient@.service</primary>
292 </indexterm>
293
294<screen role="root" revision="systemd"><userinput>make install-dhclient</userinput></screen>
295
296 <note revision="systemd">
297 <para>
298 Make sure that you disable the <command>systemd-networkd</command>
299 service or configure it not to manage the interfaces you want to
300 manage with <command>dhclient</command>.
301 </para>
302 </note>
303
304 <para>
305 At this point you can test if <command>dhclient</command> is
306 behaving as expected by running the following command as the
307 <systemitem class="username">root</systemitem> user:
308 </para>
309
310<screen role="root" revision="sysv"><userinput>dhclient <replaceable>&lt;eth0&gt;</replaceable></userinput></screen>
311
312<screen role="root" revision="systemd"><userinput>systemctl start dhclient@<replaceable>eth0</replaceable></userinput></screen>
313
314 <para revision="sysv">
315 Replace <replaceable>&lt;eth0&gt;</replaceable> with your
316 desired interface. If you want more verbose output, add the
317 <command>-v</command> parameter to the command above.
318 </para>
319
320 <para id="dhclient-service" revision="sysv">
321 If you want to configure network interfaces at boot using
322 <command>dhclient</command>, you need to install the
323 <filename>/lib/services/dhclient</filename> script
324 included in <xref linkend="bootscripts"/> package:
325 </para>
326
327<screen role="root" revision="sysv"><userinput>make install-service-dhclient</userinput></screen>
328
329 <indexterm zone="dhcp dhclient-service" revision="sysv">
330 <primary sortas="f-dhclient">dhclient (service script)</primary>
331 </indexterm>
332
333 <para id="dhclient-ifconfig" revision="sysv">
334 Next, create the <filename>/etc/sysconfig/ifconfig.eth0</filename>
335 configuration file with the following commands as the
336 <systemitem class="username">root</systemitem> user:
337 </para>
338
339<screen role="root" revision="sysv"><userinput>cat &gt; /etc/sysconfig/ifconfig.eth0 &lt;&lt; "EOF"
340<literal>ONBOOT="yes"
341IFACE="eth0"
342SERVICE="dhclient"
343DHCP_START=""
344DHCP_STOP=""
345
346# Set PRINTIP="yes" to have the script print
347# the DHCP assigned IP address
348PRINTIP="no"
349
350# Set PRINTALL="yes" to print the DHCP assigned values for
351# IP, SM, DG, and 1st NS. This requires PRINTIP="yes".
352PRINTALL="no"</literal>
353EOF</userinput></screen>
354
355 <indexterm zone="dhcp dhclient-ifconfig" revision="sysv">
356 <primary sortas="e-etc-sysconfig-...-dhclient">/etc/sysconfig/ifconfig.eth0</primary>
357 </indexterm>
358
359 <para revision="sysv">
360 Adjust the file to suit your needs.
361 </para>
362
363 <para revision="sysv">
364 For more information on the appropriate <envar>DHCP_START</envar>
365 and <envar>DHCP_STOP</envar> values see
366 <command>man 8 dhclient</command>.
367 </para>
368
369 <para revision="systemd">
370 To start <command>dhclient</command> on a specific interface
371 at boot, enable the previously installed systemd unit by
372 running the following command as the
373 <systemitem class="username">root</systemitem> user:
374 </para>
375
376<screen role="root" revision="systemd"><userinput>systemctl enable dhclient@<replaceable>eth0</replaceable></userinput></screen>
377
378 <para revision="systemd">
379 Replace <replaceable>eth0</replaceable> with the actual interface name.
380 </para>
381
382 </sect3>
383
384 <sect3 id="dhcpd-config">
385 <title>Server Configuration</title>
386
387 <para>
388 Note that you only need the DHCP server if you want to issue
389 LAN addresses over your network. The DHCP client doesn't need
390 the server in order to function properly.
391 </para>
392
393 <para>
394 Start with creating <filename>/etc/dhcp/dhcpd.conf</filename>
395 by running the following command as the
396 <systemitem class="username">root</systemitem> user:
397 </para>
398
399<screen role="root"><userinput>cat &gt; /etc/dhcp/dhcpd.conf &lt;&lt; "EOF"
400<literal># Begin /etc/dhcp/dhcpd.conf
401#
402# Example dhcpd.conf(5)
403
404# Use this to enable / disable dynamic dns updates globally.
405ddns-update-style none;
406
407# option definitions common to all supported networks...
408option domain-name "example.org";
409option domain-name-servers ns1.example.org, ns2.example.org;
410
411default-lease-time 600;
412max-lease-time 7200;
413
414# This is a very basic subnet declaration.
415subnet 10.254.239.0 netmask 255.255.255.224 {
416 range 10.254.239.10 10.254.239.20;
417 option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
418}
419
420# End /etc/dhcp/dhcpd.conf</literal>
421EOF</userinput></screen>
422
423 <para>
424 Adjust the file to suit your needs. See
425 <command>man 5 dhcpd.conf</command> for additional options.
426 </para>
427
428 <para>
429 Now create the <filename class="directory">/var/lib/dhcpd</filename>
430 directory which will contain DHCP Server leases by running the following
431 command as the <systemitem class="username">root</systemitem> user:
432 </para>
433
434<screen role="root"><userinput>install -v -dm 755 /var/lib/dhcpd</userinput></screen>
435
436 <para>
437 If you want to start the DHCP Server at boot, install the
438 <phrase revision="sysv"><filename>/etc/rc.d/init.d/dhcpd</filename>
439 inti script</phrase>
440 <phrase revision="systemd"><filename>dhcpd.service</filename>
441 unit</phrase> included in the
442 <xref linkend="bootscripts" revision="sysv"/>
443 <xref linkend="systemd-units" revision="systemd"/>
444 package:
445 </para>
446
447<screen role="root"><userinput>make install-dhcpd</userinput></screen>
448
449 <indexterm zone="dhcp dhcpd-config">
450 <primary sortas="f-dhcpd">dhcpd</primary>
451 </indexterm>
452
453 <para>
454 You will need to edit the
455 <phrase revision="sysv"><filename>/etc/sysconfig/dhcpd</filename></phrase>
456 <phrase revision="systemd"><filename>/etc/default/dhcpd</filename></phrase>
457 in order to set the interface on which <command>dhcpd</command>
458 will serve the DHCP requests.
459 </para>
460
461 </sect3>
462
463 </sect2>
464
465 <sect2 role="content">
466 <title>Contents</title>
467
468 <segmentedlist>
469 <segtitle>Installed Programs</segtitle>
470 <segtitle>Installed Libraries</segtitle>
471 <segtitle>Installed Directories</segtitle>
472
473 <seglistitem>
474 <seg>
475 dhclient, dhclient-script, dhcpd, dhcrelay and omshell
476 </seg>
477 <seg>
478 libdhcpctl.a and libomapi.a
479 </seg>
480 <seg>
481 /etc/dhcp,
482 /usr/include/dhcpctl,
483 /usr/include/isc-dhcp,
484 /usr/include/omapip,
485 /var/lib/dhclient and
486 /var/lib/dhcpd
487 </seg>
488 </seglistitem>
489 </segmentedlist>
490
491 <variablelist>
492 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
493 <?dbfo list-presentation="list"?>
494 <?dbhtml list-presentation="table"?>
495
496 <varlistentry id="dhclient">
497 <term><command>dhclient</command></term>
498 <listitem>
499 <para>
500 is the implementation of the DHCP client.
501 </para>
502 <indexterm zone="dhcp dhclient">
503 <primary sortas="b-dhclient">dhclient</primary>
504 </indexterm>
505 </listitem>
506 </varlistentry>
507
508 <varlistentry id="dhclient-script">
509 <term><command>dhclient-script</command></term>
510 <listitem>
511 <para>
512 is used by dhclient to (re)configure interfaces. It can make
513 extra changes by invoking custom dhclient-{entry,exit}-hooks.
514 </para>
515 <indexterm zone="dhcp dhclient-script">
516 <primary sortas="b-dhclient-script">dhclient-script</primary>
517 </indexterm>
518 </listitem>
519 </varlistentry>
520
521 <varlistentry id="dhcpd">
522 <term><command>dhcpd</command></term>
523 <listitem>
524 <para>
525 implements Dynamic Host Configuration Protocol (DHCP) and
526 Internet Bootstrap Protocol (BOOTP) requests for network
527 addresses.
528 </para>
529 <indexterm zone="dhcp dhcpd">
530 <primary sortas="b-dhcpd">dhcpd</primary>
531 </indexterm>
532 </listitem>
533 </varlistentry>
534
535 <varlistentry id="dhcrelay">
536 <term><command>dhcrelay</command></term>
537 <listitem>
538 <para>
539 provides a means to accept DHCP and BOOTP requests on a subnet
540 without a DHCP server and relay them to a DHCP server on another
541 subnet.
542 </para>
543 <indexterm zone="dhcp dhcrelay">
544 <primary sortas="b-dhcrelay">dhcrelay</primary>
545 </indexterm>
546 </listitem>
547 </varlistentry>
548
549 <varlistentry id="omshell">
550 <term><command>omshell</command></term>
551 <listitem>
552 <para>
553 provides an interactive way to connect to, query and
554 possibly change the ISC DHCP Server's state via OMAPI, the
555 Object Management API.
556 </para>
557 <indexterm zone="dhcp omshell">
558 <primary sortas="b-omshell">omshell</primary>
559 </indexterm>
560 </listitem>
561 </varlistentry>
562
563 </variablelist>
564
565 </sect2>
566
567</sect1>
Note: See TracBrowser for help on using the repository browser.