LinuxQuestions.org
Review your favorite Linux distribution.
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 04-06-2005, 08:12 AM   #1
aronnok
Member
 
Registered: Oct 2004
Location: Dhaka, Bangladesh
Distribution: Redhat Linux 7.2,Redhat Linux 8.0,Redhat Linux 9.0
Posts: 36

Rep: Reputation: 15
Problem with Port forwarding :(


hi there!
Something is wrong. I am not able to forward my ports to some others server's different port. My idea is, i am using a gateway, which has two NIC. ( eth0 X.X.12.106; eth1 X.X.12.108 ). etho is connected with internet. i have a webserver running behind my gateway which IP is X.X.12.109.
All i need is, my webserver will run on a different port. suppose 90 ( instead of 80 ). so, when some one will try for www.abc.com ( X.X.12.109 ), my gateway server will automatically redirect them to ( X.X.12.109:90 ).

i have used the following method. but due to some reason it failed.

/sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d 69.88.12.109 --dport 80 -j DNAT --to 69.88.12.109:90

/sbin/iptables -t nat -A PREROUTING -p tcp -i eth1 -d 69.88.12.109 --dport 80 -j DNAT --to 69.88.12.109:90

Can anybody help me?
thanx in advance.
 
Old 04-06-2005, 10:37 AM   #2
Technoslave
Member
 
Registered: Dec 2003
Location: Northern VA
Posts: 493

Rep: Reputation: 30
First off, it doesn't help to x out your IP address, I don't know why people do this, it makes no sense and only compounds on the problem as the reader has to start mentally wrangling with what's going on.

However, I find it funny that later on you copy and paste the actual IP 69.88.12.109, good job!

I also find it funny that no one does a search on this subject to begin with. However, with the slow-ass search that's going on right now, I don't blame you.

So, much like monkeys who fling poo, I will continue to fling this answer out:

So, here's the example of port forwarding using iptables.

I have an internal server on port 10.0.0.2, running apache on port 80. I want to be able to reach it via port 81 from my gateway computer.

/sbin/iptables -t nat -I PREROUTING -p tcp -d 209.190.200.143 --dport 81 -j DNAT --to 10.0.0.2:80

You also have to do:

/sbin/iptables -I FORWARD -p tcp -d 10.0.0.2 --dport 80 -j ACCEPT

Good Luck.
 
Old 04-06-2005, 02:16 PM   #3
Linux4Life
LQ Newbie
 
Registered: Apr 2005
Distribution: SuSE 9.3
Posts: 16

Rep: Reputation: 0
Yeah, what he said..

I don't have any problems with port forwarding because I use a telenet web based setup that's really easy to use. You just add the ports and their protocols and you're away with it.
 
  


Reply


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
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 07:35 PM
Problem with Port Forwarding Zorrocaesar Linux - Networking 1 10-25-2005 07:18 AM
port forwarding problem bruj3w Linux - Networking 3 08-13-2004 08:13 PM
port forwarding problem syrtsardo Linux - Networking 6 07-19-2004 01:50 AM
port forwarding problem roueleader Linux - Newbie 9 06-11-2002 04:44 PM

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

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