Use the ss command : This is a powerful tool that can be used to get information about open ports and network connections. For example, you can run the following command:
ss -tuln
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
udp UNCONN 0 0 172.16.x.xxx%bond0:68 0.0.0.0:*
tcp LISTEN 0 xx1 127.0.0.1:xxxx3 0.0.0.0:*
tcp LISTEN 0 6 127.0.0.1:xxxx0 0.0.0.0:*
The fields you list are the output of ss
the command or netstat
command, and they describe the state of the network connections in the system. Here's what each field means:
- Netid : Network protocol (such as TCP or UDP ).
- State : The state of the network connection. "LISTEN" means the port is listening for connection requests , "UNCONN" means the UDP socket is not connected (this is the normal state for UDP since it is a connectionless protocol).
- Recv-Q and Send-Q : These are the lengths of the receive queue and send queue. These queues store data waiting to be read by the process (Recv-Q ) or waiting to be sent to the network (Send-Q ). Under normal circumstances, they should remain around 0.
- Local Address:Port : This is the IP address and port number of the local system. Here, "127.0.0.1" is the loopback address, which is the address of the local host. Listening on this address means that this service is only available to this machine and cannot be accessed from the external network. If the address is "0.0.0.0" it means listening on all available network interfaces.
- Peer Address:Port : This is the IP address and port number of the remote system. In this case, "0.0.0.0:*" means there are no remote hosts connected, this is because those sockets are listening, waiting for a connection, not already connected.
- Process : This field shows the process associated with each socket . In your example this field is empty, probably because you didn't run or command with
-p
options .ss
netstat
This information can help you understand which services are running, which ports they are listening on, and if there are any network connectivity issues.
netstat -nupl (UDP type port)
netstat -ntpl (TCP type port)