Use port forwarding with masquerade

3

I'm using a debian as a router with nat configured. How can I set up port forwarding, to set an rdp server on the local network for example?

Gonzo

Posted 2012-08-27T14:01:51.177

Reputation: 147

Answers

2

The keyword you're looking for is 'Destination NAT' aka DNAT.

I assume you're using plain iptables here and that you've already set up SNAT (to route back). Then just do something like this:

# iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 3389 \
  -j DNAT --to-destination 192.168.1.2

where eth0 is your WAN interface and 192.168.1.2 is some address in your local network.

gertvdijk

Posted 2012-08-27T14:01:51.177

Reputation: 3 396