LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 06-02-2004, 09:29 AM   #1
slack_baby
Member
 
Registered: Feb 2004
Posts: 37

Rep: Reputation: 15
Iptables -- Port Forwarding


i am using Slackware with IPTABLES latest version ..i have a webserver(192.168.0.3) inside my lan and i am forwarding my external traffic(say 213.130.x.x static IP) at 80 to my internal webserver at the same port

i use the following rule for it

$IPT -A FORWARD -p tcp -i ppp0 -d 192.168.0.3 --dport 80 -j ACCEPT
$IPT -t nat -A PREROUTING -p tcp -i ppp0 -d 213.130.x.x --dport 80 -j DNAT --to 192.168.0.3


its working perfectly and forwarding all traffic 2 my internal IP of other internet users

but the problem is that i cant browse my website on internal server (192.168.0.3) from any other computer on LAN

can u guys tell me where am i doing wrong

Regards

SlackBaby
 
Old 06-02-2004, 09:50 AM   #2
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
your web server and local are located in 192.168.0.0/24 network?
if it is so i think it wont work.

if your webserver and local network are in different networks, i think u can do that with followings:
iptables -t nat -A PREROUTING -s local_net/subnet -d 213.130.x.x -p tcp --dport 80 -j DNAT --to 192.168.0.3
iptables -t nat -A POSTROUTING -s 192.168.0.3 -d local_net/subnet -p tcp --sport 80 -j SNAT --to linux_local_net_interface_ip
 
Old 06-02-2004, 10:14 AM   #3
slack_baby
Member
 
Registered: Feb 2004
Posts: 37

Original Poster
Rep: Reputation: 15
thankx maxut
i will try it
 
Old 06-03-2004, 02:29 PM   #4
bagira
LQ Newbie
 
Registered: Dec 2003
Location: Germany
Distribution: Gentoo
Posts: 27

Rep: Reputation: 15
Can you reach your webserver by using the ip address, not the URL? Ensure, taht the URL is resolvable via DNS.
/bagira
 
  


Reply



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
iptables port forwarding geoff3425 Slackware 13 12-20-2011 10:50 AM
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 07:35 PM
IPTables port forwarding.. NeoTech Linux - Networking 2 01-03-2005 11:27 AM
port forwarding with iptables David_99 Linux - Security 5 12-09-2003 08:37 PM
IPTABLES port forwarding sal_paradise42 Linux - Networking 5 10-25-2003 04:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:58 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
Open Source Consulting | Domain Registration