I'm unable to ssh from a particular machine, either from my Ubuntu 12.04 install or my Windows Vista install (using putty). I'm trying to ssh into a remote machine where I have an account, but I keep getting a "connection refused" error. However, from another computer in my office using the same setup, I can connect just fine

Here is the ouput of dig sun.chpc.ac.za:

; <<>> DiG 9.8.1-P1 <<>> sun.chpc.ac.za
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55409
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;sun.chpc.ac.za. IN A
sun.chpc.ac.za. 2598 IN A
;; Query time: 1 msec
;; WHEN: Tue Oct 30 21:40:35 2012
;; MSG SIZE rcvd: 48
"nslookup sun.chpc.ac.za" Server: Address:
Non-authoritative answer: Name: sun.chpc.ac.za Address:

I stopped the Firewire and tried to ssh, but it still said "connection refused"

When I run nmap sun.chpc.ac.za:

Starting Nmap 5.21 ( http://nmap.org ) at 2012-10-30 22:24 SAST 
Nmap scan report for sun.chpc.ac.za ( 
Host is up (0.0044s latency). 
Not shown: 998 closed ports 
1863/tcp filtered msnp 
2000/tcp filtered cisco-sccp
Nmap done: 1 IP address (1 host up) scanned in 2.81 seconds

Here is the output of the coommand: ssh -vvv [email protected]

OpenSSH_5.9p1 Debian-5ubuntu1, 
OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to sun.chpc.ac.za [] port 22.
debug1: connect to address port 22: Connection refused
ssh: connect to host sun.chpc.ac.za port 22: Connection refused

Here is the ipconfig output of the Windows computer that can connect:

Windows IP Configuration

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::f988:68a0:c432:d37c%11
   IPv4 Address. . . . . . . . . . . :
   Subnet Mask . . . . . . . . . . . :
   Default Gateway . . . . . . . . . :

Tunnel adapter Teredo Tunneling Pseudo-Interface:
   Connection-specific DNS Suffix  . :
   IPv6 Address. . . . . . . . . . . : 2001:0:5ef5:79fb:3403:122f:53eb:f0cc
   Link-local IPv6 Address . . . . . : fe80::3403:122f:53eb:f0cc%12
   Default Gateway . . . . . . . . . : ::

Tunnel adapter isatap.{C3E90CF9-5991-4463-AC91-A1497807E5D6}:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Using the same cable, here is the ifconfig output of my Linux laptop that can not connect:

eth0      Link encap:Ethernet  HWaddr 00:14:0b:3f:b9:4c  
      UP BROADCAST MULTICAST  MTU:1500  Metric:1
      RX packets:135737 errors:0 dropped:0 overruns:0 frame:0
      TX packets:111352 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:155954649 (155.9 MB)  TX bytes:10990034 (10.9 MB)

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

wlan0     Link encap:Ethernet  HWaddr 00:13:e8:f8:0e:af  
      inet addr:  Bcast:  Mask:
      inet6 addr: fe80::213:e8ff:fef8:eaf/64 Scope:Link
      RX packets:1885246 errors:0 dropped:0 overruns:0 frame:0
      TX packets:196008 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:430638332 (430.6 MB)  TX bytes:36583180 (36.5 MB)

The output of tcptraceroute sun.chpc.ac.za 22 is:

Selected device eth0, address, port 51859 for outgoing packets

Tracing the path to sun.chpc.ac.za ( on TCP port 22 (ssh), 30 hops max

 1  0.494 ms  0.431 ms  0.354 ms
 2  * * *
 3 [closed]  0.323 ms  0.326 ms  0.312 ms
  • What's different between the machines that can connect and the machines that can not? We can only see the output you've posted for the machine that can't connect.
    – jw013
    Nov 1, 2012 at 20:14

3 Answers 3


The port is closed on the target machine. You cannot connect through.

Check the firewall settings on the target machine (or on the network infront of it) and open the required port from the IP which your laptop uses.

  • He says that he can connect from his desktop using the same office network
    – Hex
    Nov 1, 2012 at 16:08
  • 2
    He says he's using "the same putty" and never mentiones if it's the same network and/or IP.
    – mulaz
    Nov 1, 2012 at 16:10
  • The target machine is a cluster that allow access from any where. My laptop is using the same wire network connection that the desktop computers are using. I know that the problem is with my Laptop since other Desktop computers using the same network connection can access the cluster. I am not too knowledgeable about network problem, I request for more explicit solution. Thanks.
    – Adebayo
    Nov 1, 2012 at 19:46

nmap is telling you that ssh is not reachable. Check the IP address of the machine that can connect and compare it to the your machine. You could be on separate subnets, or it may be connecting though a pinhole in a firewall.

Try tcptraceroute to test where ssh is being dropped. You will need to install the tcptraceroute package if it isn't already installed. Compare the results connecting to port 22 and one of the open ports. This should indicate where ssh is being blocked.

EDIT: It is also possible that SSH is configured to accept connections from only specific addresses. This can be done with either the sshd_config file or tcp wrappers.

Looking at your updadate, you are on an different subnet. It is quite likely the wireless subnet you are on is not permitted access. If you are on the guest wireless network, I would expect it to be blocked. Connecting to the the secure network may provide better access, but requires credentials. If you have an active port you can plug into, you may have more success on the wired neetwork.

  • You should be able to do traceroute -T to use SYN packets instead of ICMP/UDP packets.
    – FloppyDisk
    Nov 2, 2012 at 17:14
  • traceroute -T --port 22 would work also, but by default requires root access. tcptraceroute works without root access.
    – BillThor
    Nov 2, 2012 at 21:34

Confirm that the IP address of your laptop is on the same network as the machine that SSH works from. If they are different networks, then you may either have to change your IP on the laptop or allow SSH connections from the IP of the laptop.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .