DHCPcd

client

linux
dhcpd conf

linux

dhcpcd many options: actions, Restricting behaviour …         interface [interface] []

dhcpcd --rebind interface
dhcpcd --release interface
dhcpcd --dumplease interface
dhcpcd --exit
dhcpcd --version

Gets its host information (IP address, netmask,DNS server etc) from a DHCP server and configures its network.
Updates domain and DNServers in resolvconf(8), or /etc/resolv.conf.
If the hostname is blank, (null) or localhost or force_hostname is TRUE, sets the hostname.

Then waits for the lease renewal time, renews its lease and reconfigures, ….

If an interface reports carrier obtains a lease then forks.

Some options send a signal a running DHCPcd process.

  • As a daemon without a list of interfaces(Master mode), discovers interfaces.
  • If an interface is given, runs as a separate instance on that interface with --waitip enabled .

Hooking into events

May be invoked by
/etc/systemd/system/dhcpcd.service.d/wait.conf : /usr/lib/dhcpcd5/dhcpcd --quiet --waitip [--background]

Runs /lib/dhcpcd/dhcpcd-run-hooks which invokes scripts :

See dhcpcd-run-hooks(8)

Scripts from /usr/share/dhcpcd/hooks: 10-wpa_supplicant, 15-timezone and 29-lookup-hostname
can be copied to /lib/dhcpcd/dhcpcd-hooks
10-wpa_supplicant ensures that wpa_supplicant is always running on a hot-plugged wireless interface.

Actions
-T
--test
Outputs specific DHCP variables. The interface and configuration files are not changed.
Calls /lib/dhcpcd/dhcpcd-run-hooks with TEST

> sudo dhcpcd --test
dhcp6_listen: Address already in use
DUID 00:01:00:01:2a:be:6b:ca:b8:27:eb:c3:29:26
eth0: IAID eb:c3:29:26
eth0: soliciting an IPv6 router
eth0: Router Advertisement from fe80::7a67:eff:fe0d:f57e
eth0: rebinding lease of 192.168.1.14   distributing  static address
eth0: leased 192.168.1.14 for 18000 seconds
interface='wlan0'
pid='14455'
protocol='ra'
reason='TEST'
ifcarrier='up'
ifflags='4163'
ifmtu='1500'
ifssid='disabled'
ifwireless='1'
nd1_acquired='74453'
nd1_from='fe80::7a67:eff:fe0d:f57e'
nd1_mtu='1500'
nd1_now='74453'
nd1_prefix_information1_flags='LA'
nd1_prefix_information1_length='64'
nd1_prefix_information1_pltime='7200'
nd1_prefix_information1_prefix=
            '2600:4041:4312:fb00::'
nd1_prefix_information1_vltime='7200'
nd1_rdnss1_lifetime='600'
nd1_rdnss1_servers=
            '2600:4041:4312:fb00::1'
nd1_source_address='78670e0df57e'
wlan0: requesting DHCPv6 information
wlan0: rebinding lease of 192.168.1.63
dhcp6_listen: Address already in use
wlan0: leased 192.168.1.63 
            for 86400 seconds

 Same information reported a second time…

dhcpcd exited

rapid_commit is not sent so that the server does not lease an address.

To test INFORM the interface needs to be configured with the desired address before starting dhcpcd.

-d
--debug
messages to the stderr and syslog.
-j
--logfile logfile
Uses logfile, truncated when opened, reopened on SIGUSR2 . Useful when run interactively on one interface.
-q
--quiet
only warnings and errors will be displayed.
-f
--config file
Default:/etc/dhcpcd.conf , processed before command line options.
-c
--script script
only run script.
-C
--nohook script
Don't run script. Matches full name, or prefix with 2 digits, optionally ending with .sh

To changing DNS settings : dhcpcd --nohook resolv.conf eth0

-g
--reconfigure
Re-apply IP address, routing and run dhcpcd-run-hooks for each interface.
Useful when PPP or VPN changes the routing table, DNS, etc
-n
--rebind [interface]
Reload configuration and rebind.
If dhcpcd is not running, it starts up as normal.
wpa_supplicant reloads its configuration if the relevant hook script has been installed.
-N
--renew [interface]
Renew existing addresses
If no interface is specified applies to all in Master mode.
If dhcpcd is not running, it starts up as normal.
Unlike --rebind the configuration is not reloaded.
-k
--release [interface
Release lease and de-configure regardless of --persistent.
If no interfaces are left running, dhcpcd exits.
-y
--reboot seconds
With an existing lease, Waits before discovery.
Waits again before starting fallback states after discovery .
Default 5 seconds. If seconds is zero, skips the reboot and goes to discover.
IPv4LL is started after the first reboot timeout .
On DHCPv6 only than skips the reboot phase.
-b
--background

Background immediately,

-B
--nobackground
-w
--waitip [4 | 6]
Wait for an address to be assigned before forking to the background. 4 IPv4, 6 IPv6 address to be assigned.
With more than one address protocol dhcpcd forks to the background after all waiting conditions are satisfied.
-e
--env value
Add value to the environment for dhcpcd-run-hooks.
Example: always set the hostname -e force_hostname=YES.
-M
--master
Start Master mode even if only one interface is specified.
-p
--persistent
Don't de-configure the interface on exit
-t
--timeout seconds
If working on one interface, exit after timeout, otherwise fork to the background.
Default 30. (Don't use 0 i.e. wait forever)
-U
--dumplease interface
see github

??Dumps the last lease to stdout.
Read a DHCP wire message Defaiult standard input . Use -4 or -6

-P
--printpidfile
output the pidfile
-D
--duid
Generate an RFC 4361 compliant clientid, and stores it in /etc/dhcpcd.duid
--version and exits
-x
--exit [interface]
From one dhcpcd, signal other dhcpcds in Master mode or interface to exit. Wait until they have exited.
Use --persistent to leave interface(s) unchanged.
-V
--variables
Display option codes for use in dhcpcd-run-hooks.
Variables are pre-fixed with new_ and old_ unless the option number is -.
Variables without an option are part of the DHCP message and cannot be directly requested.
> sudo dhcpcd --test --debug --variables
Interface options:
 -  interface
 -  reason
 -  pid
 -  ifcarrier
 -  ifmetric
 -  ifwireless
 -  ifflags
 -  ssid
 -  profile
 -  interface_order 
DHCPv4 options:
    ip_address
    subnet_cidr
    network_number
    filename
    server_name
  1 subnet_mask                  IP addr request
121 classless_static_routes      string rfc3442
249 ms_classless_static_routes   string rfc3442
 33 static_routes                IP addrs request
  3 routers                      IP addrs request
  2 time_offset                  uint32
  4 time_servers                 IP addrs
  5 ien116_name_servers          IP addrs
  6 domain_name_servers          IP addrs
  7 log_servers                  IP addrs
  8 cookie_servers               IP addrs
  9 lpr_servers                  IP addrs
 10 impress_servers              IP addrs
 11 resource_location_servers    IP addrs

 12 host_name                    dname

 13 boot_size                    uint16
 14 merit_dump                   string

 15 domain_name                  array dname

 16 swap_server                  ipaddress

 17 root_path                    string
 18 extensions_path              string
 19 ip_forwarding                uint8
 20 non_local_source_routing     uint8
 21 policy_filter                IP addrs
 22 max_dgram_reassembly         uint16
 23 default_ip_ttl               uint8
 24 path_mtu_aging_timeout       uint32
 25 path_mtu_plateau_table       array uint16
 26 interface_mtu                uint16
 27 all_subnets_local            uint8
 28 broadcast_address            IPaddr request
 29 perform_mask_discovery       uint8
 30 mask_supplier                uint8
 31 router_discovery             uint8
 32 router_solicitation_address  IP addr
 34 trailer_encapsulation        uint8
 35 arp_cache_timeout            uint32
 36 ieee802_3_encapsulation      uint16
 37 default_tcp_ttl              uint8
 38 tcp_keepalive_interval       uint32
 39 tcp_keepalive_garbage        uint8
 40 nis_domain                   string
 41 nis_servers                  IP addrs
 42 ntp_servers                  IP addrs
 43 vendor_encapsulated_options  binhex
 44 netbios_name_servers         IP addrs
 45 netbios_dd_server            ipaddress
 46 netbios_node_type            uint8
 47 netbios_scope                string
 48 font_servers                 IP addrs
 49 x_display_manager            IP addrs
 50 dhcp_requested_address       ipaddress
 51 dhcp_lease_time              uint32 request
 52 dhcp_option_overload         uint8
 53 dhcp_message_type            uint8
 54 dhcp_server_identifier       ipaddress
 55 dhcp_parameter_request_list  array uint8
 56 dhcp_message                 string
 57 dhcp_max_message_size        uint16
 58 dhcp_renewal_time            uint32 request
 59 dhcp_rebinding_time          uint32 request

 60 vendor_class_identifier      string
 61 dhcp_client_identifier       binhex
 64 nisplus_domain               string
 65 nisplus_servers              IP addrs

 66 tftp_server_name             dname
 67 bootfile_name                string

 68 mobile_ip_home_agent         IP addrs

 69 smtp_server                  IP addrs
 70 pop_server                  IP addrs
 71 nntp_server                 IP addrs
 72 www_server                  IP addrs
 73 finger_server               IP addrs
 74 irc_server                  IP addrs
 75 streettalk_server           IP addrs
 76 streettalk_directory_assistance_serverarray 
                                ipaddress
 77 user_class                  binhex
 78 slp_agent                   embed
 79 slp_service                 embed
 80 rapid_commit                flag norequest
 81 fqdn                        embed
 83 isns                        embed
 85 nds_servers                 IP addrs
 86 nds_tree_name               raw
 87 nds_context                 raw
 88 bcms_controller_names       array domain
 89 bcms_controller_address     IP addrs
 90 auth                         embed
 91 client_last_transaction_time uint32
 92 associated_ip                IP addrs
 98 uap_servers                  string
 99 geoconf_civic                encap
100 posix_timezone               string
101 tzdb_timezone                string
116 auto_configure               uint8
117 name_service_search          array uint16
118 subnet_selection             ipaddress
119 domain_search                array domain
120 sip_server                   string rfc3361
122 tsp                          encap
123 geoconf                      binhex
124 vivco                        binhex
125 vivso                        embed
136 pana_agent                   IP addrs
137 lost_server                  domain
138 capwap_ac                    IP addrs
139 mos_ip                   encap
140 mos_domain               encap
141 sip_ua_cs_list           array domain
142 andsf                    IP addrs
143 andsf6                   array IP6addr
144 geoloc                   binhex
145 forcerenew_nonce_capable array uint8
146 rdnss_selection          embed
150 tftp_servers             IP addrs
208 pxelinux_magic           binhex
209 config_file              string
210 path_prefix              string
211 reboot_time              uint32
212 sixrd                    embed
213 access_domain            domain
221 vss                      encap
252 wpad_url                 string

ND options:
  1 source_address               binhex
  2 target_address               binhex
  3 prefix_information           embed index
  5 mtu                          embed
 25 rdnss                        embed index
 31 dnssl                        embed index

 DHCPv6 options:

 1 client_id             binhex
 2 server_id             binhex
 3 ia_na                 embed index norequest
 4 ia_ta                 embed index norequest
 5 ia_addr               embed index norequest
 6 option_request        array uint16
 7 preference            uint8
 8 elased_time           uint16
 9 dhcp_relay_msg        binhex
11 auth                  embed
12 unicast               ip6address
13 status_code           embed norequest
14 rapid_commit          flag norequest
15 user_class            binhex
16 vivco                 binhex
17 vivso                 embed
18 interface_id          binhex
19 reconfigure_msg       uint8
20 reconfigure_accept    flag
21 sip_servers_names     array domain
22 sip_servers_addresses array ip6address
23 name_servers          array ip6address
24 domain_search         array domain
25 ia_pd                 embed index norequest
26 prefix                embed index

27 nis_servers        array ip6address
28 nisp_servers       array ip6address
29 nis_domain_name    string
30 nisp_domain_name   string
31 sntp_servers       array ip6address
32 info_refresh_time  uint32
33 bcms_server_d      array domain
34 bcms_server_a      array ip6address
36 geoconf_civic      encap
37 remote_id          embed
38 subscriber_id      binhex
39 fqdn               embed
40 pana_agent         array ip6address
41 posix_timezone     string
42 tzdb_timezone      string
43 ero                array uint16
49 mip6_hnidf         domain
50 mip6_vdinf         encap
51 lost_server        domain
52 capwap_ac          array ip6address
53 relay_id           binhex
54 mos_ip             encap
55 mos_domain         encap
56 ntp_server         encap
57 access_domain      domain
58 sip_ua_cs_list     array domain

59 bootfile_url       string
60 bootfile_param     binhex
61 architecture_types array uint16
62 nii                embed
63 geoloc             binhex
64 aftr_name          domain
67 pd_exclude         embed
69 mip6_idinf         encap
70 mip6_udinf         encap
71 mip6_hnp           embed
72 mip6_haa           ip6address
73 mip6_haf           domain
74 rdnss_selection    embed
75 krb_principal_name string
76 krb_realm_name     string
78 krb_kdc            embed
80 link_address       ip6address
82 sol_max_rt         uint32 request
83 inf_max_rt         uint32 request

Restricting behaviour
-1
--oneshot
Exit after configuring interface.
-K
--nolink
ignore link messages for carrier status. Use --waitip to specify which protocol(s) to configure
-4
--ipv4only
-6
--ipv6only
-A
--noarp
Don't request or claim address by ARP. disables IPv4LL.
-L
--noipv4ll
Don't use IPv4LL (aka APIPA, aka Bonjour, aka ZeroConf).
-l
--leasetime seconds
Request a specific lease time. default server controls lease time.
-E
--lastlease
If cannot obtain a lease, use the last lease acquired for the interface anyway.
--lastleaseextend Lease will be retained after it expires. It will be given it up if another host tries to claim it via ARP. violates RFC2131 7
-r
--request [address]
Request the address in the DHCP DISCOVER message.
Default: first address assigned
-s
--inform [address[/cidr]]
like --request but sends a DHCP INFORM instead of DISCOVER/REQUEST.
This does not get a lease, just notifies the DHCP server of the address in use.
include the optional cidr network number in case the address is not already configured on the interface.
dhcpcd remains running and as if it has an infinite lease.
Will not de-configure the interface when it exits.
If dhcpcd fails to contact a DHCP server then returns a failure instead of falling back on IPv4LL.
--inform6 Performs a DHCPv6 Information Request. No address is requested or specified, but all other DHCPv6 options are allowed. This is normally performed automatically when the IPv6 Router Advertises that the client should perform this operation. Only needed when not processing IPv6RA messages
-F
--fqdn disable|none| ptr|both
DHCP server updates DNS using FQDN instead of just a hostname. dhcpcd does no DNS updates. dhcpcd encodes the FQDN hostname as specified in RFC1035.
-h
--hostname [hostname]
Send hostname to the DHCP server to be registered in DNS. Default system hostname .
-I
--clientid [clientid]
Send the clientid. Use xx:xx:xx for hexadecimal.
If hardware address is longer than 8 bytes or clientid is an not specified sends hardware family and the hardware address.
-i
--vendorclassid vendorclassid
Override the DHCPv4 vendorclassid field sent. Default: dhcpcd-version:os:machine:platform. For example dhcpcd-5.5.6:NetBSD-6.99.5:i386:i386
-S
--static value
Does not obtain a lease and with an infinite lease time.
Example :
                   dhcpcd -S ip_address=192.168.0.10/24 \
                          -S routers=192.168.0.1 \
                          -S domain_name_servers=192.168.0.1 \
                            eth0
Cannot set static DHCPv6 values. Use --env
-u
--userclass class
Tags the DHCPv4 message.
DHCP servers use this to give members of the class DHCP options other than the default, without having to know hardware address or hostname.
-v
--vendor code[,value
Add an encapsulated vendor option. code is 1..254 .
To add a raw vendor string, omit code but keep the comma.
Examples.
             IP address: dhcpcd -v 01,192.168.0.2 eth0
             hex code:  dhcpcd -v 02,01:02:03:04:05 eth0
             IP address as a string:  dhcpcd -v 03,\"192.168.0.2\" eth0
             un-encapsulated vendor option :  dhcpcd -v ,"hello world" eth0

-m
--metric metric
Metrics used to prefer an interface over another one, lowest wins.
Default 200 + if_nametoindex(3). 100 will be added for wireless interfaces.
-G
--nogateway
Don't any default routes.
-H
--xidhwaddr
Use the last four bytes of the hardware address as xid instead of a random number.
-J
--broadcast
Instructs the DHCP server to broadcast replies back to the client.
-o
--option option
Request option variable for use in /lib/dhcpcd/dhcpcd-run-hooks.
-O
--nooption option
Removes option from the DHCP message before processing.
-Q
--require option
Requires option be present in DHCP messages or the message is ignored.
To force dhcpcd to respond to DHCP servers (i.e. not BOOTP servers) --require dhcp_message_type.
-W
--whitelist address[/cidr]
Only accept packets from address[/cidr]
--blacklist
is ignored if --whitelist is set.
-X
--blacklist address[/cidr]
Ignore packets from address[/cidr].
-z
--allowinterfaces pattern
When discovering interfaces, name must match pattern
--denyinterfaces takes precedence!
--inactivestart interfaces on the command line.
This allows starting in Master mode and waiting for commands to start interfaces
--nodev No /dev management modules are loaded..

Local Link configuration

If fails to obtain a lease, probes for a valid IPv4LL address (aka ZeroConf, aka APIPA). then looks for a DHCP server to get a proper address.
When using IPv4LL, failure means there is a reverse ARP proxy installed which defeats IPv4LL probing.
To disable this behaviour, use -L, --noipv4ll

3RD Party Link Management

When an interface configuration in dhcpcd is marked as STATIC or INFORM without an address (for example PPP or VPN) hcpcd monitors the interface until an address is added or removed from it and act accordingly.
For point to point interfaces (like PPP), a default route to its destination is automatically added to the configuration. If the point to point interface is configured for INFORM, then dhcpcd unicasts INFORM to the destination, otherwise it defaults to STATIC.

If restricting dhcpcd to a single interface and optionally address family via the command-line then all further calls to dhcpcd to rebind, reconfigure or exit need to include the same restrictive flags so that dhcpcd knows which process to signal.

Log as result of sudo ifconfig wlan0 down; sudo ifconfig wlan0 up

12:55:16 daemon.info systemd[1]: Starting dhcpcd on all interfaces...
12:55:17 daemon.err dhcpcd[279]: no valid interfaces found
12:55:17 daemon.info dhcpcd[279]: forked to background, child pid 289
12:55:17 daemon.info systemd[1]: Started dhcpcd on all interfaces.

12:55:20 daemon.info dhcpcd-run-hooks[378]: wlan0: starting wpa_supplicant

12:55:24 daemon.info dhcpcd[289]: wlan0: waiting for carrier
12:55:25 daemon.info dhcpcd[289]:                                              eth0: waiting for carrier

12:55:25 daemon.info dhcpcd[289]: wlan0: carrier acquired
12:55:25 daemon.info dhcpcd[289]: DUID 00:01:00:01:21:b0:de:59:b8:27:eb:0f:cf:06
12:55:25 daemon.info dhcpcd[289]: wlan0: IAID eb:1c:5b:93
12:55:25 daemon.info dhcpcd[289]: wlan0: adding address fe80::2360:c560:acef:fd7e
12:55:25 daemon.info dhcpcd[289]: wlan0: carrier lost
12:55:25 daemon.info dhcpcd[289]: wlan0: deleting address fe80::2360:c560:acef:fd7e

12:55:25 daemon.info dhcpcd[289]:                                              eth0: carrier acquired
12:55:25 daemon.info dhcpcd[289]:                                              eth0: IAID 4c:53:44:58
12:55:25 daemon.info dhcpcd[289]:                                              eth0: adding address fe80::dbd3:57ef:a88c:c782

12:55:25 daemon.info dhcpcd[289]: wlan0: carrier acquired
12:55:25 daemon.info dhcpcd[289]: wlan0: IAID eb:1c:5b:93
12:55:25 daemon.info dhcpcd[289]: wlan0: adding address fe80::314c:5853:cd9c:11c3
12:55:25 daemon.info dhcpcd[289]: wlan0: soliciting a DHCP lease

12:55:26 daemon.info dhcpcd[289]:                                              eth0: soliciting an IPv6 router
12:55:26 daemon.info dhcpcd[289]:                                              eth0: rebinding lease of 192.168.1.10
12:55:26 daemon.info dhcpcd[289]:                                              eth0: probing address 192.168.1.10/24

12:55:26 daemon.info dhcpcd[289]: wlan0: soliciting an IPv6 router
12:55:26 daemon.info dhcpcd[289]: wlan0: offered 192.168.1.3 from 192.168.1.1
12:55:26 daemon.info dhcpcd[289]: wlan0: probing address 192.168.1.3/24

12:55:31 daemon.info dhcpcd[289]: wlan0: leased 192.168.1.3 for 600 seconds
12:55:31 daemon.info dhcpcd[289]: wlan0: adding route to 192.168.1.0/24
12:55:31 daemon.info dhcpcd[289]: wlan0: adding default route via 192.168.1.1

12:55:32 daemon.info dhcpcd[289]:                                              eth0: leased 192.168.1.10 for 600 seconds
12:55:32 daemon.info dhcpcd[289]:                                              eth0: adding route to 192.168.1.0/24
12:55:32 daemon.info dhcpcd[289]:                                              eth0: adding default route via 192.168.1.1

12:55:38 daemon.warning dhcpcd[289]:                                           eth0: no IPv6 Routers available
12:55:38 daemon.warning dhcpcd[289]: wlan0: no IPv6 Routers available

FILES

     /etc/dhcpcd.conf 
     /etc/dhcpcd.duid               DUID used to identify the host.  
     /etc/dhcpcd.secret             secret key known only to the host.  
     /lib/dhcpcd/dhcpcd-run-hooks   Bourne shell script that is run to configure or de-configure an interface.  
     /lib/arm-linux-gnueabihf/dhcpcd/dev management modules.  
     /lib/dhcpcd/dhcpcd-hooks 

     /var/lib/dhcpcd5/dhcpcd-interface-ssid.lease actual DHCP message sent by the server.
          used when reading the last lease and use the files mtime as when it was issued.  
     /var/lib/dhcpcd5/dhcpcd-interface-ssid.lease6 

     /var/lib/dhcpcd5/dhcpcd-rdm.monotonic counter used in the replay field in Authentication Options.  
     /var/run/dhcpcd.pid            PID of dhcpcd running on all interfaces.  
     /var/run/dhcpcd-interface.pid  PID of dhcpcd running on the interface.

     /var/run/dhcpcd.sock            Control socket to the master daemon.

     /var/run/dhcpcd.unpriv.sock     Unpriviledged socket to the master daemon, only for state retrieval.  
     /var/run/dhcpcd-interface.sock Control socket to per interface daemon.
dhcpcd is also an implementation of BOOTP client specified in RFC 951.
IPv6 Router Solicitor as specified in RFC 4861 and RFC 6106.
IPv6 Privacy Extensions to AutoConf as specified in RFC 4941. needs to be enabled in the kernel DHCPv6 client as specified in RFC 3315.
By default, dhcpcd only starts DHCPv6 when instructed by an IPV6 Router Advertisement. If no Identity Association is configured, then a Non-temporary Address is requested. Interfaces are preferred by carrier, DHCP lease/IPv4LL and then lowest metric. For systems that support route metrics, each route will be tagged with the metric, otherwise dhcpcd changes the routes to use the interface with the same route and the lowest metric. See options below for controlling which interfaces we allow and deny through the use of patterns.
 2/13/24 Linux dapi2 5.10.103+ #1529 Tue Mar 8 12:19:18 GMT 2022 armv6l GNU/Linux
> cat /etc/os-release
Raspbian GNU/Linux 10 (buster)

 dapi2:/etc/dhcp > dhcpcd --version
dhcpcd 8.1.2
Copyright (c) 2006-2019 Roy Marples
Compiled in features: INET ARP ARPing IPv4LL INET6 DHCPv6 AUTH
answer:/home/dgerman > cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
answer:/home/dgerman > dhcpcd --version
dhcpcd 8.1.2
Copyright (c) 2006-2019 Roy Marples
Compiled in features: INET ARP ARPing IPv4LL INET6 DHCPv6 AUTH
answer:/home/dgerman > dhcpd --version                      aptitude ?
-bash: dhcpd: command not found

See

fnmatch(3), if_nametoindex(3), dhcpcd.conf(5), resolv.conf(5), dhcpcd-run-hooks(8), resolvconf(8)

/etc/syslog.conf : local0.* /var/log/dhcpcd.log
and refresh syslogd daemon: kill -1 `cat /var/run/syslogd.pid`


DHCPD

Dynamic Host Configuration Protocol DEAMON

dhcpd [-knrCRSY] [-L ConfigDir] [-c ExecFilePath] [-s[ipaddr]] [-G[gateway]] [-w windowsize] interface

Runs in background(server) and sets configuration OR
sends commands to the server.

interface network interface. Default eth0
-L ConfigDir ConfigDir instead of /etc/dhcpc
-c ExecFilePath Uses ExecFilePath instead of ConfigDir/dhcpcd.exe
-T script Test case. Goes through the DHCP negotiation sequence but doesn't configure the interface.
Uses ConfigDir/dhcpcd.exe scripts.
Writes ConfigDir/dhcpcd-interface.info and ConfigDir/dhcpcd-interface.cache.
-B Requests broadcast .
-n Send SIGALRM to renew the lease, if not running the startup procedure.
-H hostname Set hostname option supplied by DHCP server. By default don't set hostname
-D Set domainname as supplied by DHCP server. Default don't set domainname
-Y Don't replace /etc/yp.conf . Domainname is not updated unless -D is specified.
-R Don't replace /etc/resolv.conf
-N Don't replace existing /etc/ntp.conf
-h hostname Use hostname for option field when sending messages.
-i vendorClassID vendor class identifier .
-I ClientID client identifier . Default MAC address
-l leasetime Suggest lease time (seconds) to the server. (server can override this ).
Used in the DHCP_DISCOVER message. The default is infinite (0xFFFFFFFF).
-G [gateway] gateway address for default route.
Without gateway no Default routes are installed.
-s [ipaddr] Send DHCP_INFORM to server using ipaddr in the form xxx.xxx.xxx.xxx.
Without ipaddr, uses the address currently assigned to the interface.
If no address is assigned, use previously obtained address from ConfigDir/dhcpcd-interface.cache
-S Send second DHCP_DISCOVER after receiving DHCP_OFFER
-k Sends SIGHUP to the running dhcpcd which sends DCHP_RELEASE to the server and destroys its cache.
SIGTERM used by shutdown will not send DHCP_RELEASE and will not destroy cache.
After the system boots cache is used to request the same address from server.
-r Makes dhcpcd RFC1541 (obsolete) compliant. is RFC2131 compliant otherwise.
-C Checksum received packets.
-w windowsize window size for the gateway route. Default=32768.

Become server

-t timeout Seconds to wait for an IP address. default 60 .
Forks to background after getting an address and becomes the server
If timeout expires returns 1.

FILES

/etc/dhcpc Default ConfigDir directory used for storing files See -L ConfigDir.
ConfigDir/dhcpcd-interface.info host information.
ConfigDir/dhcpcd-interface.pid Contains the process id
ConfigDir/dhcpcd.exe Scripts to execute when it configures or brings down the interface.
Parameters passed to dhcpcd.exe script:
  1. dhcpcd.exe HostInfoFilePath HostInfoFilePath is path to dhcpcd-interface.info. interface is the interface name dhcpcd is attached to.
  2. up|down|new The interface has been brought up with the same address, with a new IP address or brought down.
  3. -d is passed if started with -d debug
ConfigDir/dhcpcd-interface.cache contains the previously assigned IP address etc. interface is the network interface name for example: eth0 to which dhcpcd is attached.
/etc/resolv.conf Created when the client receives DNS and domain name options after renaming the old file to /etc/resolv.conf.sv and restored when dhcpcd exits for any reason.
/etc/yp.conf created when the client receives NIS options. … and restored when dhcpcd exits for any reason.
/etc/ntp.conf created when the client receives <>b>NTP options. The old file is renamed to /etc/ntp.conf.sv

See

Dynamic Host Configuration Protocol, RFC2131 and RFC1541 (obsolete)
DHCP Options and BOOTP Vendor Extensions, RFC2132


Examples

sudo dhcpcd -d 
sending commands to master dhcpcd process
send OK

01-test 
# Echo the interface flags, reason and message options

if [ "$reason" = "TEST" ]; then
    set | grep "^\(interface\|pid\|reason\|profile\|skip_hooks\)=" | sort
    set | grep "^if\(carrier\|flags\|mtu\|wireless\|ssid\)=" | sort
    set | grep "^\(new_\|old_\|nd[0-9]*_\)" | sort
    exit 0
fi

reformatted
sudo dhcpcd --test --debug
dhcpcd-6.11.5 starting
wlan0: IPv6 kernel autoconf disabled
DUID 00:01:00:01:21:b0:de:59:b8:27:eb:0f:cf:06
wlan0: IAID eb:1c:5b:93
wlan0: delaying IPv6 router solicitation for 1.0 seconds         wlan0: delaying IPv4 for 0.5 seconds
wlan0: using ClientID 01:b8:27:eb:1c:5b:93
wlan0: reading lease `/var/lib/dhcpcd5/dhcpcd-wlan0-disabled.lease'
wlan0: rebinding lease of 192.168.1.3
wlan0: sending REQUEST (xid 0x14488837), next in 3.6 seconds
wlan0: acknowledged 192.168.1.3 from 192.168.1.1
wlan0: leased 192.168.1.3 for 3600 seconds

wlan0: executing `/lib/dhcpcd/dhcpcd-run-hooks' TEST
interface='wlan0'        pid='32063'         reason='TEST'       ifcarrier='up'      ifflags='4163'  ifmtu='1500'

ifssid='disabled'        ifwireless='1'

rearranged, no changes:
new_broadcast_address='192.168.1.255'            new_dhcp_lease_time='3600'                 new_domain_search='germans'
old_broadcast_address='192.168.1.255'            old_dhcp_lease_time='3600'
new_dhcp_message_type='5'                        new_dhcp_server_identifier='192.168.1.1'   new_routers='192.168.1.1'
new_domain_name='germans'                        new_domain_name_servers='192.168.1.1'           
new_ip_address='192.168.1.3'                     new_network_number='192.168.1.0'                
new_subnet_cidr='24'                             new_subnet_mask='255.255.255.0' 

dhcpcd exited

sudo dhcpcd -T    Less detail than with --debug
DUID 00:01:00:01:24:9e:78:19:b8:27:eb:f0:ae:08
eth0: IAID eb:f0:ae:08
eth0: rebinding lease of 192.168.1.14
eth0: soliciting an IPv6 router
eth0: leased 192.168.1.14 for 3420 seconds

interface='eth0'     pid='9112' protocol='dhcp' reason='TEST' ifcarrier='up'        ifflags='4163'   ifmtu='1500'
ifwireless='0' 

/etc

dhcpcd.duid
rc5.d/S01dhcpcd
rc2.d/S01dhcpcd
rc4.d/S01dhcpcd
rc1.d/K01dhcpcd
systemd/system/multi-user.target.wants/dhcpcd.service
systemd/system/dhcpcd5.service
init.d/dhcpcd
dhcp
dhcpcd.conf
rc0.d/K01dhcpcd
dhcpcd.secret
rc3.d/S01dhcpcd
rc6.d/K01dhcpcd
alternatives/dhcpcd.8.gz
alternatives/dhcpcd


dhcpcd.conf

dhcpcd configuration file

Although 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 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.
Escape characters in the value using the \ character.
Comments can be prefixed with the # character.
String values should be quoted with the " character.
debug Echo debug messages to the stderr and syslog.
background Background immediately.
For startup scripts which don't disable link messages for carrier status.
logfile logfile Writes to logfile rather than syslog.
Truncated when opened and is reopened when receives SIGUSR2
controlgroup group Sets the group ownership of /var/run/dhcpcd.sock
bootp Be a BOOTP client, don't send a DHCP Message Type option and only interact with a BOOTP server. Other options still available.
persistent Supresses 'De-configuring' on exit.

Restrict Configuration

ipv4only Only configure IPv4
ipv6only Only confgiure IPv6.
nodhcp Don't start DHCP    or listen to DHCP messages. Useful when allowing IPv4LL.
nodhcp6 Don't start DHCPv6 or listen to DHCPv6 messages. Normally DHCPv6 is started by a RA instruction or configuration.
allowinterfaces patternList patternList a space or comma separated list .
Only interfaces that match.
denyinterfaces superceeds.
-Z
--denyinterfaces patternList
Only interfaces that do not match
broadcast broadcast replies back to the client.
blacklist address[/cidr] Ignores all packets from address[/cidr].
whitelist address[/cidr] Only accept packets from address[/cidr]. blacklist is ignored if whitelist is set.

Per interface

interface interface Subsequent options are only parsed for this interface.
dhcp Enable DHCP   , on by default.
dhcp6 Enable DHCPv6 , on by default.
noipv4 Enable IPv4 , on by default.
noipv6 Enable IPv6 , on by default.
arping address [address] dhcpcd will arping each address in order before DHCP.
If an address is found, the replying hardware address as the profile, otherwise the ip address. Example:
 
                   interface bge0
                   arping 192.168.0.1

                   # My specific 192.168.0.1 network
                   profile dd:ee:aa:dd:bb:ee
                   static ip_address=192.168.0.10/24

                   # A generic 192.168.0.1 network
                   profile 192.168.0.1
                   static ip_address=192.168.0.98/24 
noarp Don't send any ARP requests. This also disables IPv4LL.
leasetime seconds
metric metric default metric is 200 + if_nametoindex(3) + (100 for wireless interfaces).
Metrics are used to prefer an interface over another one, lowest wins.
authprotocol protocol algorithm rdm Authenticate DHCP messages. See the Supported Authentication Protocols section.
authtoken secretid realm expire key Define a shared key for use in authentication.
realm can be to for use with the delayed prptocol.
expire date the token expires formatted "yyy-mm-dd HH:MM" or forever
For the token protocol, secretid must be 0 and realm "".
Error: dhcp_auth_encode: Invalid argument means the correct authentication token was not found in the configuration.
dev value Load the value /dev management module. dhcpcd will load the first one found to work, if any.
env value Push value to the environment for use in dhcpcd-run-hooks(8).
For example set which driver wpa_supplicant(8) should use with env wpa_supplicant_driver=nl80211

To force the hostname hook to set the hostname use env force_hostname=YES,
If the hostname is set, it will be will set to the FQDN .
If the FQDN option is missing, dhcpcd will set a FQDN from the hostname and domain options for consistency. To override this set env hostname_fqdn=[YES|NO|SERVER].
A value of server means what the server provides. 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.

clientid string 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 send a default clientid of the hardware family and the hardware address.
duid Generate an RFC 4361. compliant DHCP Unique Identifier.
If persistent storage is available then a DUID-LLT (link local address + time) is generated, otherwise DUID-LL is generated (link local address). This, plus the IAID will be used as the clientid. The DUID-LLT generated will be held in /etc/dhcpcd.duid and should not be copied to other hosts.
iaid iaid Set the Interface Association Identifier. Must be used in an interface block. defaults to the last 4 bytes of the hardware address assigned to the interface.
Eachs instance of this should be unique within the scope of the client and dhcpcd warns if a conflict is detected. If there is a conflict, it is only a problem if the conflicted IAIDs are used on the same network.
request [address] Request the address in a DHCP DISCOVER message.
There is no guarantee the DHCP server will give it.
If no address is given then the first address currently assigned to the interface is used.
inform [address[/cidr]] Like request, but sends a DHCP INFORM instead of DISCOVER/REQUEST.
This does not get a lease rather notifies the DHCP server of the address in use. include the optional cidr network number in case the address is not already configured on the interface.
Performs as if it has an infinite lease and 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.
inform6 Performs a DHCPv6 Information Request. No address is requested or specified, but all other DHCPv6 options are allowed. This is normally performed automatically when the IPv6 Router Advertises that the client should perform this operation. This option is only needed when dhcpcd is not processing IPv6RA messages and the need for DHCPv6 Information Request exists.
fallback profile Fallback to using this profile if DHCP fails. This allows you to configure a static profile instead of using Zero-Conf.
hostname name Sends the hostname so it can be registered in DNS.
If name is an empty, the system hostname is sent.
If name is a FQDN (ie, contains a .) then it will be encoded as such.
hostname_short Sends the short hostname to the DHCP server instead of the FQDN.
Useful because DHCP servers will not register the FQDN in their DNS if the domain part does not match theirs.

see env to control how the hostname is set on the host.

ia_na [iaid [/ address]] Request a DHCPv6 Normal Address for iaid. more than one ia_na by specifying a unique iaid for each one.
ia_ta [iaid] Request a DHCPv6 Temporary` Address for iaid.
ia_pd [iaid [/ prefix / prefix_len] [interface [/ sla_id [/ prefix_len [/ suffix]]]]] Request a DHCPv6 Delegated Prefix for iaid. Must be used in an interface block.
Unless a sla_id of 0 is assigned with the same resultant prefix length as the delegation, a reject route is installed for the Delegated Prefix to stop unallocated addresses being resolved upstream.
If no interface is given then we will assign a prefix to every other interface with a sla_id equivalent to the interface index assigned by the OS.
Otherwise addresses are only assigned for each interface and sla_id. Each assigned address will have a suffix, defaulting to 1.
If the suffix is 0 then a slaac address is assigned.
You cannot assign a prefix to the requesting interface unless the DHCPv6 server supports RFC6603 Prefix Exclude Option.
dhcpcd has to be running for all the interfaces it is delegating to.
A default prefix_len of 64 is assumed, unless the maximum sla_id does not fit. In this case prefix_len is increased to the highest multiple of 8 that can accommodate the sla_id. sla_id is an integer which must be unique inside the iaid and is added to the prefix which must fit inside prefix_len less the length of the delegated prefix. You can specify multiple interface / sla_id / prefix_len per ia_pd, space separated.
IPv6RS should be disabled globally when requesting a Prefix Delegation.

    In the following example
  • eth0 is configured for both IPv4 and IPv6.
    The DHCPv4 server will provide an IPv4 address and a default route.
    The DHCPv6 server will provide an IPv6 address, a default route and a /64 subnet to be delegated to the internal interface.
  • eth1 will be configured for IPv6 using the first address (::1) from the delegated prefix.
  • Two other interfaces will be assined a second prefix to rtadvd(8) can be used with an empty configuration file on eth1, eth2 and eth3, to provide automatic IPv6 address configuration for the internal network.
             noipv6rs                 # disable routing solicitation
             denyinterfaces eth2      # Don't touch eth2 at all
             interface eth0
               ipv6rs                 # enable routing solicitation get the default IPv6 route
               ia_na 1                # request an IPv6 address
               ia_pd 2 eth1/0         # request a PD and assign it to eth1
               ia_pd 3 eth2/1 eth3/2  # req a PD and assign it to eth2 and eth3
fqdn [
 disable |
 ptr |
 both]

disable will disable the FQDN option.
ptr reqeusts the DHCP server to update the PTR record of the host in DNS
both also updates the A record.
The default is both.

ipv6ra_autoconf Generate SLAAC addresses for each Prefix advertised by a Router Advertisement message with the Auto flag set. On by default.
ipv6ra_noautoconf
ipv6ra_fork Always fork to background on an RA.
By default, when dhcpcd receives an IPv6 RA, forks to the background if the RA contains at least one unexpired RDNSS option and a valid prefix or no DHCPv6 instruction.
ipv6ra_own Disables kernel IPv6 RAprocessing so dhcpcd can manage addresses and routes.
ipv6ra_own_default When dhcpcd receives an IPv6 RA, 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.
ipv6rs Enables IPv6 RA solicitation. On by default, unless disabled globally.
noalias IPv4 addresses will be removed from the interface when adding a new IPv4 address.
noauthrequired Don't require authentication including for FORCERENEW and RECONFIGURE
nodelay Don't delay for an initial randomised time when starting protocols.
nodev Don't load /dev management modules.
nogateway don't Install a default route (default).
nohook script Don't run this hook script. Matches full name, or prefixed with 2 numbers optionally ending with .sh
. So to stop dhcpcd from modifying DNS settings or starting wpa_supplicant use nohook resolv.conf, wpa_supplicant
noipv4ll Don't to obtain an IPv4LL address if failed to get one via DHCP. See RFC 3927.
noipv6rs Disable solicitation and receipt of IPv6 Router Advertisements.
nolink Don't receive link messages about carrier status. only set this for buggy interface drivers.
noup Don't bring the interface up when in master mode. If dhcpcd.conf cannot determine the carrier state, dhcpcd.conf will enter a tight polling loop until the interface is marked up and running or a valid carrier state is reported.
option option[ Requests the option from the server. It can be a variable to be used in dhcpcd-run-hooks(8) or the numerical value.
You can specify more options separated by commas, spaces or more option lines.
option Prepend dhcp6_ to option to request a DHCPv6 option. If no DHCPv6 options are configured, then DHCPv4 options are mapped to equivalent DHCPv6 options.

Prepend nd_ to option to handle ND options, only for the nooption, reject and require options.

To list options use dhcpcd with the -V, --variables argument.

nooption option Remove the option from the message before it's processed.
require option option is required in all messages, otherwise the message is ignored.
To enforce that dhcpcd only responds to DHCP servers and not BOOTP servers, require dhcp_message_type. a BOOTP server can send DHCP like options.
reject option Reject a message that contains option. Useful when you cannot use require to select / de-select BOOTP messages.
destination option If dhcpcd.conf detects an address added to a point-to-point interface (PPP, TUN, etc) it will set the options to the destination address of the interface.
profile name Subsequent options are only parsed for this profile name.
ssid ssid Subsequent options are only parsed for this wireless ssid.
reboot seconds Allow seconds before moving to the DISCOVER phase with an old lease to use and moving from DISCOVER to IPv4LL if no reply. The default is 5 seconds.
0 causes dhcpcd to skip the REBOOT phase and go into DISCOVER.
release releases the lease prior to stopping the interface.
script script default /lib/dhcpcd/dhcpcd-run-hooks.
slaac [hwaddr | private] interface identifier used for SLAAC generated IPv6 addresses.
For private is used, a RFC7217 address is generated.
static value Configures a static value.
For ip6_address, dhcpcd will continue auto-configuation as normal.

Example which configures two static address, an IPv4 router, DNS server and disables IPv6 auto-configuration. Use inform6 to obtain more information via DHCPv6.
For IPv4 use the inform ipaddress option instead of setting a static address.

              interface eth0
                   noipv6rs
                   static ip_address=192.168.0.10/24
                   static ip6_address=fd51:42f8:caae:d92e::ff/64
                   static routers=192.168.0.1
                   static domain_name_servers=192.168.0.1 fd51:42f8:caae:d92e::1 
Example for PPP which gives the destination a default route. It uses destination to insert the destination address into the value.
 interface ppp0
                   static ip_address=
                   destination routers 
timeout seconds default 30. (don't use 0 which would causes dhcpcd to wait forever to get a lease.)
If working on a single interface exits when a timeout occurs, otherwise fork into the background.
With IPv4LL start the IPv4LL process after the timeout and then waits longer before really timing out.
userclass string Tag the DHCPv4 messages with the userclass. can be specifed more than once.
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.

                   vendor 01,192.168.0.2            # Set the vendor option 01 with an IP address.
                   vendor 02,01:02:03:04:05         # Set the vendor option 02 with a hex code.
                   vendor 03,\"192.168.0.2\"        # Set the vendor option 03 with an IP address as a string.
                   vendor ,"hello world"            # Set un-encapsulated vendor option to hello world.

     
vendorclassid string Set the DHCP Vendor Class. DHCPv6 has it's own option as shown below. The default is dhcpcd-version:os:machine:platform>. For example
dhcpcd-5.5.6:NetBSD-6.99.5:i386:i386
             If not set then none is sent.  Some DHCP servers reject unknown vendorclassids.  To work around it,
             try using the MSFT vendorclassid.

     
vendclass en data Add the DHCPv6 Vendor Indetifying Vendor Class with the IANA assigned Enterprise Number en with the data. This option can be set more than once to add more data, the behaviour, is undefined if the Enterprise Number differs.
waitip [4 | 6] Wait for an address before forking to the background.
Default any, 4 an IPv4 address , 6 an IPv6 address .
Multiples are permitted
xidhwaddr Use last four bytes of the hardware address as the DHCP xid instead of a random number.
quiet Suppress output except errors.

Defining new options

DHCP, ND and DHCPv6 allow for the use of custom options. Each option needs to be started with define, infinity or define6, optionally be followed by both embed or encap. If both are specified embed must come before encap.
define code type variable exported to dhcpcd-run-hooks(8).
definend code type variable " … " with a prefix of _nd.
define6 code type variableDHCPv6 prefix of _dhcp6.
vendopt code type variable Defines the Vendor-Identifying Vendor Options. The code is the IANA Enterprise Number which will unqiuely describe the encapsulated options. type is normally encap variable names the Vendor option to be exported.
embed type variable within the defined option. If the variable is not the same as defined in the parent option, it is prefixed with the parent variable first with an underscore. If the variable has the name of reserved then it is not processed.
encap code type variable within the defined option. If the variable is not the same as defined in the parent option, it is prefixed with the parent variable first with an underscore.

Type prefix

These keywords come before the type they must appear in the order listed.
request Requests the option by default without having to be specified in user configuration
norequest This option cannot be requested, regardless of user configuration
optional This option is optional. Only makes sense for embedded options where like the client FQDN option where the FQDN string itself is optional.
index The option can appear more than once and will be indexed.
array The option data is split into a space separated array, each element being the same type.

The type defines the data consumed, remaining data is discarded.

ipaddress An IPv4 address, 4 bytes.
ip6address An IPv6 address, 16 bytes.
string [: length] A NVT ASCII string of printable characters.
byte A byte.
bitflags: flags A byte represented as a string of flags, most significant bit first.
For example, using ABCDEFGH then A would equal 10000000, B 01000000, C 00100000, etc.
If the bit is not set, the flag is not printed.
A flag of 0 is not printed even if the bit postition is set.
This is to allow reservation of the first bits while assinging the last bits.
int16 A signed 16bit integer, 2 bytes.
uint16 An unsigned 16bit integer, 2 bytes.
int32 A signed 32bit integer, 4 bytes.
uint32 An unsigned 32bit integer, 4 bytes.
flag A fixed value (1) to indicate that the option is present, 0 bytes.
domain A RFC 3397 encoded string.
dname A RFC 1035 validated string.
binhex [: length] Binary data expressed as hexadecimal.
embed Contains embedded options (implies encap as well).
encap Contains encapsulated options (implies embed as well).
option References an option from the global definition.
Example definition
 # DHCP option 81, Fully Qualified Domain Name, RFC4702
           define 81 embed fqdn
           embed byte flags
           embed byte rcode1
           embed byte rcode2
           embed domain fqdn

           # DHCP option 125, Vendor Specific Information Option, RFC3925
           define 125 encap vsio
           embed uint32 enterprise_number
           # Options defined for the enterprise number
           encap 1 ipaddress ipaddress 

Supported Authentication Protocols

token Sends and expects the token with the secretid 0 and realm of "" in each message.
delayedrealm Delayed Authentication. dhcpcd will send an authentication option with no key or MAC. The server will see this option, and select a key for dhcpcd.conf, writing the realm and secretid in it. dhcpcd will then look for a non- expired token with a matching realm and secretid. This token is used to authenicate all other messages.
delayed Same as above, but without a realm.

Supported Authentication Algorithms

If none specified, hmac-md5 is the default. hmac-md5

Supported Replay Detection Mechanisms

monotime
monotonic
Create a NTP timestamp from the system time.
none If this is changed or the means of calculating or storing it is broken
the DHCP server will have its notion of the clients Replay Detection Value
monocounter Read the number in /var/lib/dhcpcd5/dhcpcd-rdm.monotonic and add one to it.

SEE ALSO fnmatch(3), if_nametoindex(3), dhcpcd(8), dhcpcd-run-hooks(8)


/etc/resolv.conf

# Generated by resolvconf
domain outfamily
nameserver 192.168.1.1

/etc/dhcpcd.conf

Distributed
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# Most distributions have NTP support.
#option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private

# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1

# It is possible to fall back to a static IP if DHCP fails:
# define static profile
#profile static_eth0
#static ip_address=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0

See mac OS ifconfig