{"id":845,"date":"2013-04-29T18:10:20","date_gmt":"2013-04-29T22:10:20","guid":{"rendered":"http:\/\/www.timelordz.com\/blog\/?p=845"},"modified":"2013-04-29T18:10:20","modified_gmt":"2013-04-29T22:10:20","slug":"netstat-connection-timers","status":"publish","type":"post","link":"https:\/\/www.timelordz.com\/blog\/2013\/04\/netstat-connection-timers\/","title":{"rendered":"Netstat connection timers"},"content":{"rendered":"<p>Netstat is so dang useful. \u00a0I never knew it had the ability to report connection timers. Netstat, I love you.<\/p>\n<p>From:<br \/>\nhttp:\/\/unix.stackexchange.com\/questions\/10106\/orphaned-connections-in-close-wait-state<br \/>\nhttp:\/\/www.sunmanagers.org\/pipermail\/summaries\/2006-January\/007068.html<\/p>\n<p>How long have those connection been there anyway?<\/p>\n<p><span style=\"color: #3366ff;\"><code>[root@gibson ~]# netstat -tonp<br \/>\ntcp 0 0 ::ffff:127.0.0.1:8081 ::ffff:127.0.0.1:46181 TIME_WAIT - timewait (0.00\/0\/0)<br \/>\ntcp 0 0 ::ffff:127.0.0.1:8081 ::ffff:127.0.0.1:47343 TIME_WAIT - timewait (43.72\/0\/0)<\/code><\/span><\/p>\n<p>Or hows that keepalive going?<\/p>\n<p><span style=\"color: #3366ff;\"><code>[root@gibson ~]# netstat -tonp | grep ESTABLISHED | grep keepalive<br \/>\ntcp 0 0 127.0.0.1:5432 127.0.0.1:54403 ESTABLISHED 13694\/postgres keepalive (5846.25\/0\/0)<br \/>\ntcp 0 0 127.0.0.1:37929 127.0.0.1:5432 ESTABLISHED 4132\/pgagent keepalive (5116.28\/0\/0)<\/code><\/span><\/p>\n<p>Yeah, but what about how long they have been in CLOSE_WAIT?<\/p>\n<p><span style=\"color: #3366ff;\"><code>[root@gibson ~]# netstat -tonp | grep CLOSE_WAIT<br \/>\ntcp 1 0 127.0.0.1:38736 127.0.0.1:8083 CLOSE_WAIT 29817\/httpd off (0.00\/0\/0)<br \/>\ntcp 1 0 128.219.164.216:44054 128.219.168.138:8080 CLOSE_WAIT 25264\/httpd off (0.00\/0\/0)<\/code><\/span><\/p>\n<p>Ahhh . . . there is no time out value for CLOSE_WAIT. Darn.<\/p>\n<p>Your current timeout and keepalive settings in seconds:<br \/>\n<span style=\"color: #3366ff;\"><code>cat \/proc\/sys\/net\/ipv4\/tcp_fin_timeout<br \/>\ncat \/proc\/sys\/net\/ipv4\/tcp_keepalive_time<\/code><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Netstat is so dang useful. \u00a0I never knew it had the ability to report connection timers. Netstat, I love you. From: http:\/\/unix.stackexchange.com\/questions\/10106\/orphaned-connections-in-close-wait-state http:\/\/www.sunmanagers.org\/pipermail\/summaries\/2006-January\/007068.html How long have those connection been there anyway? [root@gibson ~]# netstat -tonp tcp 0 0 ::ffff:127.0.0.1:8081 ::ffff:127.0.0.1:46181 TIME_WAIT &#8211; timewait (0.00\/0\/0) tcp 0 0 ::ffff:127.0.0.1:8081 ::ffff:127.0.0.1:47343 TIME_WAIT &#8211; timewait (43.72\/0\/0) Or hows [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-845","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.timelordz.com\/blog\/wp-json\/wp\/v2\/posts\/845","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.timelordz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.timelordz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.timelordz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.timelordz.com\/blog\/wp-json\/wp\/v2\/comments?post=845"}],"version-history":[{"count":2,"href":"https:\/\/www.timelordz.com\/blog\/wp-json\/wp\/v2\/posts\/845\/revisions"}],"predecessor-version":[{"id":847,"href":"https:\/\/www.timelordz.com\/blog\/wp-json\/wp\/v2\/posts\/845\/revisions\/847"}],"wp:attachment":[{"href":"https:\/\/www.timelordz.com\/blog\/wp-json\/wp\/v2\/media?parent=845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.timelordz.com\/blog\/wp-json\/wp\/v2\/categories?post=845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.timelordz.com\/blog\/wp-json\/wp\/v2\/tags?post=845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}