I am trying to fully disable IPv6 on an IPv4-configured virtual network adaptor in an LXD container, but it seems to be autoconfiguring an IPv6 address anyway.
Quoth to the documentation:
Note that an interface without any static IPv6 addresses configured, and neither DHCPv6 nor IPv6LL enabled, shall be considered to have no IPv6 support. IPv6 will be automatically disabled for that interface by writing "1" to /proc/sys/net/ipv6/conf/ifname/disable_ipv6.
I am using the following configuration:
[Match] Name=ext0 [Link] RequiredForOnline=no [Network] Address=172.29.1.12/16 Gateway=0.0.0.0 DHCP=no LinkLocalAddressing=no IPv6AcceptRA=no ConfigureWithoutCarrier=yes As you can see, systemd-networkd has not set disable_ipv6 to 1 as the documentation states:
# cat /proc/sys/net/ipv6/conf/ext0/disable_ipv6 0 # ip addr show dev ext0 40: ext0@if17: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 00:16:3e:07:d6:95 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 172.29.1.12/16 brd 172.29.255.255 scope global ext0 valid_lft forever preferred_lft forever inet6 fd42:158c:c543:8cfe:216:3eff:fe07:d695/64 scope global dynamic mngtmpaddr valid_lft 3316sec preferred_lft 3316sec inet6 fe80::216:3eff:fe07:d695/64 scope link valid_lft forever preferred_lft forever The systemd-networkd log shows the interface is gaining a link-local address, even though it has been explicitly disabled:
# journalctl -u systemd-networkd -- Logs begin at Wed 2019-10-02 10:29:04 UTC, end at Wed 2019-10-02 10:30:25 UTC. -- Oct 02 10:29:04 assist1 systemd-networkd[36]: ext0: Gained IPv6LL Oct 02 10:29:04 assist1 systemd-networkd[36]: Enumeration completed Oct 02 10:29:04 assist1 systemd[1]: Started Network Service. Oct 02 10:29:04 assist1 systemd-networkd[36]: ext0: Configured I am aware of sysctl settings to disable IPv6, which will work, but I would prefer to not use these as I don't want to disable IPv6 globally, and the virtual adaptors may be re-configured to use IPv6 or not dynamically.