Mine the Harvest

Netstat connection timers

by on Apr.29, 2013, under Linux

Netstat is so dang useful.  I 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 - timewait (0.00/0/0)
tcp 0 0 ::ffff:127.0.0.1:8081 ::ffff:127.0.0.1:47343 TIME_WAIT - timewait (43.72/0/0)

Or hows that keepalive going?

[root@gibson ~]# netstat -tonp | grep ESTABLISHED | grep keepalive
tcp 0 0 127.0.0.1:5432 127.0.0.1:54403 ESTABLISHED 13694/postgres keepalive (5846.25/0/0)
tcp 0 0 127.0.0.1:37929 127.0.0.1:5432 ESTABLISHED 4132/pgagent keepalive (5116.28/0/0)

Yeah, but what about how long they have been in CLOSE_WAIT?

[root@gibson ~]# netstat -tonp | grep CLOSE_WAIT
tcp 1 0 127.0.0.1:38736 127.0.0.1:8083 CLOSE_WAIT 29817/httpd off (0.00/0/0)
tcp 1 0 128.219.164.216:44054 128.219.168.138:8080 CLOSE_WAIT 25264/httpd off (0.00/0/0)

Ahhh . . . there is no time out value for CLOSE_WAIT. Darn.

Your current timeout and keepalive settings in seconds:
cat /proc/sys/net/ipv4/tcp_fin_timeout
cat /proc/sys/net/ipv4/tcp_keepalive_time

No comments for this entry yet...

Leave a Reply

You must be logged in to post a comment.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...