Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have two Ubuntu machines. Both have openssh-client and openssh-server installed on them. ssh-ing from machine G (fresh Ubuntu 11.10 installation) to machine K works great. But ssh-ing from machine K to machine G results always in the Error:

Connect to host some_hostname port 22: Connection timed out

I went through the troubleshooting section of help.ubuntu.com and I got the following results:

ps -A | grep sshd # results in
848 ?        00:00:00 sshd

-

sudo ss -lnp | grep sshd # results in
0   128   :::22   :::*   users:(("sshd",848,4))
0   128   *:22    *:*    users:(("sshd",848,3))

-

ssh -v localhost # works!

-

sudo ufw status verbose # yields: "Status: inactive"

I haven't changed anything in the config file. What can I do to locate the problem and solve it? I would appreciate any hint!

Edit:

ping was succesful in both directions!

I did a telnet <machineK> 22 from machine G which resulted in trying and then in telnet:

Unable to connect to remote host: Connection timed out.

But telnet the other way around worked just fine!

Edit 2:

ssh start/running, process 966 # yields: ssh start/running, process 966

/etc/hostname # contains my hostname, let's call it blubb
/etc/hosts # contains the following
127.0.0.1       localhost
# 127.0.1.1     blubb
129.26.68.74    blubb # I added this!

-

sudo service ufw status # yields: ufw start/running

I installed Gufw and set it to ON. Then I selected from Incoming the option ALLOW. Then I ssh'ed to another machine from where I ssh'ed back to my machine. Still the same error as above: connect to host blubb port 22: Connection timed out

Any more hints, what I can check?

share|improve this question
1  
do a telnet machine G 22 and telnet machine K 22 if one of them is time out then look at sshd, name resolution or firewall. one of those thing could be wrong. –  maniat1k Mar 8 '12 at 9:12
    
@maniat1k: Is telnet something like ping? –  Aufwind Mar 8 '12 at 9:15
    
Is port 22 open on both machines, or are the machines on the same network? –  philipballew Mar 8 '12 at 9:30
    
@philipballew: I may sound silly, but how do I check if port 22 is open? The machines are in the same network. And if this helps: ping is succesful in both directions. –  Aufwind Mar 8 '12 at 9:52
    
@maniat1k: I did a telnet <machineK> 22 from machin G which resulted in Trying 129.26.67.114... and then in telnet: Unable to connect to remote host: Connection timed out. But telnet the other way around worked just fine! Any next steps? Thanks for your support, by the way. :-) –  Aufwind Mar 8 '12 at 10:11

2 Answers 2

So your machineG (the fresh install) is the one with issues:

  • Check sshd if it's up sudo service ssh status.
  • Check Name resolution. The name of your machine, check it if is the same on /etc/hostname, and /etc/hosts.
  • Check firewall. sudo service ufw status maybe is best if you install firewall of ubuntu Gufw.

hi! did you solve it? @philipballew asked you to see if you have port 22 enable.. do this on the 2 machines netstat -nat | grep 22: you will see something like this:

~> netstat -nat | grep 22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      
tcp        0      0 10.202.10.13:53414      173.194.76.125:5222     ESTABLISHED 
tcp        0      0 10.202.10.13:50912      10.100.202.21:22        TIME_WAIT   
tcp        0      0 :::22                   :::*                    LISTEN      

If one of the ports 22 are not listen then re-check all that I previous told you. Actually I'm a bit lots with the names of the machines. You call them in differents names all the time....

share|improve this answer
    
I checked sudo service ssh status which yielded ssh start/running, process 848. Seems nothing wrong with that, right? How do I check name resolution and firewall? –  Aufwind Mar 8 '12 at 14:07
    
updated the answer... hope it could help you –  maniat1k Mar 8 '12 at 15:06
    
Thanks for your effort so far! I added the reply to your suggestions. Still does not work. Perhaps you have some more ideas for me to get this thing to work? :-) –  Aufwind Mar 12 '12 at 13:55
    
I think it would be useful for you to run maniat1k's suggested netstat command on both machines right after the failing command is attempted. Please mention which is which. You should see the LISTEN items on both machines if each is running sshd. There should also be another line with an unusual failure when there is a problem. What are the two IP addresses? Could you also wait to run the commands until they have been idle for a half an hour or so and afterward the test run arp -a to see that they both have an entry for the other. –  John S Gruber May 25 '12 at 3:33
    
Are you really on the network with address 129.26.x.x? That's not a NAT network, but that could, of course, be right if you are at gmd.de. It's not in the netstat, though. –  John S Gruber May 25 '12 at 3:40

Same issue here. I cleared my iptables with iptables -F. Works fine now. Of course you will have to setup rules again if you want to put the iptables up again

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.