Dhcpv6

systemd-networkd 未啟動 DHCPv6 客戶端

  • April 2, 2022

systemd-networkd 文件做出了這樣的聲明……

By enabling DHCPv6 support explicitly, the DHCPv6 client will
be started regardless of the presence of routers on the link

這是我正在尋找的行為 - 忽略任何可能出現或可能不出現的 RA,只啟動 DHCPv6 客戶端。

我沒有看到任何證據表明 networkd 正在啟動 dhcpv6 客戶端,無論是從輸出SYSTEMD_LOG_LEVEL=debug /lib/systemd/systemd-networkd還是來自tcpdump.

但是,如果我手動呼叫,我可以確認我的 DHCPv6 伺服器正在工作dhclient

root@client:~# dhclient -6 -v eth0
[...]
XMT: Solicit on eth0, interval 1070ms.
RCV: Advertise message on eth0 from fe80::baae:edff:fe77:7798.
[...]
XMT: Request on eth0, interval 910ms.
RCV: Reply message on eth0 from fe80::baae:edff:fe77:7798.
[...]
RCV:  | | X-- IAADDR fd11:7::175
RCV:  | | | X-- Preferred lifetime 7200.
RCV:  | | | X-- Max lifetime 7500.
RCV:  X-- Server ID: 00:01:00:01:29:d9:12:a2:02:42:0a:fe:fe:fe
message status code Success: "success"
PRC: Bound to lease 00:01:00:01:29:d9:12:a2:02:42:0a:fe:fe:fe.

配置systemd-network(由 netplan 生成)。

[Match]
MACAddress=xx:xx:xx:xx:xx:xx
Name=eth0

[Network]
DHCP=ipv6   <-- explicitly enabling dhcpv6
LinkLocalAddressing=ipv6
Address=192.168.0.1/24
IPv6AcceptRA=no

[Route]
Destination=0.0.0.0/0
Gateway=192.168.0.10

關於為什麼 networkd 沒有啟動 DHCPv6 客戶端的任何想法?

好的,看來WithoutRA=solicit是下需要的設置了[DHCPv6]

我可能會向文件提出問題,因為這似乎與本[Network]節中的陳述相矛盾。

引用自:https://serverfault.com/questions/1097606