I am setting up a server to host a number of LXC containers, for now just isolating web and db services. The server I am using has two NICs and I'd like to use one for host traffic and one for container traffic (as both containers have routable IPs) so that I can route the traffic through two different vlans on my switch.
Before I dive into actually doing all of this I'm trying to figure out if my way of thinking about how to do this is correct. The way I understand it is i'd create a bridge device in my hosts interfaces, say br0
, that includes bridge_ports eth1
. As far as I know this bridge shouldn't require any kind of IP (but I'm not really sure...)
On the containers I would then change the network interfaces to macvlan bridges linked to br0 with static IPs.
Is this even remotely right? I've not really worked with container network routing before... (also here is a neat illustration of what I think I'm doing)
+----------------+
| |
| managed switch |
| |
+-+----------+---+
| |
+-----+ +-------+
| |
+---+----+ +--+-----+
| | | |
| vlan 1 | | vlan 2 |
| | | |
+--+-----+ +--+-----+
| |
| eth0 +-------------+
| eth1 | |
| +-------------------+ |
| | |
+---+-----++ +---------------+ |
| | lxc | | |
| lxc host +------+-----+ web container +---+ br0
| | | | | |
+----------+ | +---------------+ |
| |
| +--------------+ |
| | | |
+-----+ db container +----+
| |
+--------------+