[Bug] DNS Resolve Error for the base_domain(server_rul) at v0.24.0 #907

Closed
opened 2025-12-29 02:25:46 +01:00 by adam · 4 comments
Owner

Originally created by @IamTaoChen on GitHub (Jan 19, 2025).

Is this a support request?

  • This is not a support request

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

  1. config.yaml
server_url: example.net
dns:
  magic_dns: true
  base_domain: example.net
  1. try to ping example.net
➜  ~ ping example.net
ping: cannot resolve example.net: Unknown host
  1. or try to open https://example.net/apple
Image
  1. magic_dns works
➜  ~ ping test              
PING test.example.net (100.64.0.7): 56 data bytes
64 bytes from 100.64.0.7: icmp_seq=0 ttl=64 time=253.130 ms
64 bytes from 100.64.0.7: icmp_seq=1 ttl=64 time=86.409 ms
^C
--- test.example.net ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 86.409/169.769/253.130/83.361 ms
➜  ~ ping test.example.net    
PING test.example.net (100.64.0.7): 56 data bytes
64 bytes from 100.64.0.7: icmp_seq=0 ttl=64 time=94.611 ms
64 bytes from 100.64.0.7: icmp_seq=1 ttl=64 time=103.333 ms
^C
--- test.example.net ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 94.611/98.972/103.333/4.361 ms

Expected Behavior

it should resolve base_domain?, i mean it should bypass the DNS querying

Steps To Reproduce

see up

Environment

- OS: MacOS
- Headscale version: 0.24.0
- Tailscale version: 1.78.1

Runtime environment

  • Headscale is behind a (reverse) proxy
  • Headscale runs in a container

Anything else?

No response

Originally created by @IamTaoChen on GitHub (Jan 19, 2025). ### Is this a support request? - [x] This is not a support request ### Is there an existing issue for this? - [x] I have searched the existing issues ### Current Behavior 1. `config.yaml` ```yaml server_url: example.net dns: magic_dns: true base_domain: example.net ``` 2. try to `ping example.net` ```bash ➜ ~ ping example.net ping: cannot resolve example.net: Unknown host ``` 3. or try to open `https://example.net/apple` <img width="860" alt="Image" src="https://github.com/user-attachments/assets/e9af8cf6-6907-4bcd-b0e6-acf2ddcf0aca" /> 4. magic_dns works ```bash ➜ ~ ping test PING test.example.net (100.64.0.7): 56 data bytes 64 bytes from 100.64.0.7: icmp_seq=0 ttl=64 time=253.130 ms 64 bytes from 100.64.0.7: icmp_seq=1 ttl=64 time=86.409 ms ^C --- test.example.net ping statistics --- 2 packets transmitted, 2 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 86.409/169.769/253.130/83.361 ms ➜ ~ ping test.example.net PING test.example.net (100.64.0.7): 56 data bytes 64 bytes from 100.64.0.7: icmp_seq=0 ttl=64 time=94.611 ms 64 bytes from 100.64.0.7: icmp_seq=1 ttl=64 time=103.333 ms ^C --- test.example.net ping statistics --- 2 packets transmitted, 2 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 94.611/98.972/103.333/4.361 ms ``` ### Expected Behavior it should resolve `base_domain`?, i mean it should bypass the DNS querying ### Steps To Reproduce see up ### Environment ```markdown - OS: MacOS - Headscale version: 0.24.0 - Tailscale version: 1.78.1 ``` ### Runtime environment - [x] Headscale is behind a (reverse) proxy - [x] Headscale runs in a container ### Anything else? _No response_
adam added the bug label 2025-12-29 02:25:46 +01:00
adam closed this issue 2025-12-29 02:25:46 +01:00
Author
Owner

@kradalby commented on GitHub (Jan 20, 2025):

@motiejus I wonder if this is related to https://github.com/juanfont/headscale/pull/2248/files#diff-f4787c8465217f16007cdbaf693a77747964495a8e1e8e50acb411d89c38e68bR354-R355

Can you have a look?

@kradalby commented on GitHub (Jan 20, 2025): @motiejus I wonder if this is related to https://github.com/juanfont/headscale/pull/2248/files#diff-f4787c8465217f16007cdbaf693a77747964495a8e1e8e50acb411d89c38e68bR354-R355 Can you have a look?
Author
Owner

@motiejus commented on GitHub (Jan 20, 2025):

When I made the PR, I assumed base_domain can be the same as serverURL (as you can see from the test, it's explicitly handled). Why wouldn't it work on the network level?

I can adjust the original PR to explicitly not allow the same base_domain and serverURL, but it would be great to know why.

In my naive understanding, "magic DNS" is only supposed to return addresses for first-level sub-domains of base_domain, but not the base_domain itself. Is the assumption incorrect?

@motiejus commented on GitHub (Jan 20, 2025): When I made the PR, I assumed `base_domain` can be the same as `serverURL` (as you can see from the test, it's explicitly handled). Why wouldn't it work on the network level? I can adjust the original PR to explicitly not allow the same base_domain and serverURL, but it would be great to know why. In my naive understanding, "magic DNS" is only supposed to return addresses for first-level sub-domains of `base_domain`, but not the `base_domain` itself. Is the assumption incorrect?
Author
Owner

@nsauk commented on GitHub (Mar 5, 2025):

I found a dirty hack to overcome this behaviour:

server_url: example.net
dns:
  magic_dns: true
  base_domain: example.net
  nameservers:
    global:
      - 1.1.1.1
      - 1.0.0.1
    split:
      example.net:
        - 1.1.1.1
        - 1.0.0.1

This way you can have your public subdomains and headscale nodes mixed.

@nsauk commented on GitHub (Mar 5, 2025): I found a dirty hack to overcome this behaviour: ``` server_url: example.net dns: magic_dns: true base_domain: example.net nameservers: global: - 1.1.1.1 - 1.0.0.1 split: example.net: - 1.1.1.1 - 1.0.0.1 ``` This way you can have your public subdomains and headscale nodes mixed.
Author
Owner

@kradalby commented on GitHub (Apr 23, 2025):

I am adding back a rule to prevent this configuration. It does not work and should not be used, fixed in https://github.com/juanfont/headscale/pull/2544.

@kradalby commented on GitHub (Apr 23, 2025): I am adding back a rule to prevent this configuration. It does not work and should not be used, fixed in https://github.com/juanfont/headscale/pull/2544.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#907