Port forwarding between two ethernet interfaces with iptables – Debian

vmbr0 has 190.57.138.220 public ip
vmbr1 has 192.168.1.90 lan ip

Forwarding from public ip port 8007 to lan 192.168.1.70 port 8006:

iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 8007 -j DNAT --to-destination 192.168.1.70:8006
iptables -t nat -A POSTROUTING -o vmbr1 -p tcp --dport 8006 -d 192.168.1.70 -j SNAT --to-source 192.168.1.90
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s