On Mon, May 08, 2023 at 02:11:32PM -0700, 'Magnus Schmitz (bodyagency)' via chasquid wrote:
>Perfect, thank you - I figured it out with your questions. ;-)
>
>One more question about the sockets. They all listen on IPv6 only. Adding
>
>BindIPv6Only=both or BindIPv6Only=default
>
>did not change it.
>
>I now made the sockets listen to IPv4 with ListenStream=0.0.0.0:port
>
>How can I make the socket to listen to both IPv4 and 6?
That's a systemd question: chasquid will accept and use the sockets
regardless.
That said, usually Linux sockets listening on ipv6 will automatically
accept connections over ipv4 too. This is configured in
/proc/sys/net/ipv6/bindv6only, and the default is 0 (i.e. behave as the
previous sentence).
And this is in the systemd documentation:
https://www.freedesktop.org/software/systemd/man/systemd.socket.html#ListenStream=
If the address string is a single number, it is read as port number to
listen on via IPv6. Depending on the value of BindIPv6Only= (see
below) this might result in the service being available via both IPv6
and IPv4 (default) or just via IPv6.
[...]
If the address string is a string in the format "[x]:y", it is
interpreted as IPv6 address x and port y. [...] Note that if an
address is specified as IPv6, it might still make the service
available via IPv4 too, depending on the BindIPv6Only= setting (see
below).
So if you use "ListenStream=port", it will make them listen on ipv6 and
the kernel will (by default) accept connections over ipv6 and ipv4.
chasquid handles this just fine, no need to change any settings.
Thanks!
Alberto
PS: You can also have multiple systemd listening sockets for a single
descriptor name (e.g. one socket for ipv4 and one socket for ipv6),
chasquid also supports that transparently, but that type of
configuration is normally is not needed.