source: networking/connect/dhcpcd.xml@ f6b3dbf

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

Tags

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