In Netstat output, sometimes an ESTABLISHED or LISTEN entry is missing
Issue
- We have a small script calling
netstatcommand to identify socketESTABLISHEDconnection - From time to time that script would report a 'false positive' that an
ESTABLISHEDconnection is missing - After some debugging and extra logging we have identified that this is not the case and to prove it replaced the script with
sscommand. - This proved that the issue was only in the output of
netstat. - Can you please clarify what could be the reason for the files in
/proc/net/tcpnot being written or accessible by thenetstatcommand at the time of its execution? - We found that when executing 'netstat -na', very rarely a LISTEN-state socket is missing from the output. The port is contained in the pure output of cat /proc/net/tcp.
Environment
- Red Hat Enterprise Linux
netstatcommand used to read socket state
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
