Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 03-08-2004, 06:58 AM   #1
LQ Newbie
Registered: Aug 2003
Location: Netherlands
Distribution: redhat 9
Posts: 4

Rep: Reputation: 0
Port forwarding for ssh

I want to connect to my home computer that is behind a computer serving as router. The proxy server at my work only accepts connections on port 80.
Now I am trying to set up port forwarding on my router, so an incoming connection on port 80 gets forwarded to port 22 on my own computer.

First of all, do you people think this is the right way to do it?

Second, this is my first experience with iptables, which rules do I need to give the router?

These are probably rather straight (port) forward issue but it is giving me a hard time. I thought I had port forwarding enabled but when trying to connect using putty I keep on getting: 503 Service unavailable

Thanks in advance

Old 03-08-2004, 09:11 AM   #2
Senior Member
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
iptables -t nat -A PREROUTING -i eth~ -s x.x.x.x -p tcp --dport 80 -j DNAT --to-destination y.y.y.y:22
iptables -A FORWARD -s x.x.x.x -p tcp --dport 22 -d y.y.y.y -j ACCEPT

Depending on your chain POLICY, you may need the 2nd rule.
x.x.x.x is your office ip number
y.y.y.y is the machine you want to talk to

Rules need to be in a correct order... so -A puts them at the end, -I puts them first.
It may not be correct, so play with them at rule 1 (-I) and move them later to follow your protection rules.


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
SSH Port Forwarding wwnexc Linux - Networking 4 09-29-2005 01:26 AM
SSH Port forwarding WRSpithead Linux - Networking 1 04-18-2005 04:09 AM
Ssh port forwarding? J_Szucs Linux - Networking 1 10-29-2003 04:42 AM
Help with Port Forwarding for SSH mi6 Linux - Networking 6 07-29-2003 12:46 PM
SSH port forwarding tarballedtux Linux - Networking 2 05-29-2002 07:16 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration