I’ve had a bit of trouble, as it seems the networking part of LXD isn’t hugely documented and I am having trouble deciding what interfaces I should use for my containers.
The network on my LXD host network:
eth0.3, which routes to my 1st WAN connection
eth0.4, an intranet VLAN that does not masquerade once it reaches router
eth1.2, which routes to my 2nd WAN connection
My LXD host’s routing table:
# ip r default via 192.168.3.1 dev eth0.3 metric 204 default via 192.168.4.1 dev eth0.4 metric 205 default via 192.168.2.1 dev eth1.2 metric 206 192.168.2.0/24 dev eth1.2 proto kernel scope link src 192.168.2.253 192.168.3.0/24 dev eth0.3 proto kernel scope link src 192.168.3.254 192.168.4.0/24 dev eth0.4 proto kernel scope link src 192.168.4.254
A central DHCP server is listening on all 3 VLANs:
Ideally I’d like to be able to configure my containers with that too, not just my LXD host. That’s going to mean my containers must have different MAC addresses. I am thinking macvlan is the right interface for this.
- webapp1 routes to the internet via
eth0.3, has it’s own IP address from my central DHCP server
- webapp1 serves it’s webapp/ssh to
- webapp2 routes through
vpn1container and leaves via
- webapp2 serves it’s webapp/ssh to
- vpn1 has internal network with webapp2
- vpn1 routes via
I’m a bit unsure how the configuration of the interface that routes via
eth1.2 might go.
I’m pretty sure the connection between webapp2 and vpn would be just a bridge like:
eth0: name: eth0 nictype: bridged parent: lxdbr0 type: nic