Lxd: LXC container always reveives IPV6 address. Even with everything disabled.

Created on 14 Feb 2018  路  6Comments  路  Source: lxc/lxd

I was trying to disable any sort of IPV6 in the LXC container, so far unsuccessfully.

  • Static IPV4 setup in /etc/network
  • remove isc-dhcp-client
  • disable ipv6 autoconfiguration in /etc/sysctl.conf
    net.ipv6.conf.all.autoconf = 0
    net.ipv6.conf.default.autoconf = 0
    accept_ra = 0... etc.
  • 99-disable-network-config.cfg with network: {config: disabled} in the /etc/cloud/cloud.cfg.d

And my container anyway receives correct, working IPV6
distro (host and container) - UBUNTU 16.04
Not sure if that's a bug of LXC - but in case it is configured somehow outside of container creating it here.

All 6 comments

root@c1:~# echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.d/999-ipv6.conf
root@c1:~# echo "net.ipv6.conf.default.disable_ipv6=1" >> /etc/sysctl.d/999-ipv6.conf
root@c1:~# reboot

stgraber@castiana:~$ lxc exec c1 bash
root@c1:~# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:16:3e:0b:d6:9f  
          inet addr:10.204.119.118  Bcast:10.204.119.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:57 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6725 (6.7 KB)  TX bytes:1672 (1.6 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@c1:~# 

You could also just disable IPv6 on your bridge, that way there's no IPv6 address for the container to receive.

This way it works... Thanks so much. But why does it autoconfigure anyway while it was not supposed?

It likely was configured before the sysctls got applied. Setting autoconf to 0 doesn't remove anything that was configured prior to the setting being set.

You could also just disable IPv6 on your bridge, that way there's no IPv6 address for the container to receive.

How could I do this?.

@hablutzel1 ipv6.address=none

Was this page helpful?
0 / 5 - 0 ratings

Related issues

simos picture simos  路  3Comments

jsnjack picture jsnjack  路  3Comments

killua-eu picture killua-eu  路  3Comments

rrva picture rrva  路  5Comments

sforteva picture sforteva  路  3Comments