3.4.2. IPv6 wildcard listen address Previous topic Parent topic Child topic Next topic

If you are using recent Perl or Socket.pm you can configure separate IPv4 and IPv6 wildcard listen sockets by specifying both IPv6 and IPv4 wildcard addresses and turning on IPV6_V6ONLY socket option:
BindAddress ::,0.0.0.0
BindV6Only
For more information about this parameter, see Section 3.5.10. BindV6Only.
Note
There are differences between operating systems. For example, on Linux IPV6_V6ONLY is off by default. When it is off, the following will BindAddress parameter not work as expected. The bind to IPv6 wildcard address is done first and this does not allow binding to IPv4 wildcard address afterwards:
BindAddress ::, 0.0.0.0
If IPV6_V6ONLY is set to 1, the IPv6 bind will not affect the IPv4 bind and the example BindAddress will work as expected. On OS X 10.9 it is possible to bind to IPv4 wildcard address first followed by IPv6 wildcard address. On Windows IPV6_V6ONLY behaviour is the default.
Note
Linux has a sysctl kernel parameter net.ipv6.bindv6only and special file to control the system wide behaviour: /proc/sys/net/ipv6/bindv6only.