source: networking/connect/dhcpcd.xml@ b5639c6

12.1 ken/TL2024 lazarus plabs/newcss python3.11 rahul/power-profiles-daemon trunk xry111/llvm18
Last change on this file since b5639c6 was b5639c6, checked in by Douglas R. Reno <renodr@…>, 7 months ago

Fix an issue in dhcpcd-10.0.5 when using the '-b' switch.

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