标题: Linux systemd networkd 缺省启用DHCP6 获得IPv6地址 [打印本页] 作者: linda 时间: 2022-2-25 11:54 标题: Linux systemd networkd 缺省启用DHCP6 获得IPv6地址
ubuntu server 使用systemd networkd设置网络,没有明显的配置文件,缺省启用DHCP6 获得IPv6地址。
DHCP=
Enables DHCPv4 and/or DHCPv6 client support. Accepts "yes", "no", "ipv4", or "ipv6". Defaults to "no".
Note that DHCPv6 will by default be triggered by Router Advertisement, if that is enabled, regardless of this parameter. By enabling DHCPv6 support explicitly, the DHCPv6 client will be started regardless of the presence of routers on the link, or what flags the routers pass. See "IPv6AcceptRA=".
Turn off IPv6 on specific interfaces
While IPv6 can be disabled globally at boot by appending ipv6.disable=1 to the kernel command line, networkd supports disabling IPv6 on a per-interface basis. When a network unit’s [Network] section has either LinkLocalAddressing=ipv4 or LinkLocalAddressing=no, networkd will not try to configure IPv6 on the matching interfaces.
Note however that even when using the above option, networkd will still be expecting to receive router advertisements if IPv6 is not disabled globally. If IPv6 traffic is not being received by the interface (e.g. due to sysctl or ip6tables settings), it will remain in the configuring state and potentially cause timeouts for services waiting for the network to be fully configured. To avoid this, the IPv6AcceptRA=no option should also be set in the [Network] section.
A network unit file’s [Network] section should therefore contain the following to disable IPv6 on its matching interfaces.