LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-29-2004, 09:07 PM   #1
gauntalus
Member
 
Registered: May 2004
Location: Hillsdale, MI
Distribution: gentoo 2004.3
Posts: 135

Rep: Reputation: 15
Configure SSHD behind a router


Hey I've been trying to set up SSHD on my linux box in my house. I have three computers connected to a router that's connected to my cable modem. I've installed OpenSSH, and from a terminal as root I've run sshd, so from my limited understanding of linux I would assume my computer is running SSHD and I should be able to connected to it from other computers in my home.

However, whenever I try connecting using Secure Shell from www.ssh.com, it gives me an error message:

Code:
The host 'myIpAddress' is unreachable.
The host may be down, or there may be a problem with the network connection.
Sometimes such problems can also be caused by a misconfigured firewall.
Now I tried disabling both firewalls to make sure that wasn't the problem, and nothing changed, so I figured something was misconfigured. I haven't the slightest Idea what's causing the problem, and I've looked around the internet for a fix unsuccessfully. I read a few things that mentioned something called "port forwarding" but I have no idea what it is or if it ever pertains to my situation, help! thanks.

 
Old 05-29-2004, 11:23 PM   #2
darin3200
LQ Guru
 
Registered: Dec 2002
Distribution: Gentoo!
Posts: 1,153

Rep: Reputation: 45
You will probably need port fowarding. This is just letting a port through or letting a connection on port 22 go to a different number. Why kind of router do you have?
 
Old 05-30-2004, 12:43 AM   #3
gauntalus
Member
 
Registered: May 2004
Location: Hillsdale, MI
Distribution: gentoo 2004.3
Posts: 135

Original Poster
Rep: Reputation: 15
Ok, is port forwarding something I need to set up on the linux machine or on my router? BTW the router I have is a Hawking Technoligies PN9235.
 
Old 05-30-2004, 02:16 PM   #4
darin3200
LQ Guru
 
Registered: Dec 2002
Distribution: Gentoo!
Posts: 1,153

Rep: Reputation: 45
Port forwarding is something done at the router. According to their site , questions #3, their routers do have port forwarding. I am not to familiar with hawking routers, but you will probably need to get into the router configuration and look for something about port forwarding and forward connection from ssh port 22 to 22 and you might have to assign the ip address of the computer you want it forwarded to. That should open up your router to ssh connections.
 
Old 05-30-2004, 03:26 PM   #5
phlogistonjohn
LQ Newbie
 
Registered: Jul 2003
Location: MA, USA
Distribution: Mandrake,Debian,Zaurus
Posts: 17

Rep: Reputation: 0
Annoyingly not all router mfrs. call it port forwarding. I couldn't find your model with a quick search, so you'll probably have to refer to the manual. What I'd look for is a screen (if you've got a web based interface) or command where you can specify a port number along with an IP address and another port number.

You should set both ports to 22 and the IP to that of the computer you have OpenSSH set up on.

In order to make sure you have OpenSSH set up and running, you can sit at the terminal of your linux machine and telnet to port 22 (use 'telnet localhost 22') if you see the OpenSSH banner something like "SSH-Y.XX-OpenSSH_Z.Z.Z" then you can close telnet, because the server is sending the banner correctly. If you've got another machine on the network, you can similarly try telnet, just change the hostname.

One other note, mandrake provides a command '/sbin/service' which you can use to start & stop daemons (services). So you don't always have to start the server manually. But it is a good idea to when you are just trying to get it to work.
 
Old 05-30-2004, 04:37 PM   #6
statmobile
Member
 
Registered: Aug 2003
Location: Chapel Hill, NC
Distribution: Gentoo, Windows 95 2000 & XP
Posts: 160

Rep: Reputation: 30
I'm not positive about this, but your router shouldn't really have to port forward if you are connecting within your network. The firewall on my router is not setup for port forwarding, and I can login to the other machine no problem Here's the problem with the port forwarding on some routers, it is that you can no longer assign dynamic addresses to each machine connected to the router, which could be a pain in the butt if you're not familiar with assigning static ips.

First things first in dealing with this potential issue...
Are you sure that you are trying to connect to the right IP address? On the ssh server, run /sbin/ifconfig or /usr/sbin/ifconfig. You shouldn't need to be root in order to run this, then write down the IP address for eth0. Now making sure that sshd is running on this machine, try to ssh into it from your other machine.
 
Old 05-30-2004, 04:51 PM   #7
gauntalus
Member
 
Registered: May 2004
Location: Hillsdale, MI
Distribution: gentoo 2004.3
Posts: 135

Original Poster
Rep: Reputation: 15
haha, oh wow I'm an idiot, i was trying to connect to the routers ip address i think. To find my ipaddress before I was just going to www.whatismyip.com. Once I use ifconfig i found my box's true ip address and now its working great.

Thank you everyone for the help, peace
 
Old 05-30-2004, 05:07 PM   #8
statmobile
Member
 
Registered: Aug 2003
Location: Chapel Hill, NC
Distribution: Gentoo, Windows 95 2000 & XP
Posts: 160

Rep: Reputation: 30
Yeah, I think the ip address you are getting from that website is the ip address of your router. That's whyat you would need to be able to ssh into your machine from outsitde of your network. This is what I was talking about earlier. To login from anywhere, check the router documentation about port forwarding, because it may require that you turn off dhcp settings, and assign static ips to each computer on the router. After that, you can forward the TCP port for ssh (I believe it's 21) to that particular computer. Then use the ip from the web site and login this way. I got as close as this to settting up my ssh server, but unfortunately my landlord owns the router, and I can't just turn off dhcp for everyone in the apartment complex. Dangit!
 
Old 05-31-2004, 02:25 PM   #9
gauntalus
Member
 
Registered: May 2004
Location: Hillsdale, MI
Distribution: gentoo 2004.3
Posts: 135

Original Poster
Rep: Reputation: 15
ok, i haven't had a chance to try and login from outside my network yet, but i'm looking into port forwarding for that. My current goal is to get apache up and running on the linux computer now, so I assume that will require port forwarding as well. I'll figure it out eventually. Its tough when i can only accessthe network from my home, i need to go to a friends house or something.
 
  


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
configure sshd aroop Linux - Networking 2 09-05-2004 02:49 AM
how to setup/configure sshd pfaendtner Linux - Newbie 1 07-09-2004 05:18 PM
How to configure SSHD behind a Firewall? sbogus Linux - Newbie 2 05-18-2004 08:37 AM
configure my router alaios Linux - Networking 4 03-18-2004 01:20 PM
Enabling SSH in mandrake 9.2 - sshd vs. sshd-xinetd DogTags Linux - Newbie 7 11-25-2003 01:17 PM


All times are GMT -5. The time now is 09:25 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration