Gray Su Gray Su - 3 months ago 16
Linux Question

what's the "peer" and two "address:port" from "ss -l" command mean

When I use "ss-l" command to display all open network ports in centos7, the output has two "address:port" fields.

Like this

enter image description here

Is this for local address and foreign address? And what's the "peer" mean.

I am confused on it. Can anyone help me? Thanks.

Answer

Yes, the two "Address:Port" columns are for the IP address and port being used locally and by the other end of the connection.

"Peer" is a common term used for the machine on the other end of a network connection because, historically, all servers on the internet were originally considered to be equal peers rather than divided into "client machines" and "server machines".

In the output of ss -l, the peer is always listed as * (used as a wildcard) because the -l option tells it to show only ports which are listening for new connections, not those which have connections established. If you run ss without -l, you should get some Peer Address:Port entries such as 1.2.3.4:https, showing that you have an active https connection to a peer with IP address 1.2.3.4.