LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 10-29-2007, 05:14 PM   #1
sandy
Member
 
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 - 10.5.1.14 ( connects to external LAN )
eth0 - 10.1.11.4 ( connects to internal LAN )

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

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

Thanks in advance...
san
 
Old 10-29-2007, 06:01 PM   #2
Berhanie
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:
Code:
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
 
  


Reply

Tags
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 10:03 AM.

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