source: networking/connect/dhcp.xml@ 45ab6c7

trunk
Last change on this file since 45ab6c7 was 45ab6c7, checked in by Xi Ruoyao <xry111@…>, 3 months ago

more SVN prop clean up

Remove "$LastChanged$" everywhere, and also some unused $Date$

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