Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 10-29-2007, 05:14 PM   #1
Registered: Aug 2002
Location: Mumbai,India
Distribution: Linux Mint 12, Gentoo
Posts: 230

Rep: Reputation: 30
Question Problem with port forwarding

Here's the setup : I have got 2 LANS ( lets call them external and internal )

Router A:
eth1 - ( connects to external LAN )
eth0 - ( connects to internal LAN )

I have a webserver running on the internal LAN machine (IP: on port 8080 and would like it to be accessible from network by some kind of natting. I went through lots of guides and finally came up with the solution :

iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 8080 -j DNAT --to ( or --to )
iptables -A FORWARD -i eth1 -o eth0 -p tcp -d --dport 8080 -j ACCEPT
But surprisingly this is not working. when I do telnet on 8080 port of , I get a "connection refused". Can somebody please help me to find out where I might have gone wrong ?

Thanks in advance...
Old 10-29-2007, 06:01 PM   #2
Senior Member
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
You need to put this in front of all your FORWARD rules:
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT


port forwarding

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
port forwarding problem! shio Linux - Networking 3 10-16-2007 06:16 AM
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 08:35 PM
Port Forwarding problem Koven Linux - Networking 8 10-08-2006 09:42 PM
port forwarding problem bruj3w Linux - Networking 3 08-13-2004 09:13 PM
port forwarding problem roueleader Linux - Newbie 9 06-11-2002 05:44 PM

All times are GMT -5. The time now is 05:07 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration