Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 use a macbook pro at home and regularly ssh into the machines at my lab. For the past 3-4 days however, whenever I SSH into the machine in the lab, I get a Write Failed:Broken Pipe error, hardly within 2 minutes of me ssh-ing.

The fact that everything was working perfectly a few days ago baffles me, and any help to get things working again would be much appreciated.

share|improve this question
Are you using ServerAliveInterval or not? If not, try setting it. – 0xC0000022L May 1 '13 at 4:48
Yes, i am. It is set to 30.I tried 15, 30, 60, and it didn't affect the performance (or the lack of it) – NSR May 1 '13 at 12:50
Have you tried 1 SSHing from another machine into the lab to see if it is the macbook? and 2 SSHing from the macbook to another machine to see if it is the lab? finding out which if either has the problem should narrow your solution considerably – Yuugian May 1 '13 at 14:08
Well, I used my laptop to SSH to the same machines from a different network (a university network) and it worked fine. My guess is that there is something weird happening with my home network. – NSR May 2 '13 at 1:08
up vote 4 down vote accepted

This looks like a network problem.

Enquire if some network equipment has changed or has been reconfigured. Tell your network administrator that you're having trouble ssh'ing in, there may be a misconfiguration in a firewall. Try logging in from other machines or to other machines to improve the diagnosis.

One possible cause of these symptoms is an IP address conflict. Check where the client and the server are getting their IP address. If you keep ping server.example.com running, does it help make the connection last longer? If so, you have an IP address conflict. (The ping helps because it keeps telling the routers along the way to route the IP packets to your machine — but you'll still lose the connection if the other machine sends an ARP reply before you.) If this is the problem, you need to fix it: arrange for one of the machines that are using the same address to use a different address.

Also check the routing table on your machine. Make sure that the packets to the server are routed to the proper interface. (While a bad routing table would normally make the connection not work at all, there is an edge case where the symptoms are the ones you describe: if you obtain an address with DHCP and the DHCP server is also the server you're contacting — the address of the DHCP server will be routed to the desired interface until your ARP cache expires.)

share|improve this answer
ah ! pinging an arbitrary server seems to be working (so far). Looks like it was a clash of IP addresses. I will investigate further and look to make sure that this does not happen. Thanks !! – NSR May 2 '13 at 2:06
Hi Gilles, Thanks for the solution given. I'm troubleshooting this issue from 5 days by configuring ssh parameters so on... But didn't worked. Your solution helped me alot. Many thanks. – Rajasekhar Jan 15 at 8:43

This could be due to packet loss. A tool like mtr could help you diagnose which one of the hosts in the route is causing problems. Here you'll find the instructions to install it on Mac OS X.

share|improve this answer
thanks. I will try this and update you. – NSR May 1 '13 at 12:49

I had this problem show up with some servers at the main office and solved it using:

TCPKeepAlive yes
ServerAliveInterval 5

in the ssh config file ( ~/.ssh/config or /etc/ssh/ssh_config).

Only later did I found out that it was caused by some hardware installed to optimize the communication between the offices that interfered.

share|improve this answer

I've solved my problem in Mac OS X , I've changed the

#ClientAliveInterval 0


ClientAliveInterval 300

in /etc/sshd_config following this, and reboot the machine, done.

share|improve this answer

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.