Port Forwarding (like DMZ)

Editor

Well-Known Member
Apr 26, 2017
108
1
58
Turkey
I wrote this to redirect all ports to a single machine, but I don't know if it is working properly. Is it possible to direct the entire port range to a single machine like DMZ Logic?

Code:
post-up iptables -t nat -A PREROUTING -p tcp --dport 0:8005 -j DNAT --to-destination 192.168.128.185:0-8005
post-down  iptables -t nat -D PREROUTING -p tcp --dport 0:8005 -j DNAT --to-destination 192.168.128.185:0-8005

post-up iptables -t nat -A PREROUTING -p tcp --dport 8007:65535 -j DNAT --to-destination 192.168.128.185:8007-65535
post-down  iptables -t nat -D PREROUTING -p tcp --dport 8007:65535 -j DNAT --to-destination 192.168.128.185:8007-65535
 
hi,

yes it's possible, the command looks good to me.

Code:
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 0:8005 -j DNAT --to-destination 192.168.128.185:0-8005

if you're not sure it's working you can test it by opening a port on the machine and see if you can access it?
also make sure you have ip forwarding enabled on the host
 

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!