.\" Copyright (c) 2006-2013 Roy Marples .\" All rights reserved .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .Dd July 25, 2013 .Dt DHCPCD.CONF 5 SMM .Os .Sh NAME .Nm dhcpcd.conf .Nd dhcpcd configuration file .Sh DESCRIPTION Although .Nm dhcpcd can do everything from the command line, there are cases where it's just easier to do it once in a configuration file. Most of the options found in .Xr dhcpcd 8 can be used here. The first word on the line is the option and the rest of the line is the value. Leading and trailing whitespace for the option and value are trimmed. You can escape characters in the value using the \\ character. .Pp Blank lines and lines starting with # are ignored. .Pp Here's a list of available options: .Bl -tag -width indent .It Ic allowinterfaces Ar pattern When discovering interfaces, the interface name must match .Ar pattern which is a space or comma separated list of patterns passed to .Xr fnmatch 3 . If the same interface is matched in .Ic denyinterfaces then it is still denied. .It Ic denyinterfaces Ar pattern When discovering interfaces, the interface name must not match .Ar pattern which is a space or comma separated list of patterns passed to .Xr fnmatch 3 . .It Ic arping Ar address Op address .Nm dhcpcd will arping each address in order before attempting DHCP. If an address is found, we will select the replying hardware address as the profile, otherwise the ip address. Example: .Pp .D1 interface bge0 .D1 arping 192.168.0.1 .Pp .D1 profile 192.168.0.1 .D1 static ip_address=192.168.0.10/24 .It Ic background Background immediately. This is useful for startup scripts which don't disable link messages for carrier status. .It Ic blacklist Ar address Ns Op /cidr Ignores all packets from .Ar address Ns Op /cidr . .It Ic whitelist Ar address Ns Op /cidr Only accept packets from .Ar address Ns Op /cidr . .Ic blacklist is ignored if .Ic whitelist is set. .It Ic broadcast Instructs the DHCP server to broadcast replies back to the client. Normally this is only set for non Ethernet interfaces, such as FireWire and InfiniBand. In most cases, .Nm dhcpcd will set this automatically. .It Ic env Ar value Push .Ar value to the environment for use in .Xr dhcpcd-run-hooks 8 . For example, you can force the hostname hook to always set the hostname with .Ic env .Va force_hostname=YES . .Pp If the hostname is set, will be will set to the FQDN if possible as per RFC 4702 section 3.1. If the FQDN option is missing, .Nm dhcpcd will still try and set a FQDN from the hostname and domain options for consistency. To override this, set .Ic env .Va hostname_fqdn=[YES|NO|SERVER] . A value of server means just what the server says, don't manipulate it. This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 network where the DHCPv4 hostname is short and the DHCPv6 has an FQDN. DHCPv6 has no hostname option. .It Ic clientid Ar string Send the .Ar 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 .Ar clientid is an empty string then .Nm dhcpcd sends a default .Ar clientid of the hardware family and the hardware address. .It Ic duid Generate an .Rs .%T "RFC 4361" .Re compliant clientid. If persistent storage is available then a DUID-LLT (link local address + time) is generated, otherwise DUID-LL is generated (link local address). The DUID-LLT generated will be held in .Pa /etc/dhcpcd.duid and should not be copied to other hosts. .It Ic fallback Ar profile Fallback to using this profile if DHCP fails. This allows you to configure a static profile instead of using ZeroConf. .It Ic hostname Ar name Sends .Ar hostname to the DHCP server so it can be registered in DNS. If .Ar hostname is an empty string then the current system hostname is sent. If .Ar hostname is a FQDN (ie, contains a .) then it will be encoded as such. .It Ic hostname_short Sends the short hostname to the DHCP server instead of the FQDN. This is useful because DHCP servers will not register the FQDN in their DNS if the domain part does not match theirs. .Pp Also, see the .Ic env option above to control how the hostname is set on the host. .It Ic ia_na Op Ar iaid Request a DHCPv6 Normal Address for .Ar iaid . If none is specified, a default .Ar iaid is used. If the interface name is 4 characters or less then that is used, otherwise the interface index is used. .It Ic ia_ta Op Ar iaid Request a DHCPv6 Temporary Address for .Ar iaid . .It Ic ia_pd Op Ar iaid Op Ar interface Op / Ar sla_id Op / Ar prefix_len Request a DHCPv6 Delegated Prefix for .Ar iaid . If no .Ar interface is given then we will assign a prefix to every other interface with a unique .Ar sla_id for each, starting from 0. Otherwise addresses are only assigned for each .Ar interface and .Ar sla_id A default .Ar prefix_len of 64 is assumed. .Ar sla_id is an integer and is added to the prefix which must fit inside .Ar prefix_len less the length of the delegated prefix. You can specify multiple .Ar interface / .Ar sla_id / .Ar prefix_len per .Ic ia_pd , space separated. IPv6RS should be disabled globally when requesting a Prefix Delegation like so: .Pp .D1 noipv6rs .Pp .D1 interface eth0 .D1 ia_pd 1 eth1/0 eth2/1 .It Ic ipv4only Only configure IPv4. .It Ic ipv6only Only confgiure IPv6. .It Ic fqdn Op disable | ptr | both ptr just asks the DHCP server to update the PTR record of the host in DNS whereas both also updates the A record. disable will disable the FQDN option. The default is both. .Nm dhcpcd itself never does any DNS updates. .Nm dhcpcd encodes the FQDN hostname as specified in .Li RFC1035 . .It Ic interface Ar interface Subsequent options are only parsed for this .Ar interface . .It Ic ipv6ra_fork By default, when .Nm dhcpcd receives an IPv6 RA, .Nm dhcpcd will only fork to the background if the RA contains at least one unexpired RDNSS option. Set this option so to make .Nm dhcpcd always fork on an RA. .It Ic ipv6ra_own Disables kernel IPv6 Router Advertisment processing so dhcpcd can manage addresses and routes. This does not work reliably on any BSD system, probably due to kernel issues. .It Ic ipv6ra_own_default Each time dhcpcd receives an IPv6 Router Adveristment, dhcpcd will manage the default route only. This allows dhcpcd to prefer an interface for outbound traffic based on metric and/or user selection rather than the kernel. This does work reliably on BSD systems. .It Ic ipv6rs Enables IPv6 Router Advertisment solicitation. This is on by default, but is documented here in the case where it is disabled globally but needs to be enabled for one interface. .It Ic leasetime Ar seconds Request a leasetime of .Ar seconds . .It Ic metric Ar metric Metrics are used to prefer an interface over another one, lowest wins. .Nm dhcpcd will supply a default metric of 200 + .Xr if_nametoindex 3 . An extra 100 will be added for wireless interfaces. .It Ic noalias IPv4 addresses added will overwrite a pre-existing address instead of working alongside. .It Ic noarp Don't send any ARP requests. This also disables IPv4LL. .It Ic nogateway Don't install any default routes. .It Ic nohook Ar script Don't run this hook script. Matches full name, or prefixed with 2 numbers optionally ending with .Pa .sh . .Pp So to stop .Nm dhcpcd from touching your DNS or MTU settings you would do:- .D1 nohook resolv.conf, mtu .It Ic noipv4ll Don't attempt to obtain an IPv4LL address if we failed to get one via DHCP. See .Rs .%T "RFC 3927" .Re .It Ic noipv6rs Disable solicitation and receipt of IPv6 Router Advertisements. .It Ic nolink Don't receive link messages about carrier status. You should only set this for buggy interface drivers. .It Ic option Ar option Requests the .Ar option from the server. It can be a variable to be used in .Xr dhcpcd-run-hooks 8 or the numerical value. You can specify more .Ar option Ns s separated by commas, spaces or more .Ic option lines. Prepend dhcp6_ to .Ar option to request a DHCPv6 option. DHCPv4 options are mapped to DHCPv6 where applicable. .It Ic nooption Ar option Remove the option from the DHCP message. This should only be used when a DHCP server sends a non requested option that should not be processed. .It Ic destination Ar option If .Nm detects an address added to a point to point interface (PPP, TUN, etc) then it will set the listed DHCP options to the destination address of the interface. .It Ic profile Ar name Subsequent options are only parsed for this profile .Ar name . .It Ic quiet Suppress any dhcpcd output to the console, except for errors. .It Ic reboot Ar seconds Allow .Ar reboot seconds before moving to the DISCOVER phase if we have an old lease to use. The default is 5 seconds. A setting of 0 seconds causes .Nm dhcpcd to skip the REBOOT phase and go straight into DISCOVER. This is desirable for mobile users because if you change from network A to network B and they use the same subnet and the address from network A isn't in use on network B, then the DHCP server will remain silent even if authorative which means .Nm dhcpcd will timeout before moving back to the DISCOVER phase. .It Ic release .Nm dhcpcd will release the lease prior to stopping the interface. .It Ic require Ar option Requires the .Ar option to be present in all DHCP messages, otherwise the message is ignored. It can be a variable to be used in .Xr dhcpcd-run-hooks 8 or the numerical value. You can specify more options separated by commas, spaces or more require lines. To enforce that .Nm dhcpcd only responds to DHCP servers and not BOOTP servers, you can .Ic require .Ar dhcp_message_type . .It Ic script Ar script Use .Ar script instead of the default .Pa /lib/dhcpcd/dhcpcd-run-hooks . .It Ic ssid Ar ssid Subsequent options are only parsed for this wireless .Ar ssid . .It Ic static Ar value Configures a static .Ar value . If you set .Ic ip_address then .Nm dhcpcd will not attempt to obtain a lease and just use the value for the address with an infinite lease time. .Pp Here is an example which configures a static address, routes and dns. .D1 interface eth0 .D1 static ip_address=192.168.0.10/24 .D1 static routers=192.168.0.1 .D1 static domain_name_servers=192.168.0.1 .Pp Here is an example for PPP which gives the destination a default route. It uses the special destination keyword to insert the destination address into the value. .D1 interface ppp0 .D1 static ip_address= .D1 destination routers .It Ic timeout Ar seconds The default timeout for waiting for a DHCP response is 30 seconds which may be too long or too short and can be changed here. A setting of 0 .Ar seconds causes .Nm dhcpcd to wait forever to get a lease. .It Ic userclass Ar string Tag the DHCP messages with the userclass. You can specify more than one. .It Ic vendor Ar code , Ns Ar value Add an encapsulated vendor option. .Ar code should be between 1 and 254 inclusive. To add a raw vendor string, omit .Ar code but keep the comma. Examples. .Pp Set the vendor option 01 with an IP address. .D1 vendor 01,192.168.0.2 Set the vendor option 02 with a hex code. .D1 vendor 02,01:02:03:04:05 Set the vendor option 03 with an IP address as a string. .D1 vendor 03,\e"192.168.0.2\e" Set un-encapsulated vendor option to hello world. .D1 vendor ,"hello world" .It Ic vendorclassid Ar string The default is dhcpcd-:::. For example .D1 dhcpcd-5.5.6:NetBSD-6.99.5:i386:i386 If not set then none is sent. Some badly configured DHCP servers reject unknown vendorclassids. To work around it, try and impersonate Windows by using the MSFT vendorclassid. .It Ic waitip Wait for an address to be assigned before forking to the background. .It Ic xidhwaddr Use the last four bytes of the hardware address as the DHCP xid instead of a randomly generated number. .El .Sh SEE ALSO .Xr dhcpcd-run-hooks 8 , .Xr dhcpcd 8 , .Xr if_nametoindex 3 , .Xr fnmatch 3 .Sh AUTHORS .An Roy Marples Aq Mt roy@marples.name .Sh BUGS Please report them to .Lk http://roy.marples.name/projects/dhcpcd