Network-related command tool

# Netstat command
netstat command for displaying IP, TCP, UDP and ICMP statistics related generally to network connection of each port of the unit test. netstat is a program to access the network and related information in the kernel, it provides TCP connection, TCP and UDP monitoring, reporting processes related to memory management.


This section shows the TCP link

Use netstat -r to see the routing information

 

 

 When viewing ports and connections, they can view the corresponding process name and process ID for system administrators is very helpful. For chestnuts, Apache httpd service is open 80 port, if you want to see if http service has been launched, or http services are provided by apache or nginx start, this time you can take a look at the process name.

usenetstat -nlpt查看端口和连接

 

Statistical data port using netstat -s

 

 

 

 Use netstat -ntulp | grep 80 See all 80 ports usage

 

 

 

Detailed netstat in all states

CLOSED original (non-connected) state.
LISTEN listening state, waiting for the connection request to the remote machine.
During the SYN_SEND TCP three-way handshake, the active connection sends a SYN packet into SYN_SEND state and wait for an ACK packet.
SYN_RECV during the TCP three-way handshake, the initiative to connect the client receives the SYN packet, enter SYN_RECV state.
After ESTABLISHED complete the TCP three-way handshake, end active connections entering ESTABLISHED state. In this case, TCP connection has been established, you can communicate.
When TCP four wave FIN_WAIT_1, active close the rear end of the transmission packet FIN, the state enters FIN_WAIT_1.
When TCP four wave FIN_WAIT_2, active close the rear end of the ACK packet is received, enters FIN_WAIT_2 state.
After four TCP TIME_WAIT when waved, shut initiative sends an ACK packet into the TIME_WAIT state, waiting for the most MSL time, so that the closed end of the passive ACK packet is received.
After four TCP CLOSING during waving active close sends a FIN packet, the corresponding ACK packet is not received, but the other side of the FIN packet received this time into the CLOSING state.
During the four CLOSE_WAIT TCP waved, shut down after the end of the passive receipt of FIN packets, enter CLOSE_WAIT state.
When four wave LAST_ACK TCP passive closed rear end of the FIN packet sent into LAST_ACK state and wait for an ACK packet.

 

The active state may be connected to an end are: 
the CLOSED SYN_SEND the ESTABLISHED.


Initiative to close the end of the possible states are: 
FIN_WAIT_1 FIN_WAIT_2 the TIME_WAIT.


Passive end connected possible states: 
the LISTEN SYN_RECV the ESTABLISHED.


Passive closed end of the possible states are: 
CLOSE_WAIT LAST_ACK the CLOSED.

Guess you like

Origin www.cnblogs.com/zwjsec/p/11929248.html