difference between 0.0.0.0 and * network in ss output
The ss
command seems to distinguish between *
and 0.0.0.0
. While the listing of ssh with 0.0.0.0:22
and [::]:22
is clear, *:7946
and *:80
is not quite as much.
$ ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 *:7946 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 [::]:22 [::]:*
Why isn't it 0.0.0.0:7946
and 0.0.0.0:80
? What's the difference here?
Solution 1:
The difference lies inside the address family:
0.0.0.0:22
: This is a listen socket which accepts connections on any interface, port 22 for IPv4 connections only.
[::]:22
: Same here, but for IPv6 connections.
LISTEN 0 128 *:80 *:*
And this is a listen sockets which accepts IPv4 as well as IPv6 connection requests.