Linux increasing or decreasing TCP sockets timeouts
Some time it is necessary to increase or decrease timeouts on TCP sockets. You can use /proc/sys/net/ipv4/tcp_keepalive_time to setup new value.
The number of seconds a connection needs to be idle before TCP begins sending out keep-alive probes. Keep-alives are only sent when the SO_KEEPALIVE socket option is enabled. The default value is 7200 seconds (2 hours).
For example set value to 2400 seconds:
echo 2400 > /proc/sys/net/ipv4/tcp_keepalive_time
You can make changes to /proc filesystem permanently using /etc/sysctl.conf
Further reading
- See man page of ip(7) and tcp(7) for more details.
- Securing and Optimizing Linux book (by OpenNA), network optimization chapter
Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
You may also be interested in other helpful articles:
- FreeBSD List / Display Open Ports With sockstat Command
- Understanding Linux networking stack ~ from sockets to device drivers
- Linux Increase Process Identifiers Limit with /proc/sys/kernel/pid_max
- Get Detailed Information About Particular IP address Connections Using netstat Command
- The interview with Linus Torvalds (Q & A)
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!


Recent Comments
Yesterday ~ 4 Comments
Yesterday ~ 12 Comments
Yesterday ~ 6 Comments
Yesterday ~ 21 Comments
Yesterday ~ 1 Comment