[lxc-users] Is there a guide to LXC & ipv6 configuration

Xavier Gendre gendre.reivax at gmail.com
Sat May 9 21:45:31 UTC 2015


Hi,

you can simply pass the IPv6 address you want to give to your container 
via the configuration file through 'lxc.network.ipv6'. For instance, if 
you gave the local address fe80::1 to the interface lxcbr0, you can do 
it with the following configuration file:

# Sample config file
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxcbr0
lxc.network.ipv6 = [the ipv6 address here]/128
lxc.network.ipv6.gateway = fe80::1

Note that you can give multiple IPv6 addresses by writing multiple lines 
which start with 'lxc.network.ipv6'. This is useful for giving a local 
and a global address to the interface in the container, for instance.

Then, create your container with the following command,
lxc-create -n container_name -f /path/to/config_file -t xxx [...]

Your container will receive the given IPv6 address. The sequel is just 
routing IPv6 traffic (ip -6 route add [...]) and allowing it in your 
firewall (ip6tables [...]).

Do not hesitate to ask if you need more details.

Xavier


Le 09/05/2015 20:32, Miroslav Lednicky a écrit :
> Hello,
>
> you can use file /etc/network/interfaces inside LXC for define IPv6
> static addrese.
>
> For example:
>
> auto eth0
> iface eth0 inet static
>          address 1.1.1.2
>          netmask 255.255.255.0
>          gateway 1.1.1.1
> iface eth0 inet6 static
>          address 1981:22:33:33::2
>          netmask 64
>          gateway 1981:22:33:33::1
>
> It is similar as in normal server.
>
> Miroslav Lednický
>
>
> Dne 9.5.2015 v 18:48 brian mullan napsal(a):
>> LXC default is to setup NAT'd ipv4 for containers.
>>
>> is there any guide to how to change the default to setup ipv6 instead so
>> lxc-create -t xxxx -n cn_name
>>
>> cn_name ends up with an ipv6 address.
>>
>> I searched thru all the lxc-users archive and didn't find any mention of
>> this
>> and google searches tend to just show examples of static ipv6 config for
>> a container
>>
>> I was hoping there was the ipv6 equivalent of the default ipv4
>> lxc-create results.
>>
>> brian
>>
>>
>>
>> _______________________________________________
>> lxc-users mailing list
>> lxc-users at lists.linuxcontainers.org
>> http://lists.linuxcontainers.org/listinfo/lxc-users
>>
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list