If I am listening on :::80
, is it listening on all ipv6 or all ipv6+ipv4?
This is my netstat -tln
:
tcp 0 0 :::8080 :::*
ipv4ipv6networking
If I am listening on :::80
, is it listening on all ipv6 or all ipv6+ipv4?
This is my netstat -tln
:
tcp 0 0 :::8080 :::*
Best Answer
A listening socket that is bound to
::
, i.e. any address IPv6 address (INADDR6_ANY
), may or may not also listen to connections using IPv4. This depends from several things:IPV6_V6ONLY
socket option is set on the listening socket (by the program that created the socket). Linux-based operating systems and FreeBSD are examples of such operating systems.The default behavior if the option is not explicitly set by a program is OS dependent. On Linux-based operating systems, for example, you can change this default by writing 0 or 1 to
/proc/sys/net/ipv6/bindv6only
.On some operating systems, the output of
netstat
will tell you whether the socket is dual-stack. FreeBSD'snetstat
reports dual-stack sockets astcp46
andudp46
in the first column of the output, for examples.I am testing the ipv6_only behavior with both values.
1.
2.
from above results we can see that value of /proc/sys/net/ipv6/bindv6only deciding the behaviour of ipv6 only or ipv6+ipv4