Proxmox container no internet

#1

Hello everyone, I have a problem that I can not solve on a SCALEWAY GP1-XS instance.

I installed debian 9 on it then proxmox 5.4. Good for this part, I can connect to the proxmox web interface without any problems.

I would like to give the opportunity to my LXC containers to access the internet without ip failover but i’m lost when i need to configure the network interfaces.

Currently i have an interface named “ens2” and I do not know what else to do.

I followed various tutorial indicating to create an interface vmbr0 then vmbr1. So I manage to make my containers ping the host via an ip type 192.168.1.x but they can not reach any website.

Here is the configuration I did (which does not work) and any help would be appreciated :slight_smile:

auto lo
iface lo inet loopback

source /etc/network/interfaces.d/*.cfg

iface eth0 inet manual

iface eth1 inet manual

auto vmbr0
iface vmbr0 inet static
    address  10.x.x.x #Scaleway private ip
    netmask  255.255.255.254 
    gateway  10.x.x.y
    bridge-ports eth0
    bridge-stp off
    bridge-fd 0

auto vmbr1
iface vmbr1 inet static
    address 192.168.1.254
    netmask 255.255.255.0
    broadcast 192.168.1.255
    bridge_ports none
    bridge_stp off
    bridge_fd 0
    post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    post-up iptables -t nat -A POSTROUTING -s '192.168.1.0/24' -o vmbr0 -j MASQUERADE
    post-down iptables -t nat -D POSTROUTING -s '192.168.1.0/24' -o vmbr0 -j MASQUERADE

The content of interfaces.d/

auto lo
iface lo inet loopback

auto ens2
iface ens2 inet dhcp

Same file for my first container

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.1.100
    netmask 255.255.255.0
    gateway 192.168.1.254

I think that I made several errors, in particular I see under the interface of proxmox that the interface eth0 is not active and I have a doubt on the use of the private ip on vmbr0.

Thank you in advance !

#2

Hello everyone, so I found after fifty unsuccessful attempts. This is my last attempt and it works:

auto lo
iface lo inet loopback

iface ens2 inet manual

source /etc/network/interfaces.d/*.cfg

auto vmbr0
iface vmbr0 inet static
    address 192.168.1.254
    netmask 255.255.255.0
    broadcast 192.168.1.255
    bridge_ports none
    bridge_stp off
    bridge_fd 0
    post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    post-up iptables -t nat -A POSTROUTING -o ens2 -j MASQUERADE
    post-down iptables -t nat -A POSTROUTING -o ens2 -j MASQUERADE

And for my first container (lxc):

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.1.100
    netmask 255.255.255.0
    gateway 192.168.1.254

Hope that this can help others!