2009-10-12

Port Forwarding in Ubuntu with iptables

Assuming your ubuntu box already have NAT up and running, and you wish to connect directly to the internet from a machine behind your Router (Ubuntu, GNU/Linux-box).

iptables -A PREROUTING -t nat -i ##incomming interface## -p tcp --dport ##incomming port## -j DNAT --to ##destination IP##:##destination port##

For example:
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 8080 -j DNAT --to 10.1.249.250:80

When I wanted to access a web server behind my Ubuntu NAT-router in my home. Now I can surf to #mydomain#:8080 to access that internal web server at port 80.

Hashes: #linux #ubuntu #nat #port forwarding #iptables

No comments:

Post a Comment