source: networking/connect/dhcp.xml@ db19db1

11.2 11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/llvm18 xry111/soup3 xry111/xf86-video-removal
Last change on this file since db19db1 was db19db1, checked in by Pierre Labastie <pierre.labastie@…>, 2 years ago

dhcpd: the /var/lib/dhcp/dhcp.leases files is needed

Otherwise dhcpd does not start.
The "touch ..." instruction is the recommended way to create this
file according to dhcp.leases(5)

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