The Linux netstat command looks at the method for the number of concurrent connections

  • 2020-05-13 04:21:29
  • OfStack

introduce

Number of concurrent connections is to point to a firewall or proxy server to its business information processing ability, is a firewall can handle the maximum number of point-to-point connections at the same time, it reflects the firewall device access control of multiple connections and connection status tracking ability, the size of the parameters directly affect the firewall can support one of the biggest information points.

Implementation method

Use the following command to view the status of various connections in groups:


netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

 explain :

 Sample results returned:  
LAST_ACK 5  ( Number of requests waiting to be processed ) 
SYN_RECV 30 
ESTABLISHED 1597 ( Normal data transfer status ) 
FIN_WAIT1 51 
FIN_WAIT2 504 
TIME_WAIT 1057 ( The number of requests waiting for the timeout to end after processing ) 
 
 Status: description  
CLOSED : connectionless is active or in progress  
LISTEN : the server is waiting for an incoming call  
SYN_RECV : 1 Three connection requests have arrived, waiting for confirmation  
SYN_SENT : the application has started, open 1 A connection  
ESTABLISHED : normal data transmission status  
FIN_WAIT1 : the app says it's done  
FIN_WAIT2 : the other 1 Bian has agreed to be released  
ITMED_WAIT : wait for all groups to die  
CLOSING : try to close both sides  
TIME_WAIT : the other 1 Edges are initialized 1 A release  
LAST_ACK : wait for all groups to die 

Use the above command to view the server's connection status, where ESTABLISHED is the number of concurrent connections displayed. If you don't want to see so many connections, but just want to see the number of concurrent connections, you can simplify 1 by saying:


netstat -nat|grep ESTABLISHED|wc -l
1164

The number returned is the current number of concurrent connections.

conclusion

The above is the whole content of this article, I hope the content of this article to your study or work to bring 1 definite help, if you have questions you can leave a message to communicate.


Related articles: