본문 바로가기

아프다

[리눅스] netstat 명령어

반응형

netstat 명령어

netstat - Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships

netstat 상태(State)

state description
ESTABLISHED The socket has an established connection.
SYN_SENT The socket is actively attempting to establish a connection.
SYN_RECV A connection request has been received from the network.
FIN_WAIT1 The socket is closed, and the connection is shutting down.
FIN_WAIT2 Connection is closed, and the socket is waiting for a shutdown from the remote end.
TIME_WAIT The socket is waiting after close to handle packets still in the network.
CLOSE The socket is not being used.
CLOSE_WAIT The remote end has shut down, waiting for the socket to close.
LAST_ACK The remote end has shut down, and the socket is closed. Waiting for acknowledgement.
LISTEN The socket is listening for incoming connections. Such sockets are not included in the output unless you specify the --listening (-l) or --all (-a) option.
CLOSING Both sockets are shut down but we still don't have all our data sent.
UNKNOWN The state of the socket is unknown.

 

출처-https://www.ictshore.com/wp-content/uploads/2016/12/1017-01-TCP_States_diagram.png

 

TCP endpoints state transmission

이미지 출처-https://totozhang.github.io/2016-01-23-tcp-connection-status-transit/TCPState2.png

tcp flags

state description
SYN (synchronize) Packets that are used to initiate a connection.
ACK (acknowledgment) Packets that are used to confirm that the data packets have been received, also used to confirm the initiation request and tear down requests
RST (reset) Signify the connection is down or maybe the service is not accepting the requests
FIN (finish) Indicate that the connection is being torn down. Both the sender and receiver send the FIN packets to gracefully terminate the connection
PSH (push) Indicate that the incoming data should be passed on directly to the application instead of getting buffered
URG (urgent) Indicate that the data that the packet is carrying should be processed immediately by the TCP stack

출처-https://www.ictshore.com/wp-content/uploads/2016/12/1017-02-TCP_States_in_a_connection.png

performance diagram

출처-https://i.stack.imgur.com/ntC1q.png

 

참고URL

- netstat 명령어 : https://scbyun.com/395

- https://www.ictshore.com/free-ccna-course/transmission-control-protocol-advanced/

- https://totozhang.github.io/2016-01-23-tcp-connection-status-transit/TCPState2.png 

 

728x90
반응형