By default, all containers run hidden in a private network on the host. The containers are not accessible from the local network, nor from the Internet. However, they have network access to the Internet through the host.
It would be great to have LXC containers getting from local DHCP server so that anyone from the network can connect to the container.
1. First we will create a bridge interface and add our physical interface (in the example it’s enp1s0) to the bridge:
sudo vi /etc/netplan/00-installer-config.yaml
network: version: 2 renderer: networkd ethernets: enp1s0: dhcp4: false dhcp6: false bridges: bridge0: interfaces: [enp1s0] addresses: [192.168.99.252/24] gateway4: 192.168.99.1 nameservers: addresses: - 188.8.131.52 - 184.108.40.206 parameters: stp: true forward-delay: 4 dhcp4: no
Next apply the config
sudo netplan apply