IPtables Rules for NAT reflection / loopback

moxfan

Active Member
Aug 28, 2013
104
7
38
Hello Proxmox Network Gurus :-)

I need your advice. I am stuck with 1 public ip on a Proxmox host, so I am using a bridge and NAT port forwarding to a single container.

Code:
root@prox1:~# cat /etc/network/interfaces
...........
auto vmbr0:0
iface vmbr0:0 inet static
address 192.168.4.1
netmask 255.255.255.0
network 192.168.4.0
broadcast 192.168.4.255


Taking port 80 as an example, this rule in iptables is doing the forwarding from the host's public ip to the container's internal ip: 192.168.4.2 and is working just fine.
Code:
-A PREROUTING -i vmbr0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.4.2:80


Currently though, the container is blinded to the host's public ip address and has no awareness of it. As a result, some apps in the container are unable to write to a file inside the container when using the public ip address. Apparently, I need NAT reflection / loopback rules for port 80 on the host. What would / should these rules look like on the basis of the above info?

Thanks.

Norman
 

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!