Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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 a very frustrating problem with a new server I built.

On every machine that SSHes in (or any other connection), the connection gets dropped randomly between immediately, and 30 minutes into the session, while the user is actively using the system remotely (typing, etc). Before, during and after the disconnection, the system responds to pings regularly (0% packet loss).

It takes about 5-10 minutes before I can make a connection again.

I have tried restarting SSH, apache, etc on the server and rebooting the server. I even removed and reinstalled these services and this still happens. I have disabled iptables, ufw and removed firestarter.

What might be causing these random disconnects?

share|improve this question
Could it be a (broken / misconfigured) router between your machines which is dropping connections? – Lekensteyn Jul 24 '11 at 8:11
Perhaps, but it is only occurring with this one server. I have others that respond correctly. – Ryan Rosario Jul 24 '11 at 18:43
up vote 1 down vote accepted

I have experienced symptoms similar to this before. Not certain of why you cannot reconnect until after 5-10 minutes. I'll guess and say it is a firewall configuration between you and the Ubuntu box allowing only so many orphaned connections until a specific time threshold expires. I've seen this in the Cisco ASAs and OpenBSD's PF.

On any *nix box I admin, I enter the following into /etc/ssh/ssh_config to keep my connections alive

ServerAliveInterval 180

FYI...this is entered on the client and not the server. Your mileage my vary so you might have to raise or lower this value. Hope that helps.

share|improve this answer
This happens on ALL incoming connections, not just SSH. – Ryan Rosario Jul 24 '11 at 18:36
You need to check the following then:Duplicate IP, Firewall Config, Interface flapping – Aric Jul 24 '11 at 19:12
There were a few things. First, the IP was conflicting. Even though I configured the trouble IP with a different MAC in the router, neither the router nor the other machine would give up the IP address. In my testing, I swapped cables. Unfortunately, that cable had a bad crimp and damaged a pin on the NICs. I was able to bend it back and it works, but I will need to buy another card for the future. This was causing NO DHCPOFFERS error message. – Ryan Rosario Jul 25 '11 at 20:56

Your Answer


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.