LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 10-13-2002, 11:38 PM   #1
Half_Elf
LQ Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 46
Question about Ip/Port Forwarding


Because my ISP doesn't allow service running on port 80, I wan to forward all trafic from internet that want to reach my port 80 to another port on another box (it start to be funny, isn't it? )

So I first tried to forward connection from inside the network to another box and I was successful... here is the first script:
$IPTABLES -A PREROUTING -t nat -j DNAT -s 192.168.0.1 -p tcp --dport http --to-destination 192.168.0.3
$IPTABLES -t nat -A POSTROUTING -s 192.168.0.3 -o ETH0 -j SNAT --to-source 192.168.0.1

This was working so now I'm tring to do the same thing but for the trafic coming from the net. But I have a problem ,since anyone can try to connect to me, I can't know where is "the source" I want to return to trafic to...
Example:

$IPTABLES -A PREROUTING -t nat -j DNAT -s 0/0 -p tcp --dport http --to-destination 192.168.0.3
$IPTABLES -t nat -A POSTROUTING -s 192.168.0.3 -o ppp0 -j SNAT --to-source ?.?.?.?


Now how can I know where to send back the trafic? is there a special option to ask iptables to memorize the ip from where the trafic is coming, to be able to send back the answer-trafic later?
 
Old 10-14-2002, 08:05 AM   #2
GabeF
Member
 
Registered: Mar 2002
Location: New Hampshire, US
Distribution: Mandrake 8.0, Redhat 8.0
Posts: 101

Rep: Reputation: 15
I don't know if knowing that the ip address for "the internet" is 0.0.0.0 would help....
 
Old 10-14-2002, 12:16 PM   #3
Half_Elf
LQ Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Original Poster
Rep: Reputation: 46
well why not?

If I can know what's the ip of the outside connection that want to access my apache server, I will be able to return the trafic to it after the forward... if not I can't return the trafic.
 
Old 10-14-2002, 02:47 PM   #4
GabeF
Member
 
Registered: Mar 2002
Location: New Hampshire, US
Distribution: Mandrake 8.0, Redhat 8.0
Posts: 101

Rep: Reputation: 15
Although it wouldn't be easy, I believe the the packets of information contain the requesting IP address in their headers. I have no idea how to utilize that except with a sniffer of sorts
 
  


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
Port Forwarding Question caps_phisto Linux - Networking 1 07-10-2005 10:33 PM
Port forwarding question linuxpyro Linux - Networking 3 10-22-2004 08:13 PM
Port forwarding question GUIPenguin Linux - Networking 1 10-12-2004 01:30 PM
Port forwarding question Doolspin Linux - Networking 2 09-03-2004 10:11 PM
port forwarding question larry Linux - Networking 2 06-10-2004 10:34 AM

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

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