[GH-ISSUE #2736] configure.sh script fails to detect public IP on IPv6-only servers #6037

Open
opened 2026-08-05 01:06:25 -04:00 by saavagebueno · 6 comments
Owner

Originally created by @bannert1337 on GitHub (Oct 14, 2024).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/2736

Describe the problem

The configure.sh script in the self-hosted setup fails to detect the server's public IP address when run on an IPv6-only VPS or a server with IPv6 preferred. This causes the script to exit with a JSON parsing error, preventing successful configuration of the NetBird infrastructure.

To Reproduce

  1. Set up a VPS with IPv6 enabled and preferred (e.g., on Hetzner)
  2. Clone the NetBird repository and navigate to the infrastructure_files directory
  3. Run ./configure.sh
  4. Observe the error message:
    discovering server's public IP
    parse error: Invalid numeric literal at line 3, column 0
    

Expected behavior

The script should successfully detect the server's public IPv4 address, or gracefully handle the case where only an IPv6 address is available. It should then proceed with the configuration without errors.

Are you using NetBird Cloud?

No, this issue occurs during self-hosted NetBird control plane setup.

NetBird version

N/A - This issue occurs during initial setup, before NetBird is fully installed.

NetBird status -dA output:

N/A - NetBird is not yet installed when this issue occurs.

Do you face any (non-mobile) client issues?

N/A - This issue is related to server setup, not client operation.

Screenshots

N/A

Additional context

The root cause appears to be that the script uses https://jsonip.com to detect the public IP, which returns an IPv6 address on IPv6-enabled servers. The script expects an IPv4 address, causing a parsing error.

A potential fix would be to use a service that consistently returns an IPv4 address, such as https://api.ipify.org?format=json, and ensure the -4 flag is used with curl to force IPv4. Alternatively, the script could be updated to handle both IPv4 and IPv6 addresses correctly.

Originally created by @bannert1337 on GitHub (Oct 14, 2024). Original GitHub issue: https://github.com/netbirdio/netbird/issues/2736 **Describe the problem** The `configure.sh` script in the self-hosted setup fails to detect the server's public IP address when run on an IPv6-only VPS or a server with IPv6 preferred. This causes the script to exit with a JSON parsing error, preventing successful configuration of the NetBird infrastructure. **To Reproduce** 1. Set up a VPS with IPv6 enabled and preferred (e.g., on Hetzner) 2. Clone the NetBird repository and navigate to the infrastructure_files directory 3. Run `./configure.sh` 4. Observe the error message: ``` discovering server's public IP parse error: Invalid numeric literal at line 3, column 0 ``` **Expected behavior** The script should successfully detect the server's public IPv4 address, or gracefully handle the case where only an IPv6 address is available. It should then proceed with the configuration without errors. **Are you using NetBird Cloud?** No, this issue occurs during self-hosted NetBird control plane setup. **NetBird version** N/A - This issue occurs during initial setup, before NetBird is fully installed. **NetBird status -dA output:** N/A - NetBird is not yet installed when this issue occurs. **Do you face any (non-mobile) client issues?** N/A - This issue is related to server setup, not client operation. **Screenshots** N/A **Additional context** The root cause appears to be that the script uses `https://jsonip.com` to detect the public IP, which returns an IPv6 address on IPv6-enabled servers. The script expects an IPv4 address, causing a parsing error. A potential fix would be to use a service that consistently returns an IPv4 address, such as `https://api.ipify.org?format=json`, and ensure the `-4` flag is used with curl to force IPv4. Alternatively, the script could be updated to handle both IPv4 and IPv6 addresses correctly.
saavagebueno added the waiting-feedbacktriage-needed labels 2026-08-05 01:06:25 -04:00
Author
Owner

@mlsmaycon commented on GitHub (Oct 14, 2024):

@bannert1337, can you check if the following command returns an IPv4 address?

curl -4 https://jsonip.com
<!-- gh-comment-id:2411174646 --> @mlsmaycon commented on GitHub (Oct 14, 2024): @bannert1337, can you check if the following command returns an IPv4 address? ```shell curl -4 https://jsonip.com ```
Author
Owner

@bannert1337 commented on GitHub (Oct 15, 2024):

@mlsmaycon output for the command:

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>403 Forbidden</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Forbidden</h1>
<h2>Your client does not have permission to get URL <code>/</code> from this server.</h2>
<h2></h2>
</body></html>

When run from a computer at my home network, I get the correct IPv4 address.
The VPS has a public IPv4 and IPv6 address.

<!-- gh-comment-id:2414588205 --> @bannert1337 commented on GitHub (Oct 15, 2024): @mlsmaycon output for the command: ```html <html><head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <title>403 Forbidden</title> </head> <body text=#000000 bgcolor=#ffffff> <h1>Error: Forbidden</h1> <h2>Your client does not have permission to get URL <code>/</code> from this server.</h2> <h2></h2> </body></html> ``` When run from a computer at my home network, I get the correct IPv4 address. The VPS has a public IPv4 and IPv6 address.
Author
Owner

@nazarewk commented on GitHub (Apr 28, 2025):

Hello @bannert1337,

We're currently reviewing our open issues and would like to verify if this problem still exists in the latest NetBird version.

Could you please confirm if the issue is still there?

We may close this issue temporarily if we don't hear back from you within 2 weeks, but feel free to reopen it with updated information.

Thanks for your contribution to improving the project!

<!-- gh-comment-id:2835664083 --> @nazarewk commented on GitHub (Apr 28, 2025): Hello @bannert1337, We're currently reviewing our open issues and would like to verify if this problem still exists in the [latest NetBird version](https://github.com/netbirdio/netbird/releases). Could you please confirm if the issue is still there? We may close this issue temporarily if we don't hear back from you within **2 weeks**, but feel free to reopen it with updated information. Thanks for your contribution to improving the project!
Author
Owner

@azdolinski commented on GitHub (May 8, 2025):

@nazarewk

I have the same problem... from time to time 😉
Depend on DNS query...

root@vpn-de:/etc# curl -4 https://jsonip.com
{"ip":"45.134.5x.x"}

root@vpn-de:/etc# curl -k -v https://api.netbird.io:443/
*   Trying [2600:1901:0:adb3::]:443...                    <------------ !!!!
*   Trying 35.186.199.111:443...                     <------------ !!!!
* Connected to api.netbird.io (35.186.199.111) port 443 (#0)
* ALPN: offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=api.netbird.io
*  start date: May  5 19:20:39 2025 GMT
*  expire date: Aug  3 19:20:38 2025 GMT
*  issuer: C=US; O=Let's Encrypt; CN=R10
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* using HTTP/2
* h2h3 [:method: GET]
* h2h3 [:path: /]
* h2h3 [:scheme: https]
* h2h3 [:authority: api.netbird.io]
* h2h3 [user-agent: curl/7.88.1]
* h2h3 [accept: */*]
* Using Stream ID: 1 (easy handle 0x555e94257780)
> GET / HTTP/2
> Host: api.netbird.io
> user-agent: curl/7.88.1
> accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/2 200
< content-length: 0
< date: Fri, 09 May 2025 02:19:45 GMT
< via: 1.1 google
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
<
* Connection #0 to host api.netbird.io left intact


root@vpn-de:/etc# curl -k -v https://api.netbird.io:443/
*   Trying [2600:1901:0:adb3::]:443...               <------------ !!!!
* Connected to api.netbird.io (2600:1901:0:adb3::) port 443 (#0)                        <------------ !!!!
* ALPN: offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=api.netbird.io
*  start date: May  5 19:20:39 2025 GMT
*  expire date: Aug  3 19:20:38 2025 GMT
*  issuer: C=US; O=Let's Encrypt; CN=R10
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* using HTTP/2
* h2h3 [:method: GET]
* h2h3 [:path: /]
* h2h3 [:scheme: https]
* h2h3 [:authority: api.netbird.io]
* h2h3 [user-agent: curl/7.88.1]
* h2h3 [accept: */*]
* Using Stream ID: 1 (easy handle 0x55e852984780)
> GET / HTTP/2
> Host: api.netbird.io
> user-agent: curl/7.88.1
> accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/2 403
< content-type: text/html; charset=UTF-8
< referrer-policy: no-referrer
< content-length: 295
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
<

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>403 Forbidden</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Forbidden</h1>
<h2>Your client does not have permission to get URL <code>/</code> from this server.</h2>
<h2></h2>
</body></html>
* Connection #0 to host api.netbird.io left intact

Disable ipv6 on client resolve problem:

sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1
sysctl -w net.ipv6.conf.tun0.disable_ipv6=1
<!-- gh-comment-id:2864911012 --> @azdolinski commented on GitHub (May 8, 2025): @nazarewk I have the same problem... from time to time 😉 Depend on DNS query... ``` root@vpn-de:/etc# curl -4 https://jsonip.com {"ip":"45.134.5x.x"} root@vpn-de:/etc# curl -k -v https://api.netbird.io:443/ * Trying [2600:1901:0:adb3::]:443... <------------ !!!! * Trying 35.186.199.111:443... <------------ !!!! * Connected to api.netbird.io (35.186.199.111) port 443 (#0) * ALPN: offers h2,http/1.1 * TLSv1.3 (OUT), TLS handshake, Client hello (1): * TLSv1.3 (IN), TLS handshake, Server hello (2): * TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8): * TLSv1.3 (IN), TLS handshake, Certificate (11): * TLSv1.3 (IN), TLS handshake, CERT verify (15): * TLSv1.3 (IN), TLS handshake, Finished (20): * TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1): * TLSv1.3 (OUT), TLS handshake, Finished (20): * SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 * ALPN: server accepted h2 * Server certificate: * subject: CN=api.netbird.io * start date: May 5 19:20:39 2025 GMT * expire date: Aug 3 19:20:38 2025 GMT * issuer: C=US; O=Let's Encrypt; CN=R10 * SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway. * using HTTP/2 * h2h3 [:method: GET] * h2h3 [:path: /] * h2h3 [:scheme: https] * h2h3 [:authority: api.netbird.io] * h2h3 [user-agent: curl/7.88.1] * h2h3 [accept: */*] * Using Stream ID: 1 (easy handle 0x555e94257780) > GET / HTTP/2 > Host: api.netbird.io > user-agent: curl/7.88.1 > accept: */* > * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * old SSL session ID is stale, removing < HTTP/2 200 < content-length: 0 < date: Fri, 09 May 2025 02:19:45 GMT < via: 1.1 google < alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 < * Connection #0 to host api.netbird.io left intact root@vpn-de:/etc# curl -k -v https://api.netbird.io:443/ * Trying [2600:1901:0:adb3::]:443... <------------ !!!! * Connected to api.netbird.io (2600:1901:0:adb3::) port 443 (#0) <------------ !!!! * ALPN: offers h2,http/1.1 * TLSv1.3 (OUT), TLS handshake, Client hello (1): * TLSv1.3 (IN), TLS handshake, Server hello (2): * TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8): * TLSv1.3 (IN), TLS handshake, Certificate (11): * TLSv1.3 (IN), TLS handshake, CERT verify (15): * TLSv1.3 (IN), TLS handshake, Finished (20): * TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1): * TLSv1.3 (OUT), TLS handshake, Finished (20): * SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 * ALPN: server accepted h2 * Server certificate: * subject: CN=api.netbird.io * start date: May 5 19:20:39 2025 GMT * expire date: Aug 3 19:20:38 2025 GMT * issuer: C=US; O=Let's Encrypt; CN=R10 * SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway. * using HTTP/2 * h2h3 [:method: GET] * h2h3 [:path: /] * h2h3 [:scheme: https] * h2h3 [:authority: api.netbird.io] * h2h3 [user-agent: curl/7.88.1] * h2h3 [accept: */*] * Using Stream ID: 1 (easy handle 0x55e852984780) > GET / HTTP/2 > Host: api.netbird.io > user-agent: curl/7.88.1 > accept: */* > * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * old SSL session ID is stale, removing < HTTP/2 403 < content-type: text/html; charset=UTF-8 < referrer-policy: no-referrer < content-length: 295 < alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 < <html><head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <title>403 Forbidden</title> </head> <body text=#000000 bgcolor=#ffffff> <h1>Error: Forbidden</h1> <h2>Your client does not have permission to get URL <code>/</code> from this server.</h2> <h2></h2> </body></html> * Connection #0 to host api.netbird.io left intact ``` Disable ipv6 on client resolve problem: ``` sysctl -w net.ipv6.conf.all.disable_ipv6=1 sysctl -w net.ipv6.conf.default.disable_ipv6=1 sysctl -w net.ipv6.conf.tun0.disable_ipv6=1 ```
Author
Owner

@ikergcalvino commented on GitHub (Jun 5, 2025):

I'm experiencing a similar IPv6-related issue on a Teltonika RUTX50 router running OpenWrt v21.02.0. I've packaged NetBird v0.43.3 using the pre-compiled ARMv6 binary in a custom Makefile.

When trying to connect, I get consistent timeout errors despite having proper internet connectivity. It's worth noting that I'm using a Movistar 5G SIM card which appears to be routing traffic primarily through IPv6.

Here are the relevant logs:

root@RUTX50:/tmp# opkg install /tmp/netbird_0.43.3_arm_cortex-a7_neon-vfpv4.ipk
Installing netbird (0.43.3) to root...
Configuring netbird.
root@RUTX50:/tmp# netbird up --setup-key XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Error: login backoff cycle failed: rpc error: code = DeadlineExceeded desc = context deadline exceeded

I've verified that IPv4 connectivity works fine:

root@RUTX50:/tmp# curl -4 https://jsonip.com
{"ip":"xxx.xxx.xxx.xxx"}

And I can reach the NetBird API endpoint:

root@RUTX50:/tmp# curl -k -v https://api.netbird.io:443/
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
> GET / HTTP/2
> Host: api.netbird.io
> User-Agent: curl/8.11.0
> Accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
< HTTP/2 200
< content-length: 0
< date: Thu, 05 Jun 2025 19:34:58 GMT
< via: 1.1 google
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
<

This appears to match the IPv6-related connectivity issues described in this ticket. I'm working on this as part of a master's thesis project, so any insights would be greatly appreciated.

<!-- gh-comment-id:2945885367 --> @ikergcalvino commented on GitHub (Jun 5, 2025): I'm experiencing a similar IPv6-related issue on a Teltonika RUTX50 router running OpenWrt v21.02.0. I've packaged NetBird v0.43.3 using the pre-compiled ARMv6 binary in a custom Makefile. When trying to connect, I get consistent timeout errors despite having proper internet connectivity. It's worth noting that I'm using a Movistar 5G SIM card which appears to be routing traffic primarily through IPv6. Here are the relevant logs: ``` root@RUTX50:/tmp# opkg install /tmp/netbird_0.43.3_arm_cortex-a7_neon-vfpv4.ipk Installing netbird (0.43.3) to root... Configuring netbird. root@RUTX50:/tmp# netbird up --setup-key XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Error: login backoff cycle failed: rpc error: code = DeadlineExceeded desc = context deadline exceeded ``` I've verified that IPv4 connectivity works fine: ``` root@RUTX50:/tmp# curl -4 https://jsonip.com {"ip":"xxx.xxx.xxx.xxx"} ``` And I can reach the NetBird API endpoint: ``` root@RUTX50:/tmp# curl -k -v https://api.netbird.io:443/ * TLSv1.3 (OUT), TLS handshake, Client hello (1): * TLSv1.3 (IN), TLS handshake, Server hello (2): * TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8): * TLSv1.3 (IN), TLS handshake, Certificate (11): * TLSv1.3 (IN), TLS handshake, CERT verify (15): * TLSv1.3 (IN), TLS handshake, Finished (20): * TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1): * TLSv1.3 (OUT), TLS handshake, Finished (20): > GET / HTTP/2 > Host: api.netbird.io > User-Agent: curl/8.11.0 > Accept: */* > * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): < HTTP/2 200 < content-length: 0 < date: Thu, 05 Jun 2025 19:34:58 GMT < via: 1.1 google < alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 < ``` This appears to match the IPv6-related connectivity issues described in this ticket. I'm working on this as part of a master's thesis project, so any insights would be greatly appreciated.
Author
Owner

@buraglio commented on GitHub (Jun 2, 2026):

I've recently installed NetBird on a few IPv6-only hosts and not run into this. However, each of the nodes has at the very least a DNS64/NAT64 gateway, and in most cases has a CLAT.

<!-- gh-comment-id:4605678580 --> @buraglio commented on GitHub (Jun 2, 2026): I've recently installed NetBird on a few IPv6-only hosts and not run into this. However, each of the nodes has at the very least a DNS64/NAT64 gateway, and in most cases has a CLAT.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#6037