I'm pretty new to linux, and I have been struggling with a problem for the past week or so...
I am trying to setup a cluster of LXC containers on a workstation (host) which is has IP 192.168.10.33 connecting to a gateway with IP 192.168.10.1
the LXC nodes are by default connected to the lxcbr0 bridge with IP 10.0.3.1, containers have IP between 10.0.3.111 and 10.0.3.120
I can ping each container from the host, I can ping the bridge (10.0.3.1) from the containers, as well as the host IP (eth0, 192.168.10.33) but I can't reach the gateway (192.168.10.1) I have read a multitude of posts and man pages about networking, iptables and routing, but nothing has worked so far (defining default gw, ip forwarding...)
If i configure the lxcbr0 bridge to be at 192.168.10.33 (the host IP) and my containers to take IP on the same IP range (192.168.10.111 to 120), then it works fine.
I would like to understand how I am supposed to bridge 2 networks with different IP ranges as mentioned (bridging 192.168.10.0/24 with 10.0.3.0/24) ???
(as a disclaimer, i disabled firewall and anything that could prevent reaching the gateway in the first place, i can reach it from the host)
any insight to point me in the right direction would be appreciated. Thank you
You need to check your NAT settings or add a network route on gateway. For adding route you should run command on gateway(if it is Linux of course):
For adding NAT:
What I realized is that a LXC contained works fine out of the box with defaults when it is CREATED, but all subsequent CLONED containers had this connection problem, along with SSH stopped.
I ended up creating all my containers and running my install scripts inside them, as opposed to cloning the original container.
I was not able to get the connection working from within cloned containers, and I still don't know why, but i solved my problem.