blob: bfeb614bc4e09a1b9cf63d4745a9e98f61f940e6 [file] [log] [blame]
Dmitry Shmidta3a22602012-07-23 16:45:46 -07001.\" Copyright (c) 2006-2012 Roy Marples
The Android Open Source Projectf7c54212009-03-03 19:29:22 -08002.\" All rights reserved
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
Dmitry Shmidta3a22602012-07-23 16:45:46 -070025.Dd June 7, 2012
26.Dt DHCPCD 8
Dmitry Shmidte86eee12011-01-24 16:27:51 -080027.Os
The Android Open Source Projectf7c54212009-03-03 19:29:22 -080028.Sh NAME
29.Nm dhcpcd
30.Nd an RFC 2131 compliant DHCP client
31.Sh SYNOPSIS
32.Nm
Dmitry Shmidta3a22602012-07-23 16:45:46 -070033.Op Fl ABbDdEGgHJKkLnpqTVw
34.Op Fl C , Fl Fl nohook Ar hook
35.Op Fl c , Fl Fl script Ar script
36.Op Fl e , Fl Fl env Ar value
37.Op Fl F , Fl Fl fqdn Ar FQDN
38.Op Fl f , Fl Fl config Ar file
39.Op Fl h , Fl Fl hostname Ar hostname
40.Op Fl I , Fl Fl clientid Ar clientid
41.Op Fl i , Fl Fl vendorclassid Ar vendorclassid
42.Op Fl l , Fl Fl leasetime Ar seconds
43.Op Fl m , Fl Fl metric Ar metric
44.Op Fl O , Fl Fl nooption Ar option
45.Op Fl o , Fl Fl option Ar option
46.Op Fl Q , Fl Fl require Ar option
47.Op Fl r , Fl Fl request Ar address
48.Op Fl S , Fl Fl static Ar value
49.Op Fl s , Fl Fl inform Ar address Ns Op Ar /cidr
50.Op Fl t , Fl Fl timeout Ar seconds
51.Op Fl u , Fl Fl userclass Ar class
52.Op Fl v , Fl Fl vendor Ar code , Ar value
53.Op Fl W , Fl Fl whitelist Ar address Ns Op Ar /cidr
54.Op Fl y , Fl Fl reboot Ar seconds
55.Op Fl X , Fl Fl blacklist Ar address Ns Op Ar /cidr
56.Op Fl Z , Fl Fl denyinterfaces Ar pattern
57.Op Fl z , Fl Fl allowinterfaces Ar pattern
Dmitry Shmidte86eee12011-01-24 16:27:51 -080058.Op interface
59.Op ...
The Android Open Source Projectf7c54212009-03-03 19:29:22 -080060.Nm
Dmitry Shmidta3a22602012-07-23 16:45:46 -070061.Fl k , Fl Fl release
Dmitry Shmidte86eee12011-01-24 16:27:51 -080062.Op interface
63.Nm
Dmitry Shmidta3a22602012-07-23 16:45:46 -070064.Fl U, Fl Fl dumplease
The Android Open Source Projectf7c54212009-03-03 19:29:22 -080065.Ar interface
66.Nm
Dmitry Shmidta3a22602012-07-23 16:45:46 -070067.Fl Fl version
Dmitry Shmidte86eee12011-01-24 16:27:51 -080068.Nm
Dmitry Shmidta3a22602012-07-23 16:45:46 -070069.Fl x , Fl Fl exit
70.Op interface
The Android Open Source Projectf7c54212009-03-03 19:29:22 -080071.Sh DESCRIPTION
72.Nm
73is an implementation of the DHCP client specified in
74.Li RFC 2131 .
75.Nm
76gets the host information
Dmitry Shmidte86eee12011-01-24 16:27:51 -080077.Po
The Android Open Source Projectf7c54212009-03-03 19:29:22 -080078IP address, routes, etc
79.Pc
80from a DHCP server and configures the network
81.Ar interface
82of the
Dmitry Shmidte86eee12011-01-24 16:27:51 -080083machine on which it is running.
The Android Open Source Projectf7c54212009-03-03 19:29:22 -080084.Nm
85then runs the configuration script which writes DNS information to
86.Xr resolvconf 8 ,
87if available, otherwise directly to
88.Pa /etc/resolv.conf .
Dmitry Shmidte86eee12011-01-24 16:27:51 -080089If the hostname is currently blank, (null) or localhost, or
90.Va force_hostname
91is YES or TRUE or 1 then
The Android Open Source Projectf7c54212009-03-03 19:29:22 -080092.Nm
93sets the hostname to the one supplied by the DHCP server.
94.Nm
95then daemonises and waits for the lease renewal time to lapse.
Dmitry Shmidte86eee12011-01-24 16:27:51 -080096It will then attempt to renew its lease and reconfigure if the new lease
97changes.
98.Pp
99.Nm
100is also an implementation of the BOOTP client specified in
101.Li RFC 951 .
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700102.Pp
103.Nm
104is also an implementation of an IPv6 Router Solicitor as specified in
105.Li RFC 4861
106and
107.Li RFC 6106 .
108.Nm
109can optionally handle address and route management itself,
110and will do so by default if Router Solicitation is disabled in the kernel.
111If
112.Nm
113is managing routes,
114.Nm
115sends Neighbor Solicitions to each advertising router periodically and will
116expire the ones that do not respond.
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800117.Ss Local Link configuration
118If
119.Nm
120failed to obtain a lease, it probes for a valid IPv4LL address
121.Po
122aka ZeroConf, aka APIPA
123.Pc .
124Once obtained it restarts the process of looking for a DHCP server to get a
125proper address.
126.Pp
127When using IPv4LL,
128.Nm
129nearly always succeeds and returns an exit code of 0.
130In the rare case it fails, it normally means that there is a reverse ARP proxy
131installed which always defeats IPv4LL probing.
132To disable this behaviour, you can use the
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700133.Fl L , Fl Fl noipv4ll
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800134option.
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800135.Ss Multiple interfaces
136If a list of interfaces are given on the command line, then
137.Nm
138only works with those interfaces, otherwise
139.Nm
140discovers available Ethernet interfaces.
141If any interface reports a working carrier then
142.Nm
143will try and obtain a lease before forking to the background,
144otherwise it will fork right away.
145This behaviour can be modified with the
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700146.Fl b , Fl Fl background
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800147and
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700148.Fl w , Fl Fl waitip
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800149options.
150.Pp
151If a single interface is given then
152.Nm
153only works for that interface and runs as a separate instance.
154The
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700155.Fl w , Fl Fl waitip
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800156option is enabled in this instance to maintain compatibility with older
157versions.
158.Pp
159Interfaces are preferred by carrier, DHCP lease/IPv4LL and then lowest metric.
160For systems that support route metrics, each route will be tagged with the
161metric, otherwise
162.Nm
163changes the routes to use the interface with the same route and the lowest
164metric.
165See options below for controlling which interfaces we allow and deny through
166the use of patterns.
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800167.Ss Hooking into DHCP events
168.Nm
169runs
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800170.Pa /libexec/dhcpcd-run-hooks ,
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800171or the script specified by the
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700172.Fl c , Fl Fl script
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800173option.
174This script runs each script found in
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800175.Pa /libexec/dhcpcd-hooks
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800176in a lexical order.
177The default installation supplies the scripts
178.Pa 01-test ,
179.Pa 10-mtu ,
180.Pa 20-resolv.conf
181and
182.Pa 30-hostname .
183You can disable each script by using the
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700184.Fl C , Fl Fl nohook
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800185option.
186See
187.Xr dhcpcd-run-hooks 8
188for details on how these scripts work.
189.Nm
190currently ignores the exit code of the script.
191.Ss Fine tuning
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800192You can fine-tune the behaviour of
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800193.Nm
194with the following options:
195.Bl -tag -width indent
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700196.It Fl b , Fl Fl background
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800197Background immediately.
198This is useful for startup scripts which don't disable link messages for
199carrier status.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700200.It Fl c , Fl Fl script Ar script
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800201Use this
202.Ar script
203instead of the default
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800204.Pa /libexec/dhcpcd-run-hooks .
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700205.It Fl D , Fl Fl duid
206Generate an
207.Li RFC 4361
208compliant clientid.
209This requires persistent storage and not all DHCP servers work with it so it
210is not enabled by default.
211.Nm
212generates the DUID and stores it in
213.Pa /etc/dhcpcd.duid .
214This file should not be copied to other hosts.
215.It Fl d , Fl Fl debug
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800216Echo debug messages to the stderr and syslog.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700217.It Fl E , Fl Fl lastlease
218If
219.Nm
220cannot obtain a lease, then try to use the last lease acquired for the
221interface.
222If the
223.Fl p, Fl Fl persistent
224option is not given then the lease is used if it hasn't expired.
225.It Fl e , Fl Fl env Ar value
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800226Push
227.Ar value
228to the environment for use in
229.Xr dhcpcd-run-hooks 8 .
230For example, you can force the hostname hook to always set the hostname with
231.Fl e
232.Va force_hostname=YES .
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700233.It Fl g , Fl Fl reconfigure
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800234.Nm
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800235will re-apply IP address, routing and run
236.Xr dhcpcd-run-hooks 8
237for each interface.
238This is useful so that a 3rd party such as PPP or VPN can change the routing
239table and / or DNS, etc and then instruct
240.Nm
241to put things back afterwards.
242.Nm
243does not read a new configuration when this happens - you should rebind if you
244need that functionality.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700245.It Fl F , Fl Fl fqdn Ar fqdn
246Requests that the DHCP server updates DNS using FQDN instead of just a
247hostname.
248Valid values for
249.Ar fqdn
250are disable, none, ptr and both.
251.Nm
252itself never does any DNS updates.
253.Nm
254encodes the FQDN hostname as specified in
255.Li RFC1035 .
256.It Fl f , Fl Fl config Ar file
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800257Specify a config to load instead of
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800258.Pa /etc/dhcpcd.conf .
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800259.Nm
260always processes the config file before any command line options.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700261.It Fl h , Fl Fl hostname Ar hostname
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800262Sends
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800263.Ar hostname
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800264to the DHCP server so it can be registered in DNS.
265If
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800266.Ar hostname
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800267is an empty string then the current system hostname is sent.
268If
269.Ar hostname
270is a FQDN (ie, contains a .) then it will be encoded as such.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700271.It Fl I , Fl Fl clientid Ar clientid
272Send the
273.Ar clientid .
274If the string is of the format 01:02:03 then it is encoded as hex.
275For interfaces whose hardware address is longer than 8 bytes, or if the
276.Ar clientid
277is an empty string then
278.Nm
279sends a default
280.Ar clientid
281of the hardware family and the hardware address.
282.It Fl i , Fl Fl vendorclassid Ar vendorclassid
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800283Override the
284.Ar vendorclassid
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700285field sent.
286The default is
287dhcpcd-<version>:<os>:<machine>:<platform>.
288For example
289.D1 dhcpcd-5.5.6:NetBSD-6.99.5:i386:i386
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800290If not set then none is sent.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700291Some badly configured DHCP servers reject unknown vendorclassids.
292To work around it, try and impersonate Windows by using the MSFT vendorclassid.
293.It Fl k , Fl Fl release
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800294This causes an existing
295.Nm
296process running on the
297.Ar interface
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800298to release its lease, de-configure the
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800299.Ar interface
300and then exit.
301.Nm
302then waits until this process has exited.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700303.It Fl l , Fl Fl leasetime Ar seconds
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800304Request a specific lease time in
305.Ar seconds .
306By default
307.Nm
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800308does not request any lease time and leaves it in the hands of the
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800309DHCP server.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700310.It Fl m , Fl Fl metric Ar metric
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800311Metrics are used to prefer an interface over another one, lowest wins.
312.Nm
313will supply a default metic of 200 +
314.Xr if_nametoindex 3 .
315An extra 100 will be added for wireless interfaces.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700316.It Fl n , Fl Fl rebind
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800317Notifies
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800318.Nm
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800319to reload its configuration and rebind its interfaces.
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800320If
321.Nm
322is not running, then it starts up as normal.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700323.It Fl o , Fl Fl option Ar option
324Request the DHCP
325.Ar option
326variable for use in
327.Pa /libexec/dhcpcd-run-hooks .
328.It Fl p , Fl Fl persistent
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800329.Nm
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800330normally de-configures the
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800331.Ar interface
332and configuration when it exits.
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800333Sometimes, this isn't desirable if, for example, you have root mounted over
334NFS.
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800335You can use this option to stop this from happening.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700336.It Fl r , Fl Fl request Op Ar address
337Request the
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800338.Ar address
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700339in the DHCP DISCOVER message.
340There is no guarantee this is the address the DHCP server will actually give.
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800341If no
342.Ar address
343is given then the first address currently assigned to the
344.Ar interface
345is used.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700346.It Fl s , Fl Fl inform Op Ar address Ns Op Ar /cidr
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800347Behaves like
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700348.Fl r , Fl Fl request
349as above, but sends a DHCP INFORM instead of DISCOVER/REQUEST.
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800350This does not get a lease as such, just notifies the DHCP server of the
351.Ar address
352in use.
353You should also include the optional
354.Ar cidr
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800355network number in case the address is not already configured on the interface.
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800356.Nm
357remains running and pretends it has an infinite lease.
358.Nm
359will not de-configure the interface when it exits.
360If
361.Nm
362fails to contact a DHCP server then it returns a failure instead of falling
363back on IPv4LL.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700364.It Fl t , Fl Fl timeout Ar seconds
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800365Timeout after
366.Ar seconds ,
367instead of the default 30.
368A setting of 0
369.Ar seconds
370causes
371.Nm
372to wait forever to get a lease.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700373.It Fl u , Fl Fl userclass Ar class
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800374Tags the DHCP message with the userclass
375.Ar class .
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800376DHCP servers use this to give members of the class DHCP options other than the
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800377default, without having to know things like hardware address or hostname.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700378.It Fl v , Fl Fl vendor Ar code , Ns Ar value
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800379Add an encapsulated vendor option.
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800380.Ar code
381should be between 1 and 254 inclusive.
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800382To add a raw vendor string, omit
383.Ar code
384but keep the comma.
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800385Examples.
386.Pp
387Set the vendor option 01 with an IP address.
388.D1 dhcpcd \-v 01,192.168.0.2 eth0
389Set the vendor option 02 with a hex code.
390.D1 dhcpcd \-v 02,01:02:03:04:05 eth0
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800391Set the vendor option 03 with an IP address as a string.
392.D1 dhcpcd \-v 03,\e"192.168.0.2\e" eth0
393Set un-encapsulated vendor option to hello world.
394.D1 dhcpcd \-v ,"hello world" eth0
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700395.It Fl Fl version
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800396Display both program version and copyright information.
397.Nm
398then exits before doing any configuration.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700399.It Fl w , Fl Fl waitip
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800400Wait for an address to be assigned before forking to the background.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700401.It Fl x , Fl Fl exit
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800402This will signal an existing
403.Nm
404process running on the
405.Ar interface
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800406to de-configure the
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800407.Ar interface
408and exit.
409.Nm
410then waits until this process has exited.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700411.It Fl y , Fl Fl reboot Ar seconds
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800412Allow
413.Ar reboot
414seconds before moving to the discover phase if we have an old lease to use.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700415The default is 5 seconds.
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800416A setting of 0 seconds causes
417.Nm
418to skip the reboot phase and go straight into discover.
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800419.El
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800420.Ss Restricting behaviour
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800421.Nm
422will try to do as much as it can by default.
423However, there are sometimes situations where you don't want the things to be
424configured exactly how the the DHCP server wants.
425Here are some options that deal with turning these bits off.
426.Bl -tag -width indent
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700427.It Fl A , Fl Fl noarp
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800428Don't request or claim the address by ARP.
429This also disables IPv4LL.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700430.It Fl B , Fl Fl nobackground
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800431Don't run in the background when we acquire a lease.
432This is mainly useful for running under the control of another process, such
433as a debugger or a network manager.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700434.It Fl C , Fl Fl nohook Ar script
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800435Don't run this hook script.
436Matches full name, or prefixed with 2 numbers optionally ending with
437.Pa .sh .
438.Pp
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800439So to stop
440.Nm
441from touching your DNS or MTU settings you would do:-
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800442.D1 dhcpcd -C resolv.conf -C mtu eth0
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700443.It Fl G , Fl Fl nogateway
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800444Don't set any default routes.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700445.It Fl H , Fl Fl xidhwaddr
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800446Use the last four bytes of the hardware address as the DHCP xid instead
447of a randomly generated number.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700448.It Fl J , Fl Fl broadcast
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800449Instructs the DHCP server to broadcast replies back to the client.
450Normally this is only set for non Ethernet interfaces,
451such as FireWire and InfiniBand.
452In most instances,
453.Nm
454will set this automatically.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700455.It Fl K , Fl Fl nolink
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800456Don't receive link messages for carrier status.
457You should only have to use this with buggy device drivers or running
458.Nm
459through a network manager.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700460.It Fl L , Fl Fl noipv4ll
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800461Don't use IPv4LL (aka APIPA, aka Bonjour, aka ZeroConf).
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700462.It Fl O , Fl Fl nooption Ar option
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800463Don't request the specified option.
464If no option given, then don't request any options other than those to
465configure the interface and routing.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700466.It Fl Q , Fl Fl require Ar option
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800467Requires the
468.Ar option
469to be present in all DHCP messages, otherwise the message is ignored.
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800470To enforce that
471.Nm
472only responds to DHCP servers and not BOOTP servers, you can
473.Fl Q
474.Ar dhcp_message_type .
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700475.It Fl q , Fl Fl quiet
476Quiet
477.Nm
478on the command line, only warnings and errors will be displayed.
479The messages are still logged though.
480.It Fl S, Fl Fl static Ar value
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800481Configures a static
482.Ar value .
483If you set
484.Ic ip_address
485then
486.Nm
487will not attempt to obtain a lease and just use the value for the address with
488an infinite lease time.
489.Pp
490Here is an example which configures a static address, routes and dns.
491.D1 dhcpcd -S ip_address=192.168.0.10/24 \e
492.D1 -S routers=192.168.0.1 \e
493.D1 -S domain_name_servers=192.168.0.1 \e
494.D1 eth0
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700495.It Fl T, Fl Fl test
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800496On receipt of DHCP messages just call
497.Pa /libexec/dhcpcd-run-hooks
498with the reason of TEST which echos the DHCP variables found in the message
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800499to the console.
500The interface configuration isn't touched and neither are any configuration
501files.
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800502To test INFORM the interface needs to be configured with the desired address
503before starting
504.Nm .
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700505.It Fl U, Fl Fl dumplease Ar interface
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800506Dumps the last lease for the
507.Ar interface
508to stdout.
509.Ar interface
510could also be a path to a DHCP wire formatted file.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700511.It Fl V, Fl Fl variables
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800512Display a list of option codes and the associated variable for use in
513.Xr dhcpcd-run-hooks 8 .
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800514Variables are prefixed with new_ and old_ unless the option number is -.
515Variables without an option are part of the DHCP message and cannot be
516directly requested.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700517.It Fl W, Fl Fl whitelist Ar address Ns Op /cidr
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800518Only accept packets from
519.Ar address Ns Op /cidr .
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700520.Fl X, Fl Fl blacklist
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800521is ignored if
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700522.Fl W, Fl Fl whitelist
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800523is set.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700524.It Fl X, Fl Fl blacklist Ar address Ns Op Ar /cidr
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800525Ignore all packets from
526.Ar address Ns Op Ar /cidr .
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700527.It Fl Z , Fl Fl denyinterfaces Ar pattern
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800528When discovering interfaces, the interface name must not match
529.Ar pattern
530which is a space or comma separated list of patterns passed to
531.Xr fnmatch 3 .
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700532.It Fl z , Fl Fl allowinterfaces Ar pattern
533When discovering interfaces, the interface name must match
534.Ar pattern
535which is a space or comma separated list of patterns passed to
536.Xr fnmatch 3 .
537If the same interface is matched in
538.Fl Z , Fl Fl denyinterfaces
539then it is still denied.
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800540.El
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800541.Sh 3RDPARTY LINK MANAGEMENT
542Some interfaces require configuration by 3rd parties, such as PPP or VPN.
543When an interface configuration in
544.Nm
545is marked as STATIC or INFORM without an address then
546.Nm
547will monitor the interface until an address is added or removed from it and
548act accordingly.
549For point to point interfaces (like PPP), a default route to its
550destination is automatically added to the configuration.
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700551If the point to point interface is configured for INFORM, then
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800552.Nm
553unicasts INFORM to the destination, otherwise it defaults to STATIC.
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800554.Sh NOTES
555.Nm
556requires a Berkley Packet Filter, or BPF device on BSD based systems and a
557Linux Socket Filter, or LPF device on Linux based systems.
558.Sh FILES
559.Bl -ohang
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800560.It Pa /etc/dhcpcd.conf
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800561Configuration file for dhcpcd.
562If you always use the same options, put them here.
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800563.It Pa /etc/dhcpcd.duid
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800564Text file that holds the DUID used to identify the host.
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800565.It Pa /libexec/dhcpcd-run-hooks
566Bourne shell script that is run to configure or de-configure an interface.
567.It Pa /libexec/dhcpcd-hooks
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800568A directory containing bourne shell scripts that are run by the above script.
569Each script can be disabled by using the
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700570.Fl C , Fl Fl nohook
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800571option described above.
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800572.It Pa /var/db/dhcpcd\- Ns Ar interface Ns .lease
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700573The actual DHCP message send by the server.
574We use this when reading the last
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800575lease and use the files mtime as when it was issued.
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800576.It Pa /var/run/dhcpcd.pid
577Stores the PID of
578.Nm
579running on all interfaces.
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800580.It Pa /var/run/dhcpcd\- Ns Ar interface Ns .pid
581Stores the PID of
582.Nm
583running on the
584.Ar interface .
585.El
586.Sh SEE ALSO
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700587.Xr fnmatch 3 ,
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800588.Xr if_nametoindex 3 ,
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700589.Xr dhcpcd.conf 5 ,
590.Xr resolv.conf 5 ,
591.Xr dhcpcd-run-hooks 8 ,
592.Xr resolvconf 8
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800593.Sh STANDARDS
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800594RFC 951, RFC 1534, RFC 2131, RFC 2132, RFC 2855, RFC 3004, RFC 3361, RFC 3396,
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700595RFC 3397, RFC 3442, RFC 3927, RFC 4361, RFC 4390, RFC 4702, RFC 4861, RFC 5969,
596RFC 6106.
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800597.Sh AUTHORS
Dmitry Shmidte86eee12011-01-24 16:27:51 -0800598.An Roy Marples Aq roy@marples.name
The Android Open Source Projectf7c54212009-03-03 19:29:22 -0800599.Sh BUGS
Dmitry Shmidta3a22602012-07-23 16:45:46 -0700600Please report them to
601.Lk http://roy.marples.name/projects/dhcpcd