Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an Ubuntu Server 10.10 32-bit in my home. I'm making SSH connections to it from my PC via Putty.

The problem is, sometimes I'm able to login seamlessly. However, sometimes it gives me an error like this: Network error: Connection refused.

Then, I dont't change anything, try to login a few times more, wait a while and try again. Sometimes I can log in, sometimes I cannot. It seems pretty random to me.

What can I do to solve this?


And Sometimes, Putty gives Network error: Software caused connection abort error after displaying login as: text.

Here is the ping -t output:

Pinging with 32 bytes of data:
Reply from bytes=32 time=6ms TTL=64
Reply from bytes=32 time=65ms TTL=6
Reply from bytes=32 time=88ms TTL=6
Reply from bytes=32 time=1ms TTL=64
Reply from bytes=32 time=3ms TTL=64
Reply from bytes=32 time=1ms TTL=64
Reply from bytes=32 time=1ms TTL=64
Reply from bytes=32 time=1ms TTL=64
Reply from bytes=32 time=1ms TTL=64

I turned off firewall of router, and everything seems to work now. Except for that, I still can't enter my web server by typing external IP from my PC.

share|improve this question
next time it craps out like that; run a ping on it again, does it still work? how many people ssh to this machine? – myusuf3 Mar 13 '11 at 4:33
Only I ssh this server. – frbry Mar 13 '11 at 12:03
Exactly the same problem here, also getting a mix of successful connects (which then work for hours), 'connection refused' and 'software caused connection abort' after the login or password entry. To provide some additional details: in my case it's a 64-bit virtual machine (running Ubuntu Server 10.10) on a Microsoft Hyper-V host, using the "old network card" emulation. – hheimbuerger Mar 31 '11 at 12:24
SSH is installed on your server? – Will Jan 8 '14 at 18:27

10 Answers 10

IP address conflict turned out to be the root cause when I was seeing this SSH error message.

After reading the answers above I suspected an IP address conflict, but needed to prove that address conflict was or was not the problem.

This great article showed how to use arp-scan to see if two pieces of hardware were claiming the same IP address.

In my case the server machine had a static ip address of, I used arp-scan to check that address:

$ sudo apt-get install arp-scan
$ arp-scan -I eth0 -l | grep d4:eb:9a:f2:11:a1 (Unknown) f4:23:a4:38:b5:76 (Unknown) (DUP: 2)

Sure enough there was a conflict, as shown above. Then I ran arp-scan without the grep, found that .43 was available, went and edited /etc/network/interfaces and changed the static ip from .42 to .43

share|improve this answer
Actually running that command showed only one line on my box, except that the name was that of another device. – assylias Jul 25 '12 at 23:26
Thank you so much for the point in the right direction about IP address conflict. Had a similar problem! +1 – DominikAngerer Jan 10 '15 at 2:47
Just saved me so much time... kudos... – Chris Barlow Jul 8 '15 at 19:31
saved me a lot of time too, thank you – mangguo Apr 12 at 15:55

You must install openssh-server on Linux before this will work. Get the internal IP address of Ubuntu and use that IP to setup port forwarding on port 22 (SSH) section of your router. Although if you don't intend to SSH from outside your network, this is not required.

Here's how to install openssh-server:

sudo apt-get install openssh-server openssh-client
share|improve this answer
Does not answer the question directly but this is useful as Ubuntu does not come pre-installed with SSH server. – Ostati Dec 30 '15 at 17:50
I recently got a new laptop and totally forgot it's not installed by default =D – Izkata Apr 5 at 14:31

I had the same problem, even though I had a static IP address. Turns out another server on my network had been assigned the same (static) IP address. (Duh.) So it does appear that the problem is caused by IP address conflicts, but there may be various possible ways they can happen. If you set yours to static and still have a problem, try shutting down your machine and pinging the address. If you get any replies, start looking for what else could have the same address.

share|improve this answer
I experienced the same symptoms and tracked it down to a machine with the same IP address as the server. – SabreWolfy Dec 7 '11 at 15:05

Use arping on the IP address that is having connection issues. That will show the MAC address for each ping reply, and hopefully will unmask the rogue MAC address.


You should check the DHCP IP address pool on the DHCP server, make sure no devices have static IPs that collide with the DHCP pool.

These clues point to duplicate IP:

  • ping ttl and round trip time looks like 2 distinct servers
  • intermittent disconnects without rebooting
share|improve this answer

This looks more of a problem of your network equipment than the server itself.

Check /var/log/messages for ethernet link up/downs (or wlan in case of wireless). If so try changing the cables.

share|improve this answer
Yes, i tried and succeeded in making an ssh connection from outside of my network (which my server and my PC are located in). It seems working well. My server is also a web server. When I try to connect over port 80 from my PC, i see my ADSL modem's login page. But when I try the same thing from another computer which is outside my network, I see Apache's It Works page. – frbry Mar 12 '11 at 19:08
What is you PC ip, your server ip and your internal adsl router ip? – forcefsck Mar 12 '11 at 19:22
PC: (Received from DHCP) Server: (Static, out of DHCP range) ADSL Router: – frbry Mar 12 '11 at 19:24
I'm a bit confused, when you connect from to port 80 you get the adsl modem's login? – forcefsck Mar 12 '11 at 19:54
Unless you have setup some kind of web proxy to your server, then clearly your adsl modem is responding to requests made to and probably that's the case when you get the Connection refused error with ssh. So you have to recheck the settings of your adsl modem. – forcefsck Mar 12 '11 at 20:27

I can confirm this exact issue: It's not a simple connectivity issue. The ethernet link does not change state; server is reachable via ping; ssh connects flawlessly occasionally, then seemingly randomly does not connect or existing ssh session drops. This occurs on Ubuntu 10.04 and 11.04. Following hheimbuerger's suggestion I gave the server a static IP, this seemed to fix it.

Workaround: Change adapter from DHCP to static.

share|improve this answer

I had exactly the same issue, and in my case it turned out to be an IP address conflict. My Ubuntu VM had a dynamic address, but another machine (in this case a phone) had a static IP assigned that the DHCP server did not know about.

Just changing the IP that was assigned by the DHCP server to the Ubuntu VM fixed all connection issues.

share|improve this answer

What do you get if you do this :-

cat /etc/hosts.deny |  grep

If that returns anything then you need to remove it.

share|improve this answer
That's one of the infamous "useless uses of cat" - you can simply grep /etc/hosts.deny – Tobias Kienzler Feb 26 '14 at 8:19

You might want to check your iptables rules on your server. It sounds like you've a rule for limiting new SSH connections.

The next rule allows 5 new connections per minute, if you exceed this limit, your new connections will be rejected after some time has passed:

-A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW -m limit --limit 5/min -j ACCEPT

See the IPTables / Netfilter documentation, scroll a bit till limit.

share|improve this answer

It's basically because of any one of the following reasons:

  1. Too many users on the network trying to access the server
  2. More than one computer on the network has the same IP as the server causing an IP conflict
  3. Wrong username or your credentials have been revoked
share|improve this answer

protected by Community Jan 8 '14 at 18:47

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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