tailscale: Unable to follow CNAME to magic dns record

What is the issue?

What happened:

When I have a DNS record set like this:

CNAME nextcloud.markstenglein.com --> cloudron.--------------.beta.tailscale.net

I am unable to reach that host at that domain name.

~
❯ ping -v nextcloud.markstenglein.com                
ping: nextcloud.markstenglein.com: Name or service not known

What I expected to happen:

If, instead, I directly add an A record to the IP address it does work. I expected this result from the CNAME as well.

~
❯ ping nextcloud.markstenglein.com                   
PING nextcloud.markstenglein.com (--.--.--.-- ) 56(84) bytes of data.
64 bytes from cloudron.--------------.beta.tailscale.net (--.--.--.-- ): icmp_seq=1 ttl=64 time=1.11 ms
64 bytes from cloudron.--------------.beta.tailscale.net (--.--.--.-- ): icmp_seq=2 ttl=64 time=0.951 ms
^C
--- nextcloud.markstenglein.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.951/1.030/1.109/0.079 ms

Probably unrelated

I’ve been having a lot of trouble with the dns resolution failing until I stop/restart tailscale. This happens both on Linux and Android 12.

I probably need to file a separate bug report for that. My suspicion is that that’s entirely a different thing though so let’s not waste too much time in this thread on that unless it’s actually related.

Steps to reproduce

Set up magic DNS with a custom DNS server.

My setup might be a bit different…I’ve got one ec2 instance each in us-east-1 and us-west-2 running Pi-Hole. They’re firewalled off so the only way to reach them is through tailscale.

I was able to get direct connections working today which should rule out anything to do with the relays…though it didn’t seem a likely reason.

~
❯ tailscale status   
--.--.--.--    ocelotsloth-archdesk --------@ linux   -
--.--.--.--    cloudron             --------@ linux   -
--.--.--.--    dns-2                --------@ linux   active; direct --.--.--.--:41641, tx 110000 rx 79408
--.--.--.--    dns-home             --------@ linux   -
--.--.--.--    dns                  tagged-devices linux   active; direct --.--.--.--:41641, tx 324336 rx 2951824

I have dns and dns-2 configured as Global Nameservers (using the tailscale IP), with Override local DNS enabled.

On the dns servers, I configured the CNAME described at the start of this issue. Do this and my Android phone and Arch computers are unable to follow the CNAME.

Change that record to an A pointing at the tailscale IP (instead of the magic domain name) it will work.

Obviously just using the A record is a sufficient mitigation to keep me happy–but I wanted to report the issue with CNAME traversal just in case it wasn’t a known thing yet.

Are there any recent changes that introduced the issue?

No recent changes–this has been an issue since I on-boarded.

OS

Linux, Android

OS version

Arch Linux, Android 12

Tailscale version

1.26.1

Bug report

BUG-f5650105cdbba214cc96bc47d9c0281f70f80520e943ccf75576ad5a1e3698db-20220710030346Z-b37363cc07a586cb

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

This is a public DNS CNAME record pointing to a name which only exists in Magic DNS and does not exist in public DNS. The DNS server will try to recursively resolve the target of the CNAME, intending to be able to return both the CNAME and an A record of the target. Looking at the full output, it gets back an NXDOMAIN from 8.8.8.8 with only the CNAME record populated:

$ dig @8.8.8.8 grocy.home.robinopletal.com

; <<>> DiG 9.18.1-1ubuntu1.2-Ubuntu <<>> @8.8.8.8 grocy.home.robinopletal.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 53497
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;grocy.home.robinopletal.com.   IN      A

;; ANSWER SECTION:
grocy.home.robinopletal.com. 300 IN     CNAME   microserver.fourstepper.github.beta.tailscale.net.

;; AUTHORITY SECTION:
tailscale.net.          300     IN      SOA     ns1.dnsimple.com. admin.dnsimple.com. 1597621395 86400 7200 604800 300

;; Query time: 55 msec
;; SERVER: 8.8.8.8#53(8.8.8.8) (UDP)
;; WHEN: Thu Oct 06 17:47:55 PDT 2022
;; MSG SIZE  rcvd: 174

Note the status: NXDOMAIN

From internal testing, the result varies by OS:

  • macOS, iOS and Linux when they receive an NXDOMAIN for the target of the CNAME will do a subsequent lookup on the CNAME value (effectively ignoring the NXDOMAIN status)
  • Android and Windows don’t do the subsequent lookup on the CNAME value. Instead, they see the NXDOMAIN response and fail.