You can fine-tune the behaviour of
dhcpcd with the following options:
-b, --background
Background immediately. This is useful for startup scripts which don't disable link messages for carrier status.
-c, --script script
Use this script instead of the default /libexec/dhcpcd-run-hooks.
-d, --debug
Echo debug messages to the stderr and syslog.
-e, --env value
Push
value to the environment for use in
dhcpcd-run-hooks(8). For example, you can force the hostname hook to always set the hostname with
-e force_hostname=YES.
-g, --reconfigure
dhcpcd will re-apply IP address, routing and run
dhcpcd-run-hooks(8) for each interface. This is useful so that a 3rd party such as PPP or VPN can change the routing table and / or DNS, etc and then instruct
dhcpcd to put things back afterwards.
dhcpcd does not read a new configuration when this happens - you should rebind if you need that functionality.
-f, --config file
Specify a config to load instead of /etc/dhcpcd.conf. dhcpcd always processes the config file before any command line options.
-h, --hostname hostname
Sends hostname to the DHCP server so it can be registered in DNS. If hostname is an empty string then the current system hostname is sent. If hostname is a FQDN (ie, contains a .) then it will be encoded as such.
-i, --vendorclassid vendorclassid
Override the vendorclassid field sent. The default is dhcpcd <version>. If not set then none is sent.
-k, --release
This causes an existing dhcpcd process running on the interface to release its lease, de-configure the interface and then exit. dhcpcd then waits until this process has exited.
-l, --leasetime seconds
Request a specific lease time in seconds. By default dhcpcd does not request any lease time and leaves it in the hands of the DHCP server.
-m, --metric metric
Metrics are used to prefer an interface over another one, lowest wins.
dhcpcd will supply a default metic of 200 +
if_nametoindex(3). An extra 100 will be added for wireless interfaces.
-o, --option option
Request the DHCP option variable for use in /libexec/dhcpcd-run-hooks.
-n, --rebind
Notifies dhcpcd to reload its configuration and rebind its interfaces. If dhcpcd is not running, then it starts up as normal.
-p, --persistent
dhcpcd normally de-configures the interface and configuration when it exits. Sometimes, this isn't desirable if, for example, you have root mounted over NFS. You can use this option to stop this from happening.
-r, --request [address]
dhcpcd normally sends a DHCP DISCOVER to find servers to offer an address. dhcpcd then requests the address used. You can use this option to skip the DISCOVER phase and just request the address. The downside is if you request an address the DHCP server does not know about or the DHCP server is not authoritative, it will remain silent. In this situation, we go back to the init state and DISCOVER again. If no address is given then the first address currently assigned to the interface is used.
-s, --inform [address[/cidr]]
Behaves like -r, --request as above, but sends a DHCP INFORM instead of a REQUEST. This does not get a lease as such, just notifies the DHCP server of the address in use. You should also include the optional cidr network number in case the address is not already configured on the interface. dhcpcd remains running and pretends it has an infinite lease. dhcpcd will not de-configure the interface when it exits. If dhcpcd fails to contact a DHCP server then it returns a failure instead of falling back on IPv4LL.
-t, --timeout seconds
Timeout after seconds, instead of the default 30. A setting of 0 seconds causes dhcpcd to wait forever to get a lease.
-u, --userclass class
Tags the DHCP message with the userclass class. DHCP servers use this to give members of the class DHCP options other than the default, without having to know things like hardware address or hostname.
-v, --vendor code,value
Add an encapsulated vendor option.
code should be between 1 and 254 inclusive. To add a raw vendor string, omit
code but keep the comma. Examples.
Set the vendor option 01 with an IP address.
dhcpcd -v 01,192.168.0.2 eth0
Set the vendor option 02 with a hex code.
dhcpcd -v 02,01:02:03:04:05 eth0
Set the vendor option 03 with an IP address as a string.
dhcpcd -v 03,\"192.168.0.2\" eth0
Set un-encapsulated vendor option to hello world.
dhcpcd -v ,"hello world" eth0
-v, --version
Display both program version and copyright information. dhcpcd then exits before doing any configuration.
-w, --waitip
Wait for an address to be assigned before forking to the background.
-x, --exit
This will signal an existing dhcpcd process running on the interface to de-configure the interface and exit. dhcpcd then waits until this process has exited.
-y, --reboot seconds
Allow reboot seconds before moving to the discover phase if we have an old lease to use. The default is 10 seconds. A setting of 0 seconds causes dhcpcd to skip the reboot phase and go straight into discover.
-D, --duid
Generate an RFC 4361 compliant clientid. This requires persistent storage and not all DHCP servers work with it so it is not enabled by default. dhcpcd generates the DUID and stores it in /etc/dhcpcd.duid. This file should not be copied to other hosts.
-E, --lastlease
If dhcpcd cannot obtain a lease, then try to use the last lease acquired for the interface. If the -p, --persistent option is not given then the lease is used if it hasn't expired.
-F, --fqdn fqdn
Requests that the DHCP server updates DNS using FQDN instead of just a hostname. Valid values for fqdn are disable, none, ptr and both. dhcpcd itself never does any DNS updates. dhcpcd encodes the FQDN hostname as specified in RFC1035.
-I, --clientid clientid
Send the clientid. If the string is of the format 01:02:03 then it is encoded as hex. For interfaces whose hardware address is longer than 8 bytes, or if the clientid is an empty string then dhcpcd sends a default clientid of the hardware family and the hardware address.