Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use Ubuntu 11.04 as desktop OS. I have openssh-server installed and can connect to it from the same computer. I want to use it to create a connection from another computer (on the same local network) to this one. For some reason there is no response. Ufw is inactive. Another computer here with the same setup works. The computer has only one NIC.

Machine A (Ubuntu 11.04)

  • ip: 192.168.1.22
  • Installed SSH-server
  • ufw status: inactive
  • sshd seems to bind to all interfaces
  • ping from machine B to this machine works
  • Tried ssh root@localhost, just to see if that works, which is the case

Netstat results Machine A

unix 2 [ ACC ] STREAM LISTENING 13480 2275/ssh-agent /tmp/ssh-BKiZJjfU2214/agent.2214
unix 2 [ ACC ] STREAM LISTENING 13651 2195/gnome-keyring- /tmp/keyring-VvDtwo/ssh

Log results

09/02/11 10:25:26 AM    ubuntu-a    kernel  [ 5564.741977] Inbound IN=eth0 OUT= MAC=xxxx SRC=192.168.1.44 DST=192.168.1.22 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=45506 DF PROTO=TCP SPT=49089 DPT=22 WINDOW=14600 RES=0x00 SYN URGP=0

Machine B (Ubuntu 11.04)

  • ip: 192.168.1.33
  • installed ssh-server
  • tried to login from machine A, which works
  • tried to login to machine A, which results in a connection timeout

What am I missing here?

share|improve this question
    
From B, try ping 192.168.1.22. If you don't get a reply then SSH is probably not the problem, its probably some other network issue. –  Stacey Richards Sep 2 '11 at 9:44
    
Thanks for the tip. Tried it, and ping works! –  SPRBRN Sep 2 '11 at 10:38
    
Added some more things to try in my answer. –  Stacey Richards Sep 2 '11 at 12:05
add comment

3 Answers

up vote 0 down vote accepted

Run this:

netstat -lepn | grep ssh

In the results you see if the sshd binds to all interfaces or all (0.0.0.0). If it binds only to local interface, then change these settings in /etc/sshd_config:

ListenAddress ::
ListenAddress 0.0.0.0

If you don't see lines like this, then your sshd is not running:

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          8627        674/sshd        
tcp6       0      0 :::22                   :::*                    LISTEN      0          8629        674/sshd        

If this is the case, you can try starting it with:

start ssh
share|improve this answer
    
Netstat results: unix 2 [ ACC ] STREAM LISTENING 13480 2275/ssh-agent /tmp/ssh-BKiZJjfU2214/agent.2214 unix 2 [ ACC ] STREAM LISTENING 13651 2195/gnome-keyring- /tmp/keyring-VvDtwo/ssh –  SPRBRN Sep 1 '11 at 13:12
    
I'm not sure what these results mean. –  SPRBRN Sep 1 '11 at 13:13
    
Please edit your question, this is unreadable. UNIX sockets work only on the local machine. –  Turbo J Sep 2 '11 at 4:44
    
Question is updated! –  SPRBRN Sep 2 '11 at 8:23
    
Check the netstat lines I posted - you don't have ssgd running. Ie. ssh server is not bound to any TCP/IP port. –  Zds Sep 2 '11 at 9:26
add comment

It certainly doesn't make scene that you can make an SSH connection from your own PC and not a different PC on the same network after installing openssh-server (assuming you haven't changed the default settings and there's no magic on the network stopping the connection from getting through).

The first thing that I would do is check to make sure SSH is listening on all Ethernet adapters (and not just localhost). You can do this with netstat, listing numbers rather then service names (-n) using TCP (-t) that are listening (-l) and passing the results to grep searching for :22 which is the port that SSH listens on by default:

netstat -ntl | grep :22

You should get the following result:

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN 

If you don't get that result then that's possibly your first problem. Checking that the SSH server has in fact started (restart with sudo server ssh restart) is the first thing I would try (but that's probably not the case for you as you can connect from localhost). The second thing I would look at is the SSH server configuration is in order.

If that is the result that I got from netstat then I can assume that the SSH server is listening on all Ethernet adapters which would mean that connections from other PC on the same network should work.

The next thing I would look at is the the IP address of the PC to ensure that I'm specifying the correct IP address from the PC that I'm trying to connect from. ifconfig should give me the information that I need.

On my PC, ifconfig gives me:

eth0      Link encap:Ethernet  HWaddr 00:26:9e:e8:cf:31  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:42 Base address:0xc000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4239 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4239 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1341552 (1.3 MB)  TX bytes:1341552 (1.3 MB)

wlan0     Link encap:Ethernet  HWaddr c4:17:fe:3c:aa:d7  
          inet addr:192.168.1.66  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::c617:feff:fe3c:aad7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:54149 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24983 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:29122251 (29.1 MB)  TX bytes:4707094 (4.7 MB)

This shows me that my eth0 doesn't have an IP address (because it's not connected) and that my wireless adapter, wlan0 has the IP address 192.168.1.66. This is the IP address that I need to use to connect from another PC on the same network.

On another PC, assuming I have logged in with the same username as I have on the "problem" PC, I would connect from a terminal with:

ssh 192.168.1.66

Still doesn't work?

Next thing to try is check if there is any kind of network communication between the PCs. Trying pinging the "problem" PC from the other one. If you can't get a ping reply then it's probably not an SSH issue but rather a network issue.

Another thing you could try... Some months back, I had a problem trying to print to my wireless printer from my laptop. Turned out to be the wireless router causing the problem. After a router reboot printing was up and running again. Have you tried rebooting your router?

Still no luck?

Ok, now we'll try sudo tcpdump on machine A. We want to dump all packets with the source IP address 192.168.1.33 (machine B) that are coming in on port 22 over eth0 (assuming your network adapter is eth0):

sudo tcpdump -i eth0 src host 192.168.1.33 and dst port 22

Now on machine B try:

ssh 192.168.1.22

Does tcpdump produce any output?

We could also try telnet from machine B to try to connect to port 22 on machine A:

telnet 192.168.1.22 22

This should produce something like:

user@machineb:~$ telnet 192.168.1.22 22
Trying 192.168.1.22...
Connected to 192.168.1.22.
Escape character is '^]'.
SSH-2.0-OpenSSH_5.8p1 Debian-1ubuntu3

Can any other computers connect to machine A?

Can machine B connect to any other computers?

share|improve this answer
    
Thanks for your reply. Connecting from localhost was only to test if anything works. Netstat gives the same results as yours. I have checked the ip-address, and I have used the correct address when I tried to connect from the other computer. –  SPRBRN Sep 1 '11 at 14:37
add comment

Do a tcpdump -nvvvli ethX port 22 or icmp on the Ubuntu 11.04 (replace ethX with the name of your network device, e.g., eth0). See if the connection on port 22 (ssh) hits it and if it answers correctly (not ICMP and not TCP RST).

share|improve this answer
    
I get the following back: tcpdump: ethX: No such device exists (SIOCGIFHWADDR: No such device) –  SPRBRN Sep 1 '11 at 13:15
    
By "ethX" he meant the name of your network device, whatever it is. –  David Schwartz Sep 1 '11 at 18:52
    
So there is no network device? Please explain this a bit more. –  SPRBRN Sep 2 '11 at 8:01
add comment

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.