Can't bind to IPv6 with grpc_listen_addr #587

Closed
opened 2025-12-29 02:20:52 +01:00 by adam · 2 comments
Owner

Originally created by @nixigaj on GitHub (Dec 4, 2023).

Bug description

When you set grpc_listen_addr: [::]:50443, or some other valid IPv6 address in the configuration the systemd service fails.

2023-12-04T00:26:45+01:00 WRN Failed to read configuration from disk error="While parsing config: yaml: line 34: did not find expected node content"
2023-12-04T00:26:45+01:00 FTL ../runner/work/headscale/headscale/cmd/headscale/cli/root.go:48 > Error loading config error="fatal error reading config file: While parsing config: yaml: line 34: did not find expected node content"

Environment

  • OS: Ubuntu 22.04, kernel 5.4.0
  • Headscale version: v0.23.0-alpha1
  • Tailscale version: N/A

To Reproduce

Configure Headscale with the grpc_listen_addr key value set to any valid RFC-4038 IPv6 address, like [::]:50443 (bind to all addresses, including IPv4 if /proc/sys/net/ipv6/bindv6only is 0) or [::1]:50443 (loopback interface). Then try to start Headscale.

Edit: I also found that the behavior is the same for listen_addr.

Originally created by @nixigaj on GitHub (Dec 4, 2023). ## Bug description When you set `grpc_listen_addr: [::]:50443`, or some other valid IPv6 address in the configuration the systemd service fails. ``` 2023-12-04T00:26:45+01:00 WRN Failed to read configuration from disk error="While parsing config: yaml: line 34: did not find expected node content" 2023-12-04T00:26:45+01:00 FTL ../runner/work/headscale/headscale/cmd/headscale/cli/root.go:48 > Error loading config error="fatal error reading config file: While parsing config: yaml: line 34: did not find expected node content" ``` ## Environment - OS: Ubuntu 22.04, kernel 5.4.0 - Headscale version: v0.23.0-alpha1 - Tailscale version: N/A ## To Reproduce Configure Headscale with the `grpc_listen_addr` key value set to any valid [RFC-4038](https://datatracker.ietf.org/doc/html/rfc4038) IPv6 address, like `[::]:50443` (bind to all addresses, including IPv4 if `/proc/sys/net/ipv6/bindv6only` is `0`) or `[::1]:50443` (loopback interface). Then try to start Headscale. Edit: I also found that the behavior is the same for `listen_addr`.
adam added the bug label 2025-12-29 02:20:52 +01:00
adam closed this issue 2025-12-29 02:20:52 +01:00
Author
Owner

@sinuscosinustan commented on GitHub (Dec 5, 2023):

Try to quote the IP and it should work as expected.

The YAML parser tries to parse it as an array and not as a string (because of []). So, it's kind of an expected behaviour and not a bug.

I also tried that on my own headscale instance and when quoting the IP the server starts:

2023-12-05T19:46:36Z TRC DNS configuration loaded dns_config={"ExitNodeFilteredSet":null,"Nameservers":["1.1.1.1"],"Proxied":true,"Resolvers":[{"Addr":"1.1.1.1"}]}
2023-12-05T19:46:37Z INF Setting up a DERPMap update worker frequency=86400000
2023-12-05T19:46:37Z INF listening and serving HTTP on: [::]:8080
2023-12-05T19:46:37Z INF listening and serving metrics on: [::1]:9090
@sinuscosinustan commented on GitHub (Dec 5, 2023): Try to quote the IP and it should work as expected. The YAML parser tries to parse it as an array and not as a string (because of `[]`). So, it's kind of an expected behaviour and not a bug. I also tried that on my own headscale instance and when quoting the IP the server starts: ``` 2023-12-05T19:46:36Z TRC DNS configuration loaded dns_config={"ExitNodeFilteredSet":null,"Nameservers":["1.1.1.1"],"Proxied":true,"Resolvers":[{"Addr":"1.1.1.1"}]} 2023-12-05T19:46:37Z INF Setting up a DERPMap update worker frequency=86400000 2023-12-05T19:46:37Z INF listening and serving HTTP on: [::]:8080 2023-12-05T19:46:37Z INF listening and serving metrics on: [::1]:9090 ```
Author
Owner

@nixigaj commented on GitHub (Dec 7, 2023):

Try to quote the IP and it should work as expected.

Yeah that seems to have fixed it. Didn't think about the YAML parser identifying square brackets as arrays.

@nixigaj commented on GitHub (Dec 7, 2023): > Try to quote the IP and it should work as expected. Yeah that seems to have fixed it. Didn't think about the YAML parser identifying square brackets as arrays.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#587