Opening ports for my container on my LAN

Hey, I hope, I do understand correctly, what you mean:
You have your server and want to be able to access the machine behind it.
Since the bridge interfaces has an dhcp server included, the virtual machines behind your Server
will sit in a seperate network.

So you could basically port forward, thus if you access the servers port, it will access the vms port.
You could do this with the proxy command (this is dangerous when using mail servers!)
https://discuss.linuxcontainers.org/t/lxc-config-device-add-proxy-connect-tcp-10-11-12-13-80-vs-connect-tcp-127-0-0-1-80/5931.
Or with iptables - here, in this example, you will forward the traffic, that arrives at your servers device interface eth0 , at port 443 to the vms port 443.
iptables -t nat -A PREROUTING -i eth0 -d publicserverip -p tcp --dport 443 -j DNAT --to yourvmsip:443
Make sure you install iptables-persistent to make the iptables rules persistent, after the next reboot.

1 Like