[lxc-users] Fun with lxc.network.type=phys

ScrumpyJack scrumpyjack at me.com
Mon Jan 19 12:52:23 UTC 2015


I'd like to connect a physical interface from a host to a LXC container 
guest like so:

lxc.network.type=phys

And then assign a routable IP/32 address to the LXC container for it to 
"just work".

The problem is that I don't have a spare "real" physical interface, so on 
the host i create a "virtual" interface

 ip link add link eth0 mac0 type macvlan

I now have a new virtual interface called mac0 with a separate mac address 
in my host. I assign it a test IP and it can be pinged from outside the 
host.

I add the following details to the container's config file

lxc.network.type=phys
lxc.network.flags = up
lxc.network.link = mac0
lxc.network.name = eth1


I boot my LXC guest, and as expected the mac0 virtual interface gets 
passed on to the guest, as the guest has a new interface called eth1 with 
exactly the same mac address as the randomly generated mac0 mac address 
from the host, and the mac0 interface is no longer available in the host.

But that's as far as it goes. Assigning the same test IP address to the 
guest doesn't have the desired effect and the containers is unreachable. I 
see the traffic coming into eth0 on the host, but that's it. The guest 
doesn't seem to get the traffic with it's IP.

I don't want to use bridging, veths or taps, or any method other than physical.

Am i missing something? Is it just not possible to pass a virtual 
interface from the host to the guest like this?

-- 

Not sent from a tablet or smartphone.


More information about the lxc-users mailing list