LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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-04-2012, 12:33 AM   #1
drkayak
LQ Newbie
 
Registered: Nov 2006
Posts: 13

Rep: Reputation: 0
ssh port 22: Connection timed out (ubuntu 10.04)


I replaced my old desktop with a Dell XPS 8300, on which I installed ubuntu 10.04 (obliterating the Windows partition). I can ssh out from the host to other computers, but I can't ssh or telnet in to the host from outside, always getting the message 'ssh: connect to host ... port 22: Connection timed out'. The host is behind a router on which I'm sure I have port 22 forwarded. I do have 'sshd' running on the host.

This is from the host:

$ ping xx.xx.xx.xxx # works
$ ssh localhost # works
$ ssh -vvv xx.xx.xx.xxx
OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /home/paul/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to xx.xx.xx.xxx [xx.xx.xx.xxx] port 22.
debug1: connect to address xx.xx.xx.xxx port 22: Connection timed out
ssh: connect to host xx.xx.xx.xxx port 22: Connection timed out

$ telnet xx.xx.xx.xxx 22
Trying xx.xx.xx.xxx ...
telnet: Unable to connect to remote host: Connection timed out

$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

$ sudo lsof -i :22
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sshd 830 root 3r IPv4 4034 0t0 TCP *:ssh (LISTEN)
sshd 830 root 4u IPv6 4036 0t0 TCP *:ssh (LISTEN)

$ nc -vv xx.xx.xx.xxx 22
nc: connect to xx.xx.xx.xxx port 22 (tcp) failed: Connection timed out


This is from the host's owner: I'm at my wit's end!!
 
Old 03-04-2012, 02:21 AM   #2
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by drkayak View Post
....
I can ssh out from the host to other computers, but I can't ssh or telnet in to the host from outside, always getting the message 'ssh: connect to host ... port 22: Connection timed out'. The host is behind a router on which I'm sure I have port 22 forwarded. I do have 'sshd' running on the host.

....
Hi,

for the 1st step I would try to stop firewall (# service iptables stop) to see if there might be a problem with firewall

then 2nd step I would try to change the SSH port connection to the host with
# ssh -vv -p 2121 x.x.x.x
of course it means that you need to change the port in sshd_config too to accept connections on different port

If that is the case it works, then your ISP might be blocking port 22 (and probably 21, 80 etc.)

good luck
 
Old 03-04-2012, 10:17 AM   #3
drkayak
LQ Newbie
 
Registered: Nov 2006
Posts: 13

Original Poster
Rep: Reputation: 0
[solved]

Aaarrggh! I found the problem, after many hours. Prompted by lithos' comment, I took a close look at the port forwarding page on my router. The IP address there appeared as 192.168.1.101, and you have the option of replacing the last 3 digits. I had tried 100, 101 and 102. It occurred to me to check 'ifconfig' on the host, where I saw inet addr:192.168.1.103 . I typed in '103' on the router page, and was then able to connect via ssh. I hope some poor soul can benefit from this in the future.
 
Old 03-04-2012, 10:54 AM   #4
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Great,

so could you mark the thread solved for future references (see my signature how ).

Best Regards.
 
  


Reply



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 22 connection timed out dev21082 Linux - Newbie 18 07-17-2013 07:37 AM
ssh: connection to host port: 22: Connection timed out lost connection cucolin@ Linux - Server 4 11-22-2011 06:15 AM
ssh: connect to host port 22: Connection timed out shogun1234 Linux - Networking 1 06-21-2011 12:07 PM
ssh: connect to host XXXX port 22: Connection timed out jv2112 Linux - Newbie 3 07-04-2010 04:42 PM
ssh port 22: Connection timed out ( Unable to Copy file remotly ) bp_vanarse Linux - General 3 04-03-2010 07:53 PM

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

All times are GMT -5. The time now is 03:50 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
Open Source Consulting | Domain Registration