LXD guest-container on the same logical network as the host

Hello,
could anybody help me (explain or send me a link) with networking for LXD container?

I am looking for it long time, but I am not able to solve easy thing - guest and host are
at the same logical network.

Our company network is 10.200.0.0/16 and I want run container with IP -10.200.200.7 .
lxc container ------------------ “host server” ------------------ company network
10.200.200.7 ----------------- 10.200.200.4 ------------------ 10.200.0.0

How can I do it?
I tried to set s bridge and finally I was able “ping” from guest-container to
host IP 10.200.200.4 but no far in the network for example
to gateway 10.200.200.16 .

I fond this great article, http://containerops.org/2013/11/19/lxc-networking/
but it is for LXC, is there any relation between LXC and LXD parameters?

I think the easiest way seems to add/mapped NIC from host directly into
the container (as is noticed in the end of the article) but how use this idea
in LXD?

Is the right way to use openvswitch?

I’ve installed LXD 2.20 on Centos 7.4 in VMWare 5.1.

Thank You very much
Mareg

The problem is with VMWare. VMWare filters MAC addresses and only allows the main VM’s MAC address to send packets out.

So if you use a bridge or macvlan for your containers, they will not be able to send or receive anything from outside the VM.

I believe there is some kind of option somewhere in VMWare to turn that particular behavior off but I’ve not used VMWare in a very long time so you’d need to do some research.

In the article what I mentioned is enumerate the “phys” network type. Is there any possibility to use this type in LXD?
In the networks.md isn’t mentioned this type. Or the bridge.driver key isn’t equivalent for the lxc.network.type?
There isn’t problem add next eth adapter in VM guest, and this NIC will get MAC from esx so it could work, don it?
I want to run Zabbix in the container, therefore I prefer this solution - with IP from our network.

Yes, you can have VMWare pass a new virtual NIC inside the VM, then use that for your container with something like (assuming it gets called eth1):

lxc config device add CONTAINER eth0 nic nictype=physical parent=eth1 name=eth0

This will move the host’s eth1 into the container and have it called eth0 in there.

lxc network is only used to create and manage LXD bridges, when dealing with physical devices or macvlan, you don’t need any of that and can just directly add nic devices to your containers or profiles.

Great! It does work, thank You.

Maybe this is a solution too:


But I have no more time and power to test it, maybe next time.