Linux tcp keep alive

12월 9th, 2009 by Leave a reply »

ssh는 keepalive 기능이 들어있지만 telnet에는 없어서 무척 짜증이 났는데 tcp의 keep alive를 이용하면 된다.

http://www.dslreports.com/faq/7792

The TCP KeepAlive value is stored in the “proc” filesystem (actually a virtual filesystem maintained by the kernel) under this path:

/proc/sys/net/ipv4/tcp_keepalive_time

The default just happens to be 7200 seconds (same as the BEFSR41 timeout). To defeat NAT it must be something smaller than that, like 1800. Setting it to a really small value like 60 is frowned upon as a bad network administration practice, especially if you are running a server.

So to change it all you need to do is this:

echo “1800″ > /proc/sys/net/ipv4/tcp_keepalive_time

You have to put this in a startup file like “rc.local” to make it permanent.

Advertisement

댓글 남기기