source: networking/connect/dhcpcd.xml@ fa9cfd3

10.0 10.1 11.0 ken/refactor-virt lazarus qt5new trunk xry111/git-date xry111/git-date-for-trunk xry111/git-date-test
Last change on this file since fa9cfd3 was fa9cfd3, checked in by Douglas R. Reno <renodr@…>, 18 months ago

Update to dhcpcd-9.0.2

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

  • Property mode set to 100644
File size: 14.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 dhcpcd-download-http "https://roy.marples.name/downloads/dhcpcd/dhcpcd-&dhcpcd-version;.tar.xz">
8 <!ENTITY dhcpcd-download-ftp "ftp://roy.marples.name/pub/dhcpcd/dhcpcd-&dhcpcd-version;.tar.xz">
9 <!ENTITY dhcpcd-md5sum "f62118a576b01f5d0adf0c5ce617fbe7">
10 <!ENTITY dhcpcd-size "240 KB">
11 <!ENTITY dhcpcd-buildsize "3.4 MB (with tests)">
12 <!ENTITY dhcpcd-time "less than 0.1 SBU (with tests)">
13]>
14
15<sect1 id="dhcpcd" xreflabel="dhcpcd-&dhcpcd-version;">
16 <?dbhtml filename="dhcpcd.html"?>
17
18 <sect1info>
19 <othername>$LastChangedBy$</othername>
20 <date>$Date$</date>
21 </sect1info>
22
23 <title>dhcpcd-&dhcpcd-version;</title>
24
25 <indexterm zone="dhcpcd">
26 <primary sortas="a-dhcpcd">dhcpcd</primary>
27 </indexterm>
28
29 <sect2 role="package">
30 <title>Introduction to dhcpcd</title>
31
32 <para>
33 <application>dhcpcd</application> is an implementation of the
34 DHCP client specified in RFC2131. A DHCP client is useful for connecting
35 your computer to a network which uses DHCP to assign network
36 addresses. dhcpcd strives to be a fully featured, yet very lightweight
37 DHCP client.
38 </para>
39
40 &lfs91_checked;
41
42 <bridgehead renderas="sect3">Package Information</bridgehead>
43 <itemizedlist spacing="compact">
44 <listitem>
45 <para>
46 Download (HTTP): <ulink url="&dhcpcd-download-http;"/>
47 </para>
48 </listitem>
49 <listitem>
50 <para>
51 Download (FTP): <ulink url="&dhcpcd-download-ftp;"/>
52 </para>
53 </listitem>
54 <listitem>
55 <para>
56 Download MD5 sum: &dhcpcd-md5sum;
57 </para>
58 </listitem>
59 <listitem>
60 <para>
61 Download size: &dhcpcd-size;
62 </para>
63 </listitem>
64 <listitem>
65 <para>
66 Estimated disk space required: &dhcpcd-buildsize;
67 </para>
68 </listitem>
69 <listitem>
70 <para>
71 Estimated build time: &dhcpcd-time;
72 </para>
73 </listitem>
74 </itemizedlist>
75
76 <bridgehead renderas="sect3">dhcpcd Dependencies</bridgehead>
77
78 <bridgehead renderas="sect4">Optional</bridgehead>
79 <para role="optional">
80 <xref linkend="llvm"/> (with Clang),
81 <xref linkend="ntp"/>,
82 <ulink url="https://chrony.tuxfamily.org/">chronyd</ulink>, and
83 <ulink url="https://github.com/thkukuk/ypbind-mt/">ypbind</ulink>
84 </para>
85
86 <para condition="html" role="usernotes">User Notes:
87 <ulink url="&blfs-wiki;/dhcpcd"/></para>
88
89 </sect2>
90
91 <sect2 role="installation">
92 <title>Installation of dhcpcd</title>
93
94 <para>
95 Recent releases of <application>dhcpcd</application> implement privilege
96 separation. Additional installation steps are necessary to set up
97 the proper environment, which are performed by issuing the following
98 commands as the <systemitem class="username">root</systemitem> user:
99 </para>
100
101<screen role="root"><userinput>install -v -m700 -d /var/lib/dhcpcd &amp;&amp;
102
103groupadd -g 52 dhcpcd &amp;&amp;
104useradd -c 'dhcpcd PrivSep' \
105 -d /var/lib/dhcpcd \
106 -g dhcpcd \
107 -s /bin/false \
108 -u 52 dhcpcd &amp;&amp;
109chown -v dhcpcd:dhcpcd /var/lib/dhcpcd </userinput></screen>
110
111 <para>
112 Install <application>dhcpcd</application> by running the following
113 commands:
114 </para>
115
116<screen><userinput>./configure --libexecdir=/lib/dhcpcd \
117 --dbdir=/var/lib/dhcpcd --privsepuser=dhcpcd &amp;&amp;
118make</userinput></screen>
119
120 <para>
121 To test the results, issue: <command>make test</command>.
122 </para>
123
124 <para>
125 Now, as the <systemitem class="username">root</systemitem> user:
126 </para>
127
128<screen role='root'><userinput>make install</userinput></screen>
129
130<!--
131 <para>
132 By default, a plain text lease info file isn't created but the
133 <application>dhcpcd</application> provides a hook which can be used for
134 creating such a file. Install the hook by running the following commands
135 as the <systemitem class="username">root</systemitem> user:
136 </para>
137
138<screen role='root'><userinput>sed -i "s;/var/lib;/run;g" dhcpcd-hooks/50-dhcpcd-compat &amp;&amp;
139install -v -m 644 dhcpcd-hooks/50-dhcpcd-compat /lib/dhcpcd/dhcpcd-hooks/</userinput></screen>
140-->
141
142 </sect2>
143
144 <sect2 role="commands">
145 <title>Command Explanations</title>
146
147 <para>
148 <parameter>--libexecdir=/lib/dhcpcd</parameter>: The default
149 <filename class="directory">/libexec</filename> is not FHS-compliant.
150 Since this directory may need to be available early in the boot,
151 <filename class="directory">/usr/libexec</filename> cannot be used either.
152 </para>
153
154 <para>
155 <parameter>--dbdir=/var/lib/dhcpcd</parameter>: The default
156 <filename class="directory">/var/db</filename> is not FHS-compliant
157 </para>
158
159 <para>
160 <option>--with-hook=...</option>: You can optionally install more hooks,
161 for example to install some configuration files such as
162 <filename>ntp.conf</filename>. The set of hooks is in the
163 <filename class="directory">dhcpcd-hooks</filename> directory in the
164 build tree.
165 </para>
166 </sect2>
167
168 <sect2 role="configuration">
169 <title>Configuring dhcpcd</title>
170
171 <sect3 id="dhcpcd-config">
172 <title>Config Files</title>
173
174 <para>
175 <filename>/etc/dhcpcd.conf</filename>
176 </para>
177
178 <indexterm zone="dhcpcd dhcpcd-config">
179 <primary sortas="e-etc-dhcpcd-dhcpcd-conf">/etc/dhcpcd/dhcpcd.conf</primary>
180 </indexterm>
181
182 </sect3>
183
184 <sect3 id="dhcpcd-init" revision="sysv">
185 <title>General Configuration Information</title>
186
187 <para>
188 To configure <command>dhcpcd</command>, you need to first install
189 the network service script,
190 <filename>/lib/services/dhcpcd</filename>
191 included in the <xref linkend="bootscripts"/> package
192 (as user <systemitem class="username">root</systemitem>):
193 </para>
194
195 <indexterm zone="dhcpcd dhcpcd-init">
196 <primary sortas="f-dhcpcd">dhcpcd (service script)</primary>
197 </indexterm>
198
199<screen role='root'><userinput>make install-service-dhcpcd</userinput></screen>
200
201 <note>
202 <para id="dhcpcd-config6">
203 the network service script <filename>/lib/services/dhcpcd</filename>
204 contained in bootscripts up to blfs-bootscripts-20191204 is
205 not compatible with latest dhcpcd, as the location of the pidfile
206 changed.
207 To work around this, issue the following command:
208
209<screen role='root'><userinput>sed -i "s;/run/dhcpcd-;/run/dhcpcd/;g" /lib/services/dhcpcd</userinput></screen>
210 </para>
211 </note>
212
213 <note>
214 <para id="dhcpcd-config3">
215 The default for <command>dhcpcd</command> is to set the hostname
216 and mtu. It also overwrites <filename>/etc/resolv.conf </filename>
217 and <filename>/etc/ntp.conf</filename>. These
218 modifications to system files are done by hooks which are stored in
219 <filename class="directory">/lib/dhcpcd/dhcpcd-hooks</filename>.
220 Setup <command>dhcpcd</command> by removing or adding hooks from/to
221 that directory. The execution of hooks can be disabled by using
222 the <option>--nohook</option> (<option>-C</option>) command line
223 option or by the <option>nohook</option> option in the
224 <filename>/etc/dhcpcd.conf</filename> file.
225 </para>
226 </note>
227
228 <para id="dhcpcd-config2">
229 Finally, as the <systemitem class="username">root</systemitem> user
230 create the <filename>/etc/sysconfig/ifconfig.eth0</filename>
231 configuration file using the following commands. Adjust appropriately
232 for additional interfaces:
233 </para>
234
235 <indexterm zone="dhcpcd dhcpcd-config2">
236 <primary sortas="e-etc-sysconfig-dhcpcd">/etc/sysconfig/ifconfig.eth0 (dhcpcd)</primary>
237 </indexterm>
238
239<screen role='root'><userinput>cat &gt; /etc/sysconfig/ifconfig.eth0 &lt;&lt; "EOF"
240<literal>ONBOOT="yes"
241IFACE="eth0"
242SERVICE="dhcpcd"
243DHCP_START="-b -q <replaceable>&lt;insert appropriate start options here&gt;</replaceable>"
244DHCP_STOP="-k <replaceable>&lt;insert additional stop options here&gt;</replaceable>"</literal>
245EOF</userinput></screen>
246
247 <para>
248 For more information on the appropriate <envar>DHCP_START</envar> and
249 <envar>DHCP_STOP</envar> values, examine the man page for
250 <command>dhcpcd</command>.
251 </para>
252
253 <indexterm zone="dhcpcd dhcpcd-config3">
254 <primary sortas="e-etc-resolv.conf">/etc/resolv.conf</primary>
255 </indexterm>
256 </sect3>
257
258 <sect3 id="dhcpcd-init2" revision="sysv">
259 <title>Configuration Information: fixed ip</title>
260
261 <para id="dhcpcd-config4">
262 Although not usual, it is possible that you need
263 to configure <application>dhcpcd</application> to use a fixed ip. Here,
264 we give an example. As the
265 <systemitem class="username">root</systemitem> user create the
266 <filename>/etc/sysconfig/ifconfig.eth0</filename> configuration file
267 using the following commands. Adjust appropriately for additional
268 interfaces and for the actual ip and router you need:
269 </para>
270
271 <indexterm zone="dhcpcd dhcpcd-config4">
272 <primary sortas="e-etc-sysconfig-dhcpcd">/etc/sysconfig/ifconfig.eth0 (dhcpcd)</primary>
273 </indexterm>
274
275<screen role='nodump'><userinput>cat &gt; /etc/sysconfig/ifconfig.eth0 &lt;&lt; "EOF"
276<literal>ONBOOT="yes"
277IFACE="eth0"
278SERVICE="dhcpcd"
279DHCP_START="-b -q -S ip_address=192.168.0.10/24 -S routers=192.168.0.1"
280DHCP_STOP="-k"</literal>
281EOF</userinput></screen>
282
283 <para>
284 You can either use DNS servers in
285 <filename>/etc/resolv.conf</filename> from another system, your
286 preferred servers, or just the example
287 <filename>/etc/resolv.conf.head</filename> file below as is:
288 </para>
289
290<screen role='nodump'><userinput>cat &gt; /etc/resolv.conf.head &lt;&lt; "EOF"
291<literal># OpenDNS servers
292nameserver 208.67.222.222
293nameserver 208.67.220.220</literal>
294EOF</userinput></screen>
295
296 </sect3>
297
298 <sect3 id="dhcpcd-init3" revision="systemd">
299 <title>General Configuration Information</title>
300
301 <para>
302 If you want to configure network interfaces at boot using
303 <command>dhcpcd</command>, you need to install the
304 systemd unit included in <xref linkend="systemd-units"/>
305 package by running the following command as the
306 <systemitem class="username">root</systemitem> user:
307 </para>
308
309<screen role="root"><userinput>make install-dhcpcd</userinput></screen>
310
311 <indexterm zone="dhcpcd dhcpcd-init3">
312 <primary sortas="f-dhcpcd">dhcpcd</primary>
313 </indexterm>
314
315 <note>
316 <para id="dhcpcd-config5">
317 The default behavior of <command>dhcpcd</command> is to set the
318 hostname and the mtu. It also overwrites <filename>/etc/resolv.conf
319 </filename> and <filename>/etc/ntp.conf</filename>. These
320 modifications to system configuration files are done by hooks which
321 are stored in <filename class="directory">
322 /lib/dhcpcd/dhcpcd-hooks</filename>. Setup <command>dhcpcd</command>
323 by removing or adding hooks from/to that directory. The execution
324 of hooks can be disabled by using the <option>--nohook</option>
325 (<option>-C</option>) command line option or by the
326 <option>nohook</option> option in the <filename>/etc/dhcpcd.conf
327 </filename> file.
328 </para>
329 </note>
330
331 <indexterm zone="dhcpcd dhcpcd-config5">
332 <primary sortas="e-etc-resolv.conf">/etc/resolv.conf</primary>
333 </indexterm>
334
335 <note>
336 <para>
337 Make sure that you disable the <command>systemd-networkd</command>
338 service or configure it not to manage the interfaces you want to
339 manage with <application>dhcpcd</application>.
340 </para>
341 </note>
342
343 <para>
344 At this point you can test if <command>dhcpcd</command> is
345 behaving as expected by running the following command as the
346 <systemitem class="username">root</systemitem> user:
347 </para>
348
349<screen role="root"><userinput>systemctl start dhcpcd@<replaceable>eth0</replaceable></userinput></screen>
350
351 <para>
352 To start <command>dhcpcd</command> on a specific interface
353 at boot, enable the previously installed systemd unit by
354 running the following command as the
355 <systemitem class="username">root</systemitem> user:
356 </para>
357
358<screen role="root"><userinput>systemctl enable dhcpcd@<replaceable>eth0</replaceable></userinput></screen>
359
360 <para>
361 Replace <replaceable>eth0</replaceable> with the actual interface name.
362 </para>
363
364 </sect3>
365
366 </sect2>
367
368 <sect2 role="content">
369 <title>Contents</title>
370
371 <segmentedlist>
372 <segtitle>Installed Program</segtitle>
373 <segtitle>Installed Library</segtitle>
374 <segtitle>Installed Directory</segtitle>
375
376 <seglistitem>
377 <seg>dhcpcd</seg>
378 <seg>/lib/dhcpcd/dev/udev.so</seg>
379 <seg>/{,var/}lib/dhcpcd and /usr/share/dhcpcd</seg>
380 </seglistitem>
381 </segmentedlist>
382
383 <variablelist>
384 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
385 <?dbfo list-presentation="list"?>
386 <?dbhtml list-presentation="table"?>
387
388 <varlistentry id="dhcpcd-prog">
389 <term><command>dhcpcd</command></term>
390 <listitem>
391 <para>
392 is an implementation of the DHCP client specified in RFC2131.
393 </para>
394 <indexterm zone="dhcpcd dhcpcd-prog">
395 <primary sortas="b-dhcpcd">dhcpcd</primary>
396 </indexterm>
397 </listitem>
398 </varlistentry>
399
400 <varlistentry id="dhcpcd-udev">
401 <term><filename class="libraryfile">udev.so</filename></term>
402 <listitem>
403 <para>
404 adds udev support for interface arrival and departure; this is
405 because udev likes to rename the interface, which it can't do if
406 dhcpcd grabs it first.
407 </para>
408 <indexterm zone="dhcpcd dhcpcd-udev">
409 <primary sortas="c-dhcpcd-udev">udev.so</primary>
410 </indexterm>
411 </listitem>
412 </varlistentry>
413
414 </variablelist>
415
416 </sect2>
417
418</sect1>
Note: See TracBrowser for help on using the repository browser.