Portforwarding NAT

Zlyze

New Member
Nov 6, 2020
4
1
1
23
Hello,

my current problem is, that im trying to forward the port 81 from my VM (privat ip: 192.168.0.250), but i can't access it from outside and it shows that the port 81 as closed.
Firewall is currently disabled.


Host interfaces config:
source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

auto enp2s0
iface enp2s0 inet manual
up route add -net 148.251.x.x netmask 255.255.255.192 gw 148.251.x.x dev enp2s0

auto vmbr0
iface vmbr0 inet static
address 148.251.x.x/26
gateway 148.251.x.x
bridge-ports enp2s0
bridge-stp off
bridge-fd 0

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

iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 192.168.0.250:80
iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 81 -j DNAT --to 192.168.0.250:81
iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 443 -j DNAT --to 192.168.0.250:443
 
If the firewall is disabled, those rules you added to iptables are not run.
Try enabling the firewall.
 

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!