Random suffix added to node names in DNS #271

Closed
opened 2025-12-29 01:25:37 +01:00 by adam · 3 comments
Owner

Originally created by @tonirug on GitHub (Jun 11, 2022).

Issue description
tailscale status reports node names with an added random suffix that makes magic DNS not really usable for humans

Names reported by tailscale:
toni@e14:~$ tailscale status
100.64.0.1 e14-vgygevst towanda linux -
100.64.0.3 t14-oxnwsj9u towanda windows offline
100.64.0.2 towanda-zj4yotmv towanda linux ...

Headscale node list:
toni@e14:~$ headscale nodes list
ID | Name | NodeKey | Namespace | IP addresses | Ephemeral | Last seen | Online | Expired
4 | e14 | [V9YKE] | towanda | 100.64.0.1, | false | 2022-06-11 16:18:15 | online | no
5 | towanda | [gjw4m] | towanda | 100.64.0.2, | false | 2022-06-11 16:18:15 | online | no
6 | t14 | [9UIHW] | towanda | 100.64.0.3, | false | 2022-06-11 09:34:22 | offline | no

Context info

  • Headscale v0.16.0-beta3
  • Tailscale 1.26.0
  • Same behavior on Ubuntu 20.04, 21.10 and Windows 10
Originally created by @tonirug on GitHub (Jun 11, 2022). **Issue description** tailscale status reports node names with an added random suffix that makes magic DNS not really usable for humans Names reported by tailscale: toni@e14:~$ tailscale status 100.64.0.1 e14-vgygevst towanda linux - 100.64.0.3 t14-oxnwsj9u towanda windows offline 100.64.0.2 towanda-zj4yotmv towanda linux ... Headscale node list: toni@e14:~$ headscale nodes list ID | Name | NodeKey | Namespace | IP addresses | Ephemeral | Last seen | Online | Expired 4 | e14 | [V9YKE] | towanda | 100.64.0.1, | false | 2022-06-11 16:18:15 | online | no 5 | towanda | [gjw4m] | towanda | 100.64.0.2, | false | 2022-06-11 16:18:15 | online | no 6 | t14 | [9UIHW] | towanda | 100.64.0.3, | false | 2022-06-11 09:34:22 | offline | no **Context info** - Headscale v0.16.0-beta3 - Tailscale 1.26.0 - Same behavior on Ubuntu 20.04, 21.10 and Windows 10
adam added the bug label 2025-12-29 01:25:37 +01:00
adam closed this issue 2025-12-29 01:25:37 +01:00
Author
Owner

@kradalby commented on GitHub (Jun 11, 2022):

Hi

They can be renamed with the headscale command in the newest version;

It was added to address and issue where two hosts could register the same host name and it would be an issue.

@kradalby commented on GitHub (Jun 11, 2022): Hi They can be renamed with the headscale command in the newest version; It was added to address and issue where two hosts could register the same host name and it would be an issue.
Author
Owner

@tonirug commented on GitHub (Jun 11, 2022):

Thanks a lot for your answer and suggestion. I have just renamed my nodes and now Magic DNS works great!
Best

@tonirug commented on GitHub (Jun 11, 2022): Thanks a lot for your answer and suggestion. I have just renamed my nodes and now Magic DNS works great! Best
Author
Owner

@prouveyrol commented on GitHub (Aug 22, 2022):

Having the same issue while deploying at scale using ansible, after ensuring that no two hosts can have the same hostname, I fixed it with a trivial python script that I'm posting here in case it helps anyone.
It is provided as is, and does not account for possible errors, or the case when two hosts have the same hostname.

#!/usr/bin/python3

import json
import subprocess

def runbash(command):
    process = subprocess.Popen(command.split(),stdout=subprocess.PIPE)
    process.wait()
    return process.communicate()

output, error = runbash("headscale nodes list -o json")

hosts = json.loads(output)

for host in hosts:
    if host['name'] != host['given_name']:
        print(f"Renaming {host['given_name']} to {host['name']}")
        runbash(f"headscale nodes rename -i {host['id']} {host['name']}")
@prouveyrol commented on GitHub (Aug 22, 2022): Having the same issue while deploying at scale using ansible, after ensuring that no two hosts can have the same hostname, I fixed it with a trivial python script that I'm posting here in case it helps anyone. It is provided as is, and does not account for possible errors, or the case when two hosts have the same hostname. ```python #!/usr/bin/python3 import json import subprocess def runbash(command): process = subprocess.Popen(command.split(),stdout=subprocess.PIPE) process.wait() return process.communicate() output, error = runbash("headscale nodes list -o json") hosts = json.loads(output) for host in hosts: if host['name'] != host['given_name']: print(f"Renaming {host['given_name']} to {host['name']}") runbash(f"headscale nodes rename -i {host['id']} {host['name']}") ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#271