2 (or more) public ip's and nat with portforwarding problem

Tos

Member
Feb 11, 2020
1
0
6
44
I have 2 public ip's and using one ethernet port. 88.88.50.190 is for proxmox and 88.88.50.191 is for a lxc container running a webserver.
I tried to configure nat with portforwarding of port 80 to another lxc container running on 10.10.10.10

The problem is with the below configuration i can not use port 80 on 88.88.50.191. If i go 88.88.50.191:80 i will be re-routed to 10.10.10.101:80.
I don't want that as this.

Need to be able to run one webserver behind the nat with port forwarding and one webserver on 88.88.50.191
I guess the problem has to do with that all traffic is going through vmbr0 first and that the portforwarding mess things up.
Is there an easy way to solve this?

Below is my configuration file. IP's are not my real ones.
I'm using Proxmox 6.1-5

auto lo
iface lo inet loopback

iface eno1 inet manual

iface eno2 inet manual

iface enp0s29f0u2 inet manual

auto vmbr0
iface vmbr0 inet static
address 88.88.50.190
netmask 22
gateway 88.88.48.1
bridge-ports eno1
bridge-stp off
bridge-fd 0

auto vmbr1
iface vmbr1 inet static
address 10.10.10.1
netmask 255.255.255.0
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.10.10.0/24 -o vmbr0 -j SNAT --to 88.88.50.190
post-down iptables -t nat -D POSTROUTING -s 10.10.10.0/24 -o vmbr0 -j SNAT --to 88.88.50.190

post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 10.10.10.101:80
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 10.10.10.101:80
 
Hi,

generally, I would do this with a reverse-proxy container.
So all incoming packages for 88.88.50.191 come to this reverse-proxy VM/CT and do the redirection.
This is much more flexible.
 

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!