source: networking/connect/dhcpcd.xml@ 7484ed9

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 7484ed9 was 7484ed9, checked in by Bruce Dubbs <bdubbs@…>, 20 months ago

Re-tag dhcpcd

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