SSH Connection Reset By Peer

If ever you see the following when using SSH and it all seems inexplicable.

Read from remote host www.somehwhere.com: Connection reset by peer

There may be a quick cure (caveat, your mileage may vary). Some routers, i.e. Linksys WRT54G will close a connecting that does not appear busy. So far I have found that if I add

ServerAliveInterval = 300
ServerAliveCountMax = 300


to my /etc/ssh/ssh_config file then everything is fine.

Basically we are send a message to the server every "ServerAliveInterval" seconds and if the client has not had a response after "ServerAliveCountMax" messages then the connection will disconnect. This makes the connection look active to hardware that thinks it's doing you a favour by disconnecting idle connections.

see "man ssh_config" for more details.

I have also noticed the following method but have not tried it

echo 300 > /proc/sys/net/ipv4/tcp_keepalive_time

Add to delicious Digg This Add to My Yahoo! Add to Google Add to StumbleUpon
| | Comments (0)

Leave a comment

About this Entry

This page contains a single entry by Harry published on March 25, 2007 2:14 AM.

Packard Bell Store and Save was the previous entry in this blog.

WWW::Mechanize Fun is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.01