C.W.K.
Stream
Lesson 07 of 12 · published

MagicDNS

~10 min · magicdns, tailscale, hostnames

Level 0Pinger
0 XP0/101 lessons0/12 achievements
0/150 XP to next level150 XP to go0% complete

Hostnames instead of IPs

With MagicDNS, you reach Tailscale devices by name — short or fully-qualified. If your machine registered as "office," it's reachable as office (short) or office.tail-net.ts.net (FQDN). MagicDNS is enabled by default on new tailnets and is the single best ergonomics win Tailscale offers.

Code

MagicDNS in action·bash
# All of these work once MagicDNS is enabled:
ssh you_username@office
ssh you_username@office.tail-net.ts.net
ping server
curl http://server:8080
rsync -avz ./ office:/home/you_username/project/

# Check that MagicDNS is on for your tailnet
tailscale status   # entries show short names

# Resolve a tailnet hostname manually
dig +short office.tail-net.ts.net
Bake into ~/.ssh/config (Track 3)·ssh-config
# Tailscale aliases
Host ts-*
    User you_username

Host ts-office
    HostName office.tail-net.ts.net
Host ts-server
    HostName server.tail-net.ts.net
Host ts-music
    HostName music.tail-net.ts.net

# Or, if you also want the short name to work everywhere:
Host office server music
    User you_username
    # MagicDNS resolves these short names directly

External links

Exercise

On any two Tailscale-connected devices, try ping <short-hostname> and ssh <short-hostname>. Both should work. Compare to using the 100.x.y.z IP — same result. Update your ~/.ssh/config to use MagicDNS names instead of IPs for any Tailscale aliases.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.