You have installed Proxmox and want to create LXCs (containers).
You want to give the LXCs an internal network and then allow internet access.
Log into the Proxmox GUI (not the LXC) and do the following:
In the left hand window, click on your server (under Datacenter)
Click “System” and a dropdown menu will appear
Click on “Network”
The large window will have a button labelled “Create v”
Click on this and choose “Linux Bridge” from the dropdown menu
A dialogue box will open “Create: Linux Bridge”
The name will auto-populate, it should read “vmbr1”
For IPv4/CIDR type “192.168.1.1/24”
Leave the rest alone and click the blue “Create” button
Click “Apply Configuration”, located on the same line as the “Create v” button
Click on the “>_ Shell” button and a new window will open
In this new window, type in the following:
apt-get install dnsmasq iptables-persistent -y
echo "interface=vmbr1
dhcp-range=192.168.1.100,192.168.1.200,infinite
dhcp-option=option:router,192.168.1.1
dhcp-option=option:dns-server,192.168.1.1" >> /etc/dnsmasq.conf
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
sysctl -p
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o vmbr0 -j MASQUERADE
systemctl restart networking
systemctl restart dnsmasq
netfilter-persistent save
Create an LXC as normal
In the Networking page choose “vmbr1” as the bridge and select DHCP.
Complete the setup of the LXC as required.
When you start the container it will automatically get an IP address in the range 192.168.1.100 through 192.168.1.200.
Test the connectivity inside the container by pinging a domain:
ping labby.co.uk