source: networking/connect/dhcpcd.xml@ 401174c0

12.0 12.1 12.2 gimp3 ken/TL2024 ken/tuningfonts lazarus lxqt plabs/newcss python3.11 rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/for-12.3 xry111/llvm18 xry111/spidermonkey128
Last change on this file since 401174c0 was 14891a90, checked in by Xi Ruoyao <xry111@…>, 15 months ago

treewide: More "User Notes" clean up

Remove links to pages w/o real contents.

  • Property mode set to 100644
File size: 15.4 KB
RevLine 
[246c904]1<?xml version="1.0" encoding="ISO-8859-1"?>
[6732c094]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
[246c904]4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
[14d6b3e0]6
[f0ef84e]7 <!ENTITY dhcpcd-download-http "https://github.com/NetworkConfiguration/dhcpcd/releases/download/v&dhcpcd-version;/dhcpcd-&dhcpcd-version;.tar.xz">
[4183f95]8 <!ENTITY dhcpcd-download-ftp " ">
[a200b30]9 <!ENTITY dhcpcd-md5sum "002d3c7bfa057248f23b2b2f33f02f5a">
10 <!ENTITY dhcpcd-size "260 KB">
[d301fdd]11 <!ENTITY dhcpcd-buildsize "3.6 MB (with tests)">
[e0a7d67c]12 <!ENTITY dhcpcd-time "less than 0.1 SBU (with tests)">
[246c904]13]>
14
[fd680fb]15<sect1 id="dhcpcd" xreflabel="dhcpcd-&dhcpcd-version;">
[820d164a]16 <?dbhtml filename="dhcpcd.html"?>
[4839c17]17
18
[add19ff9]19 <title>dhcpcd-&dhcpcd-version;</title>
[4839c17]20
[820d164a]21 <indexterm zone="dhcpcd">
[add19ff9]22 <primary sortas="a-dhcpcd">dhcpcd</primary>
[820d164a]23 </indexterm>
24
25 <sect2 role="package">
[add19ff9]26 <title>Introduction to dhcpcd</title>
[820d164a]27
[7c56ece]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>
[4839c17]35
[d0c42be]36 &lfs113_checked;
[77ac0f23]37
[820d164a]38 <bridgehead renderas="sect3">Package Information</bridgehead>
39 <itemizedlist spacing="compact">
40 <listitem>
[7c56ece]41 <para>
42 Download (HTTP): <ulink url="&dhcpcd-download-http;"/>
43 </para>
[820d164a]44 </listitem>
45 <listitem>
[7c56ece]46 <para>
47 Download (FTP): <ulink url="&dhcpcd-download-ftp;"/>
48 </para>
[820d164a]49 </listitem>
50 <listitem>
[7c56ece]51 <para>
52 Download MD5 sum: &dhcpcd-md5sum;
53 </para>
[820d164a]54 </listitem>
55 <listitem>
[7c56ece]56 <para>
57 Download size: &dhcpcd-size;
58 </para>
[820d164a]59 </listitem>
60 <listitem>
[7c56ece]61 <para>
62 Estimated disk space required: &dhcpcd-buildsize;
63 </para>
[820d164a]64 </listitem>
65 <listitem>
[7c56ece]66 <para>
67 Estimated build time: &dhcpcd-time;
68 </para>
[820d164a]69 </listitem>
70 </itemizedlist>
[4839c17]71
[4edf8452]72 <bridgehead renderas="sect3">dhcpcd Dependencies</bridgehead>
73
74 <bridgehead renderas="sect4">Optional</bridgehead>
75 <para role="optional">
[7c56ece]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>
[4edf8452]80 </para>
81
[820d164a]82 </sect2>
[4839c17]83
[2115e38]84 <sect2 id='dhcpcd-privsep'>
85 <title>Privilege separation</title>
[820d164a]86
[05c8448]87 <para>
[2115e38]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:
[05c8448]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 \
[cb37cb79]106 -s /bin/false \
[05c8448]107 -u 52 dhcpcd &amp;&amp;
108chown -v dhcpcd:dhcpcd /var/lib/dhcpcd </userinput></screen>
109
[2115e38]110 </sect2>
111
112 <sect2 role="installation">
113 <title>Installation of dhcpcd</title>
[39a4e4a8]114<!-- Now in the code
[d16c71a]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>
[39a4e4a8]119-->
[7c56ece]120 <para>
[2115e38]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 Build <application>dhcpcd</application> with privilege separation
135 by running the following commands:
[7c56ece]136 </para>
[820d164a]137
[40c00c5]138<screen role="nodump"><userinput>./configure --prefix=/usr \
[e1d2da5]139 --sysconfdir=/etc \
140 --libexecdir=/usr/lib/dhcpcd \
141 --dbdir=/var/lib/dhcpcd \
[f713df3]142 --runstatedir=/run \
[e1d2da5]143 --privsepuser=dhcpcd &amp;&amp;
[f0740ab]144make</userinput></screen>
[f9a784a]145
[7c56ece]146 <para>
147 To test the results, issue: <command>make test</command>.
148 </para>
[f9a784a]149
[7c56ece]150 <para>
151 Now, as the <systemitem class="username">root</systemitem> user:
152 </para>
[f9a784a]153
[bfa01156]154<screen role='root'><userinput>make install</userinput></screen>
[4839c17]155
[690658a5]156<!--
[7c56ece]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>
[232e46a]163
[bfa01156]164<screen role='root'><userinput>sed -i "s;/var/lib;/run;g" dhcpcd-hooks/50-dhcpcd-compat &amp;&amp;
[f9a784a]165install -v -m 644 dhcpcd-hooks/50-dhcpcd-compat /lib/dhcpcd/dhcpcd-hooks/</userinput></screen>
[690658a5]166-->
[4839c17]167
[820d164a]168 </sect2>
[4839c17]169
[690658a5]170 <sect2 role="commands">
171 <title>Command Explanations</title>
172
173 <para>
[e1d2da5]174 <parameter>--libexecdir=/usr/lib/dhcpcd</parameter>: Set a more proper
175 location for dhcpcd internal libraries.
[690658a5]176 </para>
177
178 <para>
[a3ec5c1]179 <parameter>--dbdir=/var/lib/dhcpcd</parameter>: The default
180 <filename class="directory">/var/db</filename> is not FHS-compliant
[690658a5]181 </para>
182
[f713df3]183 <para>
184 <parameter>--runstatedir=/run</parameter>: The default
185 <filename class="directory">/var/run</filename> is a symbolic
186 link to <filename class="directory">/run</filename>.
187 </para>
188
[690658a5]189 <para>
190 <option>--with-hook=...</option>: You can optionally install more hooks,
191 for example to install some configuration files such as
192 <filename>ntp.conf</filename>. The set of hooks is in the
193 <filename class="directory">dhcpcd-hooks</filename> directory in the
194 build tree.
195 </para>
[2115e38]196
197 <para>
[bb4b217d]198 <parameter>--disable-privsep</parameter>: Do not use privilege separation,
[2115e38]199 which is the default.
200 </para>
201
202 <para>
[bb4b217d]203 <parameter>--privsepuser=dhcpcd</parameter>: Use this unprivileged user
[2115e38]204 in a privilege separation setup.
205 </para>
206
207 <para>
208 <option>--with-hook=...</option>: You can optionally install more hooks,
209 for example to install some configuration files such as
210 <filename>ntp.conf</filename>. The set of hooks is in the
211 <filename class="directory">dhcpcd-hooks</filename> directory in the
212 build tree.
213 </para>
[690658a5]214 </sect2>
215
[820d164a]216 <sect2 role="configuration">
[add19ff9]217 <title>Configuring dhcpcd</title>
[820d164a]218
219 <sect3 id="dhcpcd-config">
220 <title>Config Files</title>
[4839c17]221
[7c56ece]222 <para>
223 <filename>/etc/dhcpcd.conf</filename>
224 </para>
[4839c17]225
[820d164a]226 <indexterm zone="dhcpcd dhcpcd-config">
[fefa337]227 <primary sortas="e-etc-dhcpcd-dhcpcd-conf">/etc/dhcpcd/dhcpcd.conf</primary>
[820d164a]228 </indexterm>
[4839c17]229
[820d164a]230 </sect3>
231
[3c7bd00]232 <sect3 id="dhcpcd-init" revision="sysv">
[e5f38d6b]233 <title>General Configuration Information</title>
[820d164a]234
[7c56ece]235 <para>
236 To configure <command>dhcpcd</command>, you need to first install
237 the network service script,
[e1d2da5]238 <filename>/usr/lib/services/dhcpcd</filename>
[7c56ece]239 included in the <xref linkend="bootscripts"/> package
240 (as user <systemitem class="username">root</systemitem>):
241 </para>
[4839c17]242
[820d164a]243 <indexterm zone="dhcpcd dhcpcd-init">
244 <primary sortas="f-dhcpcd">dhcpcd (service script)</primary>
245 </indexterm>
246
247<screen role='root'><userinput>make install-service-dhcpcd</userinput></screen>
248
[7c56ece]249 <note>
250 <para id="dhcpcd-config3">
251 The default for <command>dhcpcd</command> is to set the hostname
252 and mtu. It also overwrites <filename>/etc/resolv.conf </filename>
253 and <filename>/etc/ntp.conf</filename>. These
254 modifications to system files are done by hooks which are stored in
[e1d2da5]255 <filename class="directory">/usr/lib/dhcpcd/dhcpcd-hooks</filename>.
[b59e5eb3]256 Set up <command>dhcpcd</command> by removing or adding hooks from/to
[7c56ece]257 that directory. The execution of hooks can be disabled by using
258 the <option>--nohook</option> (<option>-C</option>) command line
259 option or by the <option>nohook</option> option in the
260 <filename>/etc/dhcpcd.conf</filename> file.
261 </para>
262 </note>
[232e46a]263
[7c56ece]264 <para id="dhcpcd-config2">
265 Finally, as the <systemitem class="username">root</systemitem> user
266 create the <filename>/etc/sysconfig/ifconfig.eth0</filename>
267 configuration file using the following commands. Adjust appropriately
268 for additional interfaces:
269 </para>
[4839c17]270
[820d164a]271 <indexterm zone="dhcpcd dhcpcd-config2">
[f0740ab]272 <primary sortas="e-etc-sysconfig-dhcpcd">/etc/sysconfig/ifconfig.eth0 (dhcpcd)</primary>
[820d164a]273 </indexterm>
274
[f0740ab]275<screen role='root'><userinput>cat &gt; /etc/sysconfig/ifconfig.eth0 &lt;&lt; "EOF"
[820d164a]276<literal>ONBOOT="yes"
[f0740ab]277IFACE="eth0"
[afa198d]278SERVICE="dhcpcd"
[9f44beb]279DHCP_START="-b -q -h ''<replaceable>&lt;insert appropriate start options here&gt;</replaceable>"
[f0740ab]280DHCP_STOP="-k <replaceable>&lt;insert additional stop options here&gt;</replaceable>"</literal>
[820d164a]281EOF</userinput></screen>
282
[7c56ece]283 <para>
284 For more information on the appropriate <envar>DHCP_START</envar> and
285 <envar>DHCP_STOP</envar> values, examine the man page for
286 <command>dhcpcd</command>.
287 </para>
[4839c17]288
[820d164a]289 <indexterm zone="dhcpcd dhcpcd-config3">
290 <primary sortas="e-etc-resolv.conf">/etc/resolv.conf</primary>
291 </indexterm>
292 </sect3>
[4839c17]293
[3c7bd00]294 <sect3 id="dhcpcd-init2" revision="sysv">
[e5f38d6b]295 <title>Configuration Information: fixed ip</title>
296
[7c56ece]297 <para id="dhcpcd-config4">
298 Although not usual, it is possible that you need
[e5f38d6b]299 to configure <application>dhcpcd</application> to use a fixed ip. Here,
300 we give an example. As the
301 <systemitem class="username">root</systemitem> user create the
302 <filename>/etc/sysconfig/ifconfig.eth0</filename> configuration file
303 using the following commands. Adjust appropriately for additional
[7c56ece]304 interfaces and for the actual ip and router you need:
305 </para>
[e5f38d6b]306
307 <indexterm zone="dhcpcd dhcpcd-config4">
308 <primary sortas="e-etc-sysconfig-dhcpcd">/etc/sysconfig/ifconfig.eth0 (dhcpcd)</primary>
309 </indexterm>
310
[7c56ece]311<screen role='nodump'><userinput>cat &gt; /etc/sysconfig/ifconfig.eth0 &lt;&lt; "EOF"
[e5f38d6b]312<literal>ONBOOT="yes"
313IFACE="eth0"
314SERVICE="dhcpcd"
315DHCP_START="-b -q -S ip_address=192.168.0.10/24 -S routers=192.168.0.1"
316DHCP_STOP="-k"</literal>
317EOF</userinput></screen>
318
[7c56ece]319 <para>
320 You can either use DNS servers in
[0840866]321 <filename>/etc/resolv.conf</filename> from another system, your
322 preferred servers, or just the example
[7c56ece]323 <filename>/etc/resolv.conf.head</filename> file below as is:
324 </para>
[e5f38d6b]325
[7c56ece]326<screen role='nodump'><userinput>cat &gt; /etc/resolv.conf.head &lt;&lt; "EOF"
[e5f38d6b]327<literal># OpenDNS servers
328nameserver 208.67.222.222
329nameserver 208.67.220.220</literal>
330EOF</userinput></screen>
331
332 </sect3>
333
[138bdf6]334 <sect3 id="dhcpcd-init3" revision="systemd">
335 <title>General Configuration Information</title>
336
337 <para>
338 If you want to configure network interfaces at boot using
339 <command>dhcpcd</command>, you need to install the
340 systemd unit included in <xref linkend="systemd-units"/>
341 package by running the following command as the
342 <systemitem class="username">root</systemitem> user:
343 </para>
344
345<screen role="root"><userinput>make install-dhcpcd</userinput></screen>
346
347 <indexterm zone="dhcpcd dhcpcd-init3">
348 <primary sortas="f-dhcpcd">dhcpcd</primary>
349 </indexterm>
350
351 <note>
[7c56ece]352 <para id="dhcpcd-config5">
353 The default behavior of <command>dhcpcd</command> is to set the
354 hostname and the mtu. It also overwrites <filename>/etc/resolv.conf
355 </filename> and <filename>/etc/ntp.conf</filename>. These
356 modifications to system configuration files are done by hooks which
357 are stored in <filename class="directory">
[b59e5eb3]358 /lib/dhcpcd/dhcpcd-hooks</filename>. Set up <command>dhcpcd</command>
[7c56ece]359 by removing or adding hooks from/to that directory. The execution
360 of hooks can be disabled by using the <option>--nohook</option>
361 (<option>-C</option>) command line option or by the
362 <option>nohook</option> option in the <filename>/etc/dhcpcd.conf
363 </filename> file.
364 </para>
[138bdf6]365 </note>
366
367 <indexterm zone="dhcpcd dhcpcd-config5">
368 <primary sortas="e-etc-resolv.conf">/etc/resolv.conf</primary>
369 </indexterm>
370
[7c56ece]371 <note>
372 <para>
373 Make sure that you disable the <command>systemd-networkd</command>
374 service or configure it not to manage the interfaces you want to
375 manage with <application>dhcpcd</application>.
376 </para>
377 </note>
[138bdf6]378
379 <para>
380 At this point you can test if <command>dhcpcd</command> is
381 behaving as expected by running the following command as the
382 <systemitem class="username">root</systemitem> user:
383 </para>
384
385<screen role="root"><userinput>systemctl start dhcpcd@<replaceable>eth0</replaceable></userinput></screen>
386
387 <para>
388 To start <command>dhcpcd</command> on a specific interface
389 at boot, enable the previously installed systemd unit by
390 running the following command as the
391 <systemitem class="username">root</systemitem> user:
392 </para>
393
394<screen role="root"><userinput>systemctl enable dhcpcd@<replaceable>eth0</replaceable></userinput></screen>
395
396 <para>
397 Replace <replaceable>eth0</replaceable> with the actual interface name.
398 </para>
399
400 </sect3>
401
[820d164a]402 </sect2>
[4839c17]403
[820d164a]404 <sect2 role="content">
405 <title>Contents</title>
406
407 <segmentedlist>
408 <segtitle>Installed Program</segtitle>
[d81eda8]409 <segtitle>Installed Library</segtitle>
[b1d305ed]410 <segtitle>Installed Directory</segtitle>
[4839c17]411
[820d164a]412 <seglistitem>
413 <seg>dhcpcd</seg>
[e1d2da5]414 <seg>/usr/lib/dhcpcd/dev/udev.so</seg>
415 <seg>/{usr,var}/lib/dhcpcd and /usr/share/dhcpcd</seg>
[820d164a]416 </seglistitem>
417 </segmentedlist>
[4839c17]418
[820d164a]419 <variablelist>
420 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
421 <?dbfo list-presentation="list"?>
422 <?dbhtml list-presentation="table"?>
[4839c17]423
[820d164a]424 <varlistentry id="dhcpcd-prog">
425 <term><command>dhcpcd</command></term>
426 <listitem>
[7c56ece]427 <para>
[4c24eb0a]428 is an implementation of the DHCP client specified in RFC2131
[7c56ece]429 </para>
[820d164a]430 <indexterm zone="dhcpcd dhcpcd-prog">
431 <primary sortas="b-dhcpcd">dhcpcd</primary>
432 </indexterm>
433 </listitem>
434 </varlistentry>
[4839c17]435
[81f1de4]436 <varlistentry id="dhcpcd-udev">
437 <term><filename class="libraryfile">udev.so</filename></term>
438 <listitem>
439 <para>
[c93c9bf4]440 adds udev support for interface arrival and departure; this is
[81f1de4]441 because udev likes to rename the interface, which it can't do if
[4c24eb0a]442 dhcpcd grabs it first
[81f1de4]443 </para>
444 <indexterm zone="dhcpcd dhcpcd-udev">
445 <primary sortas="c-dhcpcd-udev">udev.so</primary>
446 </indexterm>
447 </listitem>
448 </varlistentry>
449
[820d164a]450 </variablelist>
451
452 </sect2>
[f45b1953]453
454</sect1>
Note: See TracBrowser for help on using the repository browser.