Hello I’m looking for a little help. I have had LXC running to serve (small) websites for a little while and really enjoy how cool and lightweight it is !
I’m looking to set up the following and having trouble … using Ubuntu Server as a host.
1 - Physical server and several containers that all see the physical LAN and get distinct DHCP addresses on that network.
and
2 - A second network allowing the physical server and the containers to communicate independent of the outside network.
Hi @g01d10x,
Just adding another network interface as eth1 on every containers and setup network address from 5.5.5.x should be enough I suppose.
Regards.
A couple years ago I have experimenting Macvlan network. I following this guide. I don’t use this method right now. Just experimenting. But what I remember with this macvlan, 192.168.1.5 (your host?) can’t connect to C1 using 192.168.1.2, or C2 using 192.168.1.3. But other machines on physical LAN can connect to C1 or C2 or C3 or the host (using 192.168.1.x). Or Internet can connect to C1 or C2 with the help of “My Router” forward’s rule. I don’t recall if C1 can connect to C2 using 192.168.1.2 <-> 192.168.1.3. Maybe if 5.5.5.x <-> 5.5.5.x ?
Hi there Yes that’s my experience so far as well … the 192.168.x.x. connections don’t allow containers or the host to speak to each other, but another machine can connect in, no problem. That’s what I’m hoping to solve, but no solution yet. … I am hoping to get time to give @cemzafer’s solution a try later tonight.
lxc config device add <instance> eth1 nic nictype=bridged parent=br0
Note: Your external network on br0 may provide DHCP, and lxdbr0 provides DHCP, so if your instances run a DHCP client on both NICs they will get 2 conflicting default gateways.
So you may want to disable DHCP on lxdbr0 or statically configure the instances with 2 NICs.