dhcpcd
D ynamic H ost C onfiguration P rotocol C lient D aemon ( net-misc/dhcpcd ) は、IPv4 と IPv6 の両方の構成に対応し、幅広く利用されている DHCP クライアントです。
インストール
USE フラグ
USE flags for net-misc/dhcpcd A fully featured, yet light weight RFC2131 compliant DHCP client
+embedded
|
Embed the definitions of dhcp options in the dhcpcd executable |
+udev
|
Enable virtual/udev integration (device discovery, power and storage device support, etc) |
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 |
ipv6
|
Add support for IP version 6 |
privsep
|
Enable support for privilege separation |
Emerge
dhcpcd をインストールするコマンドです:
root
#
emerge --ask net-misc/dhcpcd
設定
ファイル
dhcpcd のすべての設定は /etc/dhcpcd.conf ファイルで変更できますが、最近では大半のコンピューターが DHCP サーバーを備えたルーターやアクセスポイントの内側に設置されていることを考えると、設定を行わなくても動作する環境がほとんどでしょう。もしも高度な設定が必要になる場合には、 man 5 dhcpcd.conf [1] が役立ちます。
静的 IP アドレス
ネットワークカードを 静的 IP アドレス で構成する必要がある場合には、カードのデータを /etc/dhcpcd.conf の書き込んでください。 [1] 以下の例では、静的アドレス・ルート・DNS を、dhcpcd の設定ファイルを編集して手動で追加しています。
/etc/dhcpcd.conf
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
IPv6 Prefix Request
/etc/dhcpcd.conf
Request a prefix for
eth0.lan
and
eth0.management
to be routed publicly with
eth0.wan
.
# Disable router solicitations for all interfaces, enable only for selected ones
noipv6rs
# Interface configuration for the wan vlan on the eth0 interface
interface eth0.wan
# Enable router solicitation for this interface
ipv6rs
# 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 and prefix size of 64
ia_pd 2 eth0.lan/0/64
# Request a prefix using iaid 3 and assign it to the eth0.management interface using sla_id 0 and prefix size of 64
ia_pd 3 eth0.management/0/64
使い方
呼び出し
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]
サービスとして実行する
Network management using DHCPCD を参照してください。
手動で dhcpcd を開始する
dhcpd は特定のインターフェースに対して手動で起動することができます。例えば enp1s0 に対しては:
root
#
dhcpcd enp1s0
上記のコマンド中の
enp1s0
を、適当なネットワークインターフェイス名に置き換えるようにしてください。
リースを更新する
enp1s0 上のリースを更新するには、 --rebind または -n を使用することができます:
root
#
dhcpcd -n enp1s0
リースを解放する
enp1s0 上のリースを解放するには、 --release または -k を使用することができます:
root
#
dhcpcd -k enp1s0
トラブルシューティング
- dhcpcd not working for IPv6 (#CONFIG_PACKET is not set)
- もし /etc/resolv.conf が VPN の DNS で更新されない場合は、 net-dns/openresolv をインストールすることを考慮してください。
関連項目
- ネットワークインターフェイスへの対処についての、ハンドブックのアドバイス
- Netifrc — Gentoo's default framework for configuring and managing network interfaces on systems running OpenRC .
- Network management using DHCPCD — 完全なネットワークスタック管理のために dhcpcd を用いる方法を解説しています。
外部資料
- Dhcpcd についての Arch Wiki の記事
- Forums post: No Internet access when update to dhcpcd 6.10.0
- DHCP on Wikipedia
- RFC 2131 - Dynamic Host Configuration Protocol
参照
- ↑ 1.0 1.1 DHCPCD.CONF(5) , Roy Marples's personal blog , March 9th, 2015. Retrieved on May 07th, 2015.