[lxc-users] venet like networking in LXC possible ?

Marc MAURICE marc.maurice at objectif-libre.com
Wed May 21 13:09:00 UTC 2014


Hello all,

I'm trying to setup the following simple config :
  * a lxc host (single network interface, single public IP1)
  * a lxc container (single public IP2)

I would like to achieve the same as OpenVZ venet, where all containers 
have dedicated IPs, but are sharing the MAC address of the host. (a bit 
like a simple IP alias)
In OpenVZ, this is called venet and this is the default networking mode, 
working without any bridge or complex network config.
You just put the IP address in the container config, and that's all.

After some research I've seen that this may be achieved with macvlan in LXC.

I'm trying to make this work without success :

lxc.network.type = macvlan
lxc.network.macvlan.mode = bridge
lxc.network.flags = up
lxc.network.link = em1
lxc.network.hwaddr = 00:16:3e:57:c1:95
lxc.network.ipv4 = XX.XX.XX.XX/32

When the container is running, it's routing table is empty. I tried 
adding the host as gateway, or just "default dev eth0 scope link" (as 
seen in OpenVZ containers).

tcpdumping the network interface on the host shows no traffic.

I finally made it work with veth mode, and a bridge on the host, but 
it's frustrating.
And I have to manually generate and allow all mac adresses (required by 
my server hoster).

Any idea or config sample ?

Thanks in advance,
Marc


More information about the lxc-users mailing list