Ketan's Musings

Where he blogs about his eclipse musings

Port forwarding using IPTables

with one comment

I’ve got a UT300R2U ADSL router that has a really bad web based UI that did not let me setup some basic port-forwarding rules.

Thankfully the router was a linux based router with telnet installed on it. I was able to log in using the admin user, and set the following iptable rules:


#iptables -I PREROUTING -t nat -p tcp --dport 8080 -i ppp_0_35_1 -j DNAT --to 192.168.1.11:8080
#iptables -I FORWARD -p tcp -d 192.168.1.11 --dport 8080 -i ppp_0_35_1 -o br0 -j ACCEPT
#iptables -I FORWARD -p tcp -s 192.168.1.11 --sport 8080 -i br0 -o ppp_0_35_1 -j ACCEPT

the IP address 192.168.1.11 is the webserver that’s hosting tomcat on port 8080.

Written by Ketan

November 7th, 2007 at 7:28 pm

Posted in General

Tagged with , , , ,

One Response to 'Port forwarding using IPTables'

Subscribe to comments with RSS or TrackBack to 'Port forwarding using IPTables'.

  1. Someone asked how he could forward a range of ports.

    To do this, you’d need to specify the port range as ’8000-8080′ instead of just ’8080′ in the example above.

    In case you just want to forward UDP instead of TCP, change the ‘-p tcp’ above to ‘-p udp’

    Ketan

    16 Dec 07 at 8:44 am

Leave a Reply

IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)

What is 12 + 14 ?
Please leave these two fields as-is: