LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 07-17-2003, 01:28 PM   #1
radupastia
LQ Newbie
 
Registered: Jul 2003
Posts: 6

Rep: Reputation: 0
Question Port Forwarding using iptables-DNAT


I am using a linux box (Linux 2.4.19-pre2-rmap12g) as a NAT/Server. I don't really know much about linux and the configuration has been done by somebody else (from my ISP), and it is using 'iptables'. I want to start using a file-sharing program on a Windows box that is behind the NAT and has a private ip, so i have documented about 'port forwarding using DNAT', and i found what i needed. This is the command I used: ' iptables -t nat -A PREROUTING -p tcp -i eth0 -d xxx.xxx.xxx.xxx --dport 81 -j DNAT --to 192.168.0.2:80 ' . ( xxx.xxx.xxx.xxx is the public IP address of the Linux box(NAT) ) . I opened a web-server on the .2 box , and tried to access xxx.xxx.xxx.xxx:81 and it did not work. I did ' iptables -t nat -L' and everything seemed ok. Why dose it not work ?
PS. Remember that I do not know much about Linux/iptables, for example I know that '-t nat' makes a reffernece to the < "nat" table > but I don't know what that is, or if it must be created at first...
 
Old 07-17-2003, 01:41 PM   #2
hakcenter
Member
 
Registered: Apr 2003
Location: Not to far from the computer screen
Distribution: RedHat 9.0
Posts: 324

Rep: Reputation: 30
the easier way to write it is if the source doesn't equal your internal lan

iptables -t nat PREROUTING -p tcp -s ! 192.168.0.0./255.255.255.0 --dort 81 -j DNAT --to 192.168.0.2:80

Last edited by hakcenter; 07-17-2003 at 03:46 PM.
 
Old 07-18-2003, 02:14 AM   #3
radupastia
LQ Newbie
 
Registered: Jul 2003
Posts: 6

Original Poster
Rep: Reputation: 0
But is this not the same thing ? I am trying all this from another computer, using telnet, so I only have access to this PC , on witch I also run the web-server. The packets I send to xxx.xxx.xxx.xxx:81 should be returned to my 80 port. Other ideeas ? PS. Please keep in mind that I am a newbie and it might be something obvios, for you, that I have overlook.
 
  


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
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 07:35 PM
Help with iptables/DNAT/forwarding lohb1ac Linux - Networking 2 12-05-2005 08:48 AM
IPTables port forwarding.. NeoTech Linux - Networking 2 01-03-2005 11:27 AM
IPTables - DNAT, SNAT, port forwarding FunkFlex Linux - Security 2 01-15-2002 07:18 PM
DNAT Help(port forwarding) jrmann1999 Linux - Networking 1 08-09-2001 10:58 PM

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

All times are GMT -5. The time now is 01:23 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