LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 03-19-2008, 09:01 AM   #1
Abstractt
LQ Newbie
 
Registered: Nov 2007
Posts: 7

Rep: Reputation: 0
Forward all request on port 22


Hi Everyone,

In my iptables there aren't any rules defined. Now I want to forward all requests to port 22 on 10.0.0.32 to port 22 on destination 10.0.0.16.

This is the rule I use:

iptables -A FORWARD -p tcp --sport 22 --dport 22 -d 10.0.0.16 -j ACCEPT

After inserting this rule and I try to connect to this server (10.0.0.32) with putty on port 22. I'm getting the error message 'Connection refused'.

When I connect direct to 10.0.0.16 on port 22 I can login to this computer. So my quess it a problem with the forwarding on 10.0.0.32, because the firewall of 10.0.0.16 accepts all connections on port 22.

Even with the firewall off on 10.0.0.16 it still doesn't work. What's wrong with my rule?

Thanks Arian

Last edited by Abstractt; 03-19-2008 at 09:03 AM.
 
Old 03-19-2008, 09:55 AM   #2
yodahome
LQ Newbie
 
Registered: Oct 2007
Posts: 5

Rep: Reputation: 0
I'd suggest the sport is wrong here, I wouldn't specify it simply because it doesn't matter from which the connection comes as long as destination port is 22.
I just googled this description and I think you also need to do NAT: http://www.hackorama.com/network/portfwd.shtml
 
Old 03-19-2008, 10:16 PM   #3
CarLost
Member
 
Registered: Jun 2004
Location: Sentado en mi trasero en Chile
Distribution: ArchLinux
Posts: 45

Rep: Reputation: 16
not not not no NO NONONONONO

You can not forward a request in the same net of the first recipient....

If you forward 10.0.0.A to 10.0.0.B and the request come from 10.0.0.C, the 10.0.0.B will response directly to 10.0.0.C and 10.0.0.C is waiting an answer from 10.0.0.A, so It get some strange things

I suggest you to use a alias to create a kind of fake tunnel between the A and B hosts. And/or NAT to MASQUERADE the requests.

Another thing the source port never is a lower port.

Last edited by CarLost; 03-19-2008 at 10:17 PM.
 
  


Reply

Tags
forward, iptables, port


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
Apache: Forward request to another box? MasterC Linux - Networking 11 12-23-2014 10:37 PM
How2 let apache2 forward the request to another web-server on another machine boomy Linux - Software 9 12-04-2005 04:50 PM
Can forward port 80 but not others capbob Linux - Networking 4 05-20-2005 08:02 PM
A way to forward an IP/Port to another system's IP/Port astroboy5714 Linux - Networking 6 01-26-2004 06:45 PM
Forward port port 80 to lan web server dulaus Linux - Networking 9 10-04-2002 04:45 AM


All times are GMT -5. The time now is 05: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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration