我使用 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 ...
以匹配 Comcast 将其截断为的内容,但 tcpdump 表明此选项未生效。我还尝试将其从类型 4(这是 RFC 指定的)更改为类型 9(不是),以防万一dhcpcd
不喜欢太短的类型 4 客户端 ID,但dhcpcd
仍然没有使用它。