我使用 Linux 主機作為 IPv4 路由器,並研究啟用 IPv6(有人告訴我,這是未來)。我已經使用dhcpcd
dhcpv4 客戶端從 ISP 取得位址,所以我想我也可以將它用於 dhcpv6。
不幸的是,雖然我可以看到dhcpcd
發送請求訊息並且可以看到 dhcpv6 伺服器回應 2x dhcpv6 廣告訊息,但我沒有看到dhcpcd
發送 dhcpv6 請求。
我看到以下三個訊息序列重複 3 次,然後dhcpcd
超時:
15:41:06.457440 IP6 (flowlabel 0x1e0d7, hlim 1, next-header UDP (17) payload length: 152) fe80::aaaa:aaaa:aaaa:aaaa.dhcpv6-client > ff02::1:2.dhcpv6-server: [udp sum ok] dhcp6 solicit (xid=bc3d12 (client-ID type 4) (elapsed-time 0) (vendor-class) (rapid-commit) (IA_NA IAID:403318227 T1:0 T2:0) (Client-FQDN) (reconfigure-accept) (option-request DNS-server DNS-search-list Client-FQDN opt_82 opt_83))
15:41:07.168805 IP6 (class 0x48, hlim 56, next-header UDP (17) payload length: 140) 2001:558:4082:7f::1.dhcpv6-server > fe80::aaaa:aaaa:aaaa:aaaa.dhcpv6-client: [udp sum ok] dhcp6 advertise (xid=bc3d12 (client-ID type 4) (server-ID hwaddr/time type 1 time 493924036 40a8f0347664) (IA_NA IAID:403318227 T1:1800 T2:2880 (IA_ADDR 2001:558:600a:7f:bbbb:bbbb:bbbb:bbbb pltime:3600 vltime:3600)) (reconfigure-accept) (DNS-server cdns01.comcast.net cdns02.comcast.net) (Client-FQDN))
15:41:07.168912 IP6 (class 0x48, hlim 56, next-header UDP (17) payload length: 140) 2001:558:4082:7f::1.dhcpv6-server > fe80::aaaa:aaaa:aaaa:aaaa.dhcpv6-client: [udp sum ok] dhcp6 advertise (xid=bc3d12 (client-ID type 4) (server-ID hwaddr/time type 1 time 493924036 40a8f0347664) (IA_NA IAID:403318227 T1:1800 T2:2880 (IA_ADDR 2001:558:600a:7f:bbbb:bbbb:bbbb:bbbb pltime:3600 vltime:3600)) (reconfigure-accept) (DNS-server cdns01.comcast.net cdns02.comcast.net) (Client-FQDN))
Mar 14 15:41:05 router dhcpcd[126860]: DUID ...
Mar 14 15:41:05 router dhcpcd[126860]: enp8s0: IAID 18:0a:25:d3
Mar 14 15:41:05 router dhcpcd[126860]: enp8s0: adding address fe80::aaaa:aaaa:aaaa:aaaa
Mar 14 15:41:05 router dhcpcd[126860]: enp8s0: soliciting an IPv6 router
Mar 14 15:41:06 router dhcpcd[126860]: enp8s0: Router Advertisement from fe80::2aa:bbff:fecc:102
Mar 14 15:41:06 router dhcpcd[126860]: enp8s0: no global addresses for default route
Mar 14 15:41:06 router dhcpcd[126860]: enp8s0: soliciting a DHCPv6 lease
Mar 14 15:41:35 router dhcpcd[126860]: timed out
Mar 14 15:41:35 router dhcpcd[126860]: dhcpcd exited
$ cat /proc/sys/net/ipv6/conf/enp8s0/autoconf
1
$ cat /proc/sys/net/ipv6/conf/enp8s0/accept_ra_pinfo
1
$ cat /proc/sys/net/ipv6/conf/enp8s0/forwarding
0
$ cat /proc/sys/net/ipv6/conf/enp8s0/accept_ra
0
我的近期目標是讓 IPv6 在此「路由器」主機上工作,而不進行前綴委派或任何實際的 IPv6 路由,因此目前forwarding
設定為。0
當該主機作為 IPv6 用戶端工作後,我將處理路由問題。
我嘗試過設置accept_ra
為2
,但dhcpcd
將其設置回0
。
netctl
我透過以下非常基本的設定檔呼叫 dhcpcd 。確切的呼叫是dhcpcd -6 -q -t 30 enp8s0
:
$ cat /etc/netctl/enp8s0
Interface=enp8s0
Connection=ethernet
IP=dhcp
DHCPClient=dhcpcd
IP6=dhcp
DHCP6Client=dhcpcd
$ dhcpcd --version
dhcpcd 8.1.6
Copyright (c) 2006-2019 Roy Marples
Compiled in features: INET ARP ARPing IPv4LL INET6 DHCPv6 AUTH
$ cat /etc/dhcpcd.conf | egrep -v '^#'
hostname
duid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option interface_mtu
require dhcp_server_identifier
slaac private
noipv4ll
答案1
康卡斯特似乎錯誤地截斷了其在廣告訊息中發送的客戶端 ID。我dhcpcd
使用以下-d
選項手動調用:
Mar 14 16:22:35 router dhcpcd[127923]: enp8s0: broadcasting SOLICIT6 (xid 0xc32482), next in 0.9 seconds
Mar 14 16:22:35 router dhcpcd[127923]: enp8s0: incorrect client ID from 2001:558:4082:7f::1
Mar 14 16:22:35 router dhcpcd[127923]: enp8s0: incorrect client ID from 2001:558:4082:7f::1
使用wireshark我觀察了客戶端ID:
11 5.308301 fe80::aaaa:aaaa:aaaa:aaaa ff02::1:2 DHCPv6 208 Solicit XID: 0xc32482 CID: 000403000200040005000006000700080009
12 5.360355 2001:558:4082:7f::1 fe80::aaaa:aaaa:aaaa:aaaa DHCPv6 196 Advertise XID: 0xc32482 CID: 00040300020004000500 IAA: 2001:558:600a:7f:bbbb:bbbb:bbbb:bbbb
A類型 4 客戶端 ID是基於 UUID 的 DUID,長度應為 128 位元(16 位元組)。dhcpcd
正在發送正確的長度,但康卡斯特的回應太短(8 個位元組)。
我嘗試透過發送顯式客戶端 IDdhcpcd -I 00:04:03:00:02:00:04:00:05:00 ...
來匹配康卡斯特將其截斷的內容,但 tcpdump 表明此選項未生效。我還嘗試將其從類型 4(這是 RFC 指定的)更改為類型 9(不是),以防萬一dhcpcd
不喜歡太短的類型 4 客戶端 ID,但dhcpcd
仍然沒有使用它。