LinuxQuestions.org
Visit Jeremy's Blog.
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 07-28-2008, 02:47 AM   #1
solarbike
LQ Newbie
 
Registered: Mar 2008
Posts: 5

Rep: Reputation: 0
ssh server connection time out


Hi:

I'm a total noob.

I install openssh-server and openssh-client on my desktop, computer A, behind a router.

Using another computer, computer B, behind the same router, I can ssh into computer A using the local IP (192.168.1.*). Next I looked up my global IP address from whatismyip.com, and tried again, this time I got "connection timed out message". My computer A has a static IP. Also, I've enabled port forwarding on port 22 to computer A, which no firewall enabled in the router nor computer A. The following is the print out from netstat and route
Code:
 netstat -tnl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN  
route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
I got ssh working on computer A before, but it doesn't work anymore after I reinstalled ubuntu.
 
Old 07-28-2008, 03:05 AM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
If your router does not support NAT loopback, you cannot use the WAN IP to address your LAN servers. You must use LAN IPs.
 
Old 07-28-2008, 03:14 AM   #3
solarbike
LQ Newbie
 
Registered: Mar 2008
Posts: 5

Original Poster
Rep: Reputation: 0
what does that mean? My computer A is a desktop, it doesn't connect to the router via wireless.

besides, I was able to ssh out to a remote computer that's not behind the router; then while I'm in the shell of the remote host, I tried to ssh back to computer A, that failed.
 
Old 07-28-2008, 03:19 AM   #4
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
Maybe I'm misunderstanding. Let's drop the loose terms.

Show me what works and doesn't work, like this;

From host 192.168.0.2
ssh 192.168.0.1 Works
ssh xxx.xxx.xxx.xxx FAILS


From host 192.168.0.1
ssh 192.168.0.2 FAILS
ssh xxx.xxx.xxx.xxx FAILS
 
Old 07-28-2008, 11:50 AM   #5
solarbike
LQ Newbie
 
Registered: Mar 2008
Posts: 5

Original Poster
Rep: Reputation: 0
EDIT: okay, after I went to bed, next morning ssh magically works again... weired... maybe my router just needs time to get acquainted with computer 'A'...

say computer 'A' has local IP 192.168.1.1, global static IP of 111.111.1.1
computer 'B' has local IP 192.168.1.2 (behind same router as computer 'A')
computer 'C' (remote host), no behind router, has global IP of 222.222.2.2

from computer 'B' (192.168.1.2)
ssh 192.168.1.1 works
ssh 111.111.1.1 doesn't
*** works behind the router ***

from computer 'A'
ssh 222.222.2.2 works
while in the shell of computer 'C' (remote host), ssh 111.111.1.1 doesn't
*** can ssh out, but not in ***

So it seems computer 'A' can ssh out, but anything outside the router can't ssh into computer 'A'

Last edited by solarbike; 07-28-2008 at 11:59 AM.
 
Old 07-28-2008, 11:39 PM   #6
cyclepathology
LQ Newbie
 
Registered: Sep 2007
Location: Seattle, WA
Distribution: Red Hat, Ubuntu, PCLinuxOS, Fedora, Vector Linux, CentOS, HP-UX, Solaris, AIX, FreeBSD
Posts: 28

Rep: Reputation: 15
Quote:
Originally Posted by solarbike View Post
EDIT: okay, after I went to bed, next morning ssh magically works again... weired... maybe my router just needs time to get acquainted with computer 'A'...

say computer 'A' has local IP 192.168.1.1, global static IP of 111.111.1.1
computer 'B' has local IP 192.168.1.2 (behind same router as computer 'A')
computer 'C' (remote host), no behind router, has global IP of 222.222.2.2

from computer 'B' (192.168.1.2)
ssh 192.168.1.1 works
ssh 111.111.1.1 doesn't
*** works behind the router ***

from computer 'A'
ssh 222.222.2.2 works
while in the shell of computer 'C' (remote host), ssh 111.111.1.1 doesn't
*** can ssh out, but not in ***

So it seems computer 'A' can ssh out, but anything outside the router can't ssh into computer 'A'
You probably need to set up your router to forward port 22 to whichever of your local machines you want to be able to ssh in to. This will allow you and every script kiddie in the world to have access to one of your machines.

But maybe I don't understand what you want to have happen.
 
Old 07-29-2008, 12:21 AM   #7
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 39
I scrolled to the related posts at the bottom of this page, and there are some decent ideas in there.
e.g. Check your hosts.deny file.
Can you ping to computer A from C (remote host)?
Also there's a link there that tests whether your ISP is blocking common ports like 22 (but since you could ssh before your reinstall, this shouldn't be a problem).
Anything in /var/log/messages? You could see what error logs appear for incoming ssh attempts from Computer C.
Maybe you allocated a different ip address during your Ubuntu install, and your router is still port forwarding to the old ip address?

Last edited by indeliblestamp; 07-29-2008 at 12:23 AM. Reason: minor edits
 
Old 07-29-2008, 12:54 AM   #8
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
I think the OP's issue has disappeared - see the EDIT at the top of post #5.
 
Old 07-29-2008, 04:10 AM   #9
solarbike
LQ Newbie
 
Registered: Mar 2008
Posts: 5

Original Poster
Rep: Reputation: 0
How do I close this thread?
 
  


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
SSH server allows connection...then hangs Pagoda Gift Shop Linux - Server 4 11-20-2007 05:20 PM
ssh connection refused - trying to set up ssh server at home openSauce Linux - Server 10 10-18-2007 04:38 PM
Server network connection degrades over time mindseye1 Linux - Networking 24 10-26-2005 04:23 PM
ssh connection closed by server m_yates Linux - Security 3 08-10-2005 03:12 PM
SSH - X server connection problem satimis Linux - Networking 5 04-29-2004 02:29 AM


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