Container with public IP and private network

Pom Xon

New Member
Apr 4, 2020
1
0
1
29
Hello,

I just set up my first proxmox host (OVH) and my plan is to have 3 containers, 2 of them with public IPs + private network and one with only access to the private network.
This setup is working so far. However, even on the containers with the public IP, traffic is routed through the host instead of their own public IP.

How would I solve this?
I have tried changing the order of the network interfaces on the guests so the interface with the public IP is last; but this results in a lot of headaches (having to manually bind the public IP everywhere, ie nginx, gameserver, ..)

host
Code:
auto vmbr0
iface vmbr0 inet static
        address 54.36.x.x/32
        gateway 54.36.x.x
        bridge-ports enp1s0f0
        bridge-stp off
        bridge-fd 0
        network 54.36.126.0

auto vmbr1
iface vmbr1 inet static
        address 10.0.0.1/24
        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 '10.0.0.0/24' -o vmbr0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j MASQUERADE

guest

Annotation 2020-04-04 135318.png
 
host
Code:
...
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j MASQUERADE

If your containers have public IPs themselves, why do you need this part? This is the part that's responsible for routing your CT traffic through your host, which evidently you don't want?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!