Route public IP to VM

horizn

Well-Known Member
Aug 21, 2017
34
2
46
44
Hi,
I have 4 public IPs from my ISP. Currently I am using two of them, one for Proxmox and the other one forwarded 1:1 to private IP of the VM.
So I've tried to forward it using iptables:
Code:
iptables -A FORWARD -p tcp --syn -s EXT_IP -m connlimit --connlimit-above MAX_CONN -j REJECT
iptables -A FORWARD -p tcp --syn -d EXT_IP -m connlimit --connlimit-above MAX_CONN -j REJECT
iptables -A FORWARD -s 0/0 -d EXT_IP -j ACCEPT
iptables -A FORWARD -s EXT_IP -d 0/0 -j ACCEPT

but that doesn't work on Proxmox. It works fine on any baisc Linux installation. I suspect this is because of vmbr interface. Do anyone know how to do this in Proxmox?
 
where is your nat rules ?

In my custom firewall based on functions:

So if I want to map external IP 1:1 to internal then I am doing this:
Code:
iptables -A FORWARD $PROT -s 0/0 -d LOCAL_IP -j ACCEPT
iptables -A FORWARD $PROT -s LOCAL_IP -d 0/0 -j ACCEPT
iptables -t nat -A PREROUTING $PROT -s 0/0 -d EXT_IP -j DNAT --to LOCAL_IP
iptables -t nat -A POSTROUTING PROT -s $LOCAL_IP -d 0/0 -j SNAT --to EXT_IP

and that works fine, external IP is mapped 1:1 to the internal IP (VM).

The problem is how to forward external IP from Proxmox directly to the VM, as it must be different due to vmbr interface and the set of rules from my first post don't work.
 

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!