![Netplan 未禁用 IP v6](https://linux22.com/image/1016174/Netplan%20%E6%9C%AA%E7%A6%81%E7%94%A8%20IP%20v6.png)
我的 netplan 文件中有以下内容(/etc/netplan
文件夹中只有一个)
network:
ethernets:
enp4s0f0:
dhcp4: false
dhcp6: false
enp4s0f1:
dhcp4: false
dhcp6: true
enp4s0f2:
dhcp4: true
dhcp6: true
这是输出ip a
2: enp4s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 10:60:4b:9a:bd:7c brd ff:ff:ff:ff:ff:ff
inet6 fe80::1260:4bff:fe9a:bd7c/64 scope link valid_lft forever preferred_lft forever
3: enp4s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 10:60:4b:9a:bd:7d brd ff:ff:ff:ff:ff:ff
inet6 fe80::1260:4bff:fe9a:bd7d/64 scope link valid_lft forever preferred_lft forever
4: enp4s0f2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 10:60:4b:9a:bd:7e brd ff:ff:ff:ff:ff:ff inet 10.31.100.63/23 brd 10.31.101.255 scope global dynamic enp4s0f2 valid_lft 28767sec preferred_lft 28767sec
inet6 fe80::1260:4bff:fe9a:bd7e/64 scope link valid_lft forever preferred_lft forever
这是输出sudo netplan --debug apply
DEBUG:Merged config:
network:
ethernets:
enp4s0f0:
dhcp4: false
dhcp6: false
enp4s0f1:
dhcp4: false
dhcp6: true
enp4s0f2:
dhcp4: true
dhcp6: true
正如预期的那样,仅从enp4s0f2
DHCP 服务器获取 IPv4。虽然enp4s0f0
有dhcp6: false
,但我看不出与其他两个 NIC 有什么区别。它也有 IPv6。是我读错了还是 netplan 没有按我的预期执行?
答案1
此处显示的 ipv6 地址是链路本地地址,而不是 DHCPv6 地址。要禁用链路本地地址,请设置link-local: [ ]
而不是默认设置,link-local: [ ipv6 ]
如手册页中所述netplan(5)
。