The network software is composed of the client and the service side, and the server listens to the specified port to process the received data, and the client sends the data to the server-side listening port, and the data is processed by the server side, then the processing result is returned to the client.
so how do we see on Linux what ports we are listening to, and which clients are connecting to my server?
first of all we need to know what protocol we use to transfer, the use of the protocol can be used in different ways to view. The transport protocol is divided into tcp and UDP Two, we first look at the server side how to see what TCP protocol and UDP Protocol port, use the command NETSTAT-NTLP to view the TCP port
we can see that this machine monitors the TCP 587 ,143,111 , etc. Port
We can also use the command Netstat-nulp to view the UDP ports in the listener
In the figure we can see the Local address This column, some in the listening 0.0.0.0: Port , Some in the listening 127.0.0.1: Port, Others are listening to the standalone IP: port, so what do they represent? What difference does it have?
0.0.0.0 represents a port that listens to all IP on this server , and can access all the IP listening ports on the local computer.
127.0.0.1 represents a port that allows only native access to listen
192.168.1.100 represents a port that only allows access to 192.168.1.100 this IP listener
Next, let's see how to check which network connections are in use on my machine.
Use the command SS to view
we can see that only one network connection is currently in use on the machine. SSH Service
This is our remote network connection, using the SS fame and fortune can be effectively viewed to the machine all in use connection, thus we can filter on these connections to check the machine for the presence of dangerous network connections
With these commands we can see what ports our machines are opening, what network services are available, and if they are not for me, then I can turn off redundant Web services.
Viewing of Linux network connections and monitoring of ports