From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Dhcpcd and the translation is 33% complete.

Dynamic Host Configuration Protocol Client Daemon (net-misc/dhcpcd) is a popular DHCP client capable of handling both IPv4 and IPv6 configuration.


Flagi USE

USE flags for net-misc/dhcpcd A fully featured, yet light weight RFC2131 compliant DHCP client

debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
embedded Embed the definitions of dhcp options in the dhcpcd executable
ipv6 Add support for IP version 6
privsep Enable support for privilege separation
udev Enable virtual/udev integration (device discovery, power and storage device support, etc)


Użyj następującej komendy, by zainstalować dhcpcd:

root #emerge --ask net-misc/dhcpcd



All dhcpcd configuration can be set in the /etc/dhcpcd.conf file, but for most installations dhcpcd will work out of the box presuming most computers nowadays are behind a router or access point running a DHCP server. Though man 5 dhcpcd.conf[1] will be helpful in case advanced configuration is required.

Static IP addresses

In case the network interface card should be configured with a static IP address, add their data to /etc/dhcpcd.conf.[1] The following is an example of manually adding a static address, routes, and DNS by editing DHCPCD's configuration file using a text editor of choice:

FILE /etc/dhcpcd.conf
static ip_address=
static routers=
static domain_name_servers=

IPv6 Prefix Request

FILE /etc/dhcpcd.confRequest a prefix for eth0.lan to be routed publicly with eth0.wan.
# Disable router solicitations for all interfaces, enable only for selected ones
# Interface configuration for the ''wan'' vlan on the ''eth0'' interface
interface eth0.wan
  # Enable router solicitation for this interface
  # Request a normal address usins ''iaid'' 1 for interface ''eth0.wan''
  ia_na 1
  # Request a prefix using ''iaid'' 2 and assign it to the ''eth0.lan'' interface using ''sla_id'' 0
  ia_pd 2 eth0.lan/0



root #dhcpcd --help
usage: dhcpcd	[-146ABbDdEGgHJKLMNPpqTV]
		[-C, --nohook hook] [-c, --script script]
		[-e, --env value] [-F, --fqdn FQDN] [-f, --config file]
		[-h, --hostname hostname] [-I, --clientid clientid]
		[-i, --vendorclassid vendorclassid] [-j, --logfile logfile]
		[-l, --leasetime seconds] [-m, --metric metric]
		[-O, --nooption option] [-o, --option option]
		[-Q, --require option] [-r, --request address]
		[-S, --static value]
		[-s, --inform address[/cidr[/broadcast_address]]]
 [--inform6]		[-t, --timeout seconds] [-u, --userclass class]
		[-v, --vendor code, value] [-W, --whitelist address[/cidr]] [-w]
		[--waitip [4 | 6]] [-y, --reboot seconds]
		[-X, --blacklist address[/cidr]] [-Z, --denyinterfaces pattern]
		[-z, --allowinterfaces pattern] [--inactive] [interface] [...]
       dhcpcd	-n, --rebind [interface]
       dhcpcd	-k, --release [interface]
       dhcpcd	-U, --dumplease interface
       dhcpcd	--version
       dhcpcd	-x, --exit [interface]

Uruchom jako usługę

One-time DHCP

To configure a network interface for one-time DHCP use issue the following command:

root #dhcpcd eth0

Be sure to replace eth0 in the command above with the appropriate network interface name.

Renew a lease

To renew the lease on eth0, --rebind or -n can be used:

root #dhcpcd -n eth0

Release a lease

To release a lease on eth0, --release or -k can be used:

root #dhcpcd -k eth0

Rozwiązywanie problemów

Zobacz również

External resources


  1. 1.0 1.1 Roy Marples. DHCPCD.CONF(5), Roy Marples's personal blog, March 9th, 2015. Retrieved on May 07th, 2015.