stubby icon indicating copy to clipboard operation
stubby copied to clipboard

Stubby doesn't listen on TCP/IPv6 when using 0::0

Open hanjo opened this issue 4 years ago • 3 comments

Hi,

I'd like Stubby do listen on all my interfaces/addresses, so I've configured

listen_addresses:
  - 0.0.0.0
  - 0::0

This however doesn't seem to work with TCP on IPv6, the daemon doesn't seem to listen:

$ sudo netstat -lnp | grep stubby
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      2073/stubby
udp        0      0 0.0.0.0:53              0.0.0.0:*                           2073/stubby
udp6       0      0 :::53                   :::*                                2073/stubby

However, when I put in a real IPv6 address in the config:

listen_addresses:
  - 0.0.0.0
  - fd4e:...

it works:

$ sudo netstat -lnp | grep stubby
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      2122/stubby
tcp6       0      0 fd4e:...::53            :::*                    LISTEN      2122/stubby
udp        0      0 0.0.0.0:53              0.0.0.0:*                           2122/stubby
udp6       0      0 fd4e:...::53            :::*                                2122/stubby

I assume this is a bug, but maybe my configuration above for listening on all IPv6 addresses is not correct.

hanjo avatar Mar 28 '21 12:03 hanjo

Yes this is quite peculiar and does have something to do with dual-stack mode IPv6, though it doesn't actually bind dual stack when providing just the IPv6 so I suppose I have to look into what is going on here... You can workaround the issue by disabling dual-stack mode IPv6:

# echo 1 > /proc/sys/net/ipv6/bindv6only

wtoorop avatar Mar 28 '21 15:03 wtoorop

Thansk for pointing out the workaround - seems to be working now:

$ sudo netstat -lnp | grep stubby
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      645/stubby
tcp6       0      0 :::53                   :::*                    LISTEN      645/stubby
udp        0      0 0.0.0.0:53              0.0.0.0:*                           645/stubby
udp6       0      0 :::53                   :::*                                645/stubby

hanjo avatar Mar 28 '21 19:03 hanjo