[Bug] Same name hostnames exitnode shows only the old one but they have different node names #960

Closed
opened 2025-12-29 02:26:44 +01:00 by adam · 9 comments
Owner

Originally created by @masterwishx on GitHub (Feb 27, 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

After I made new headscale server with same node hostnames as in previous server was but changed the old one new node name. and new node have old name .
I cant see exit-node from new node only the old one.

I'm using Adguard on this exit node and I see like exit node working but in console shows from old one not new also in headscale-admin of course.

Expected Behavior

Should see all exit-nodes from different node names

Steps To Reproduce

  1. Rename old exit-node node name to *-old.
  2. Give new node the old node name.
  3. check exit node only the old one exist but seems new one is working ....

Environment

- OS:
- Headscale version: 0.25.1
- Tailscale version: 1.80.2

Runtime environment

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

Anything else?

IP HOSTNAME COUNTRY CITY STATUS
100.64.0.4 instance-mysite-old.hs.mysite.net - - offline
100.64.0.1 instance-mysite-cloud2.hs.mysite.net - - -

the new exit-node is node name :

100.64.0.15 instance-mysite-cloud.hs.mysite.net

from headscale-admin:

                       node names
100.64.0.4       instance-mysite-old 
100.64.0.15     instance-mysite-cloud

100.64.0.15, 100.64.0.4 have both hostname instance-mysite-cloud

Originally created by @masterwishx on GitHub (Feb 27, 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 After I made new headscale server with same node hostnames as in previous server was but changed the old one new node name. and new node have old name . I cant see exit-node from new node only the old one. I'm using Adguard on this exit node and I see like exit node working but in console shows from old one not new also in headscale-admin of course. ### Expected Behavior Should see all exit-nodes from different node names ### Steps To Reproduce 1. Rename old exit-node node name to *-old. 2. Give new node the old node name. 3. check exit node only the old one exist but seems new one is working .... ### Environment ```markdown - OS: - Headscale version: 0.25.1 - Tailscale version: 1.80.2 ``` ### Runtime environment - [x] Headscale is behind a (reverse) proxy - [x] Headscale runs in a container ### Anything else? IP HOSTNAME COUNTRY CITY STATUS 100.64.0.4 instance-mysite-old.hs.mysite.net - - offline 100.64.0.1 instance-mysite-cloud2.hs.mysite.net - - - the new exit-node is node name : 100.64.0.15 instance-mysite-cloud.hs.mysite.net from headscale-admin: ``` node names 100.64.0.4 instance-mysite-old 100.64.0.15 instance-mysite-cloud ``` `100.64.0.15, 100.64.0.4` have both hostname `instance-mysite-cloud`
adam added the bug label 2025-12-29 02:26:44 +01:00
adam closed this issue 2025-12-29 02:26:44 +01:00
Author
Owner

@nblock commented on GitHub (Mar 16, 2025):

I tried to reproduce your issue and started with n1 as regular node and n2 as the initial exit node:

$ headscale user list
ID | Name | Username | Email | Created
1  |      | user     |       | 2025-03-16 10:32:25

$ headscale nodes list
ID | Hostname | Name | MachineKey | NodeKey | User | IP addresses                  | Ephemeral | Last seen           | Expiration | Connected | Expired
1  | n1       | n1   | [7qgvF]    | [nLMvQ] | user | 100.64.0.1, fd7a:115c:a1e0::1 | false     | 2025-03-16 10:32:31 | N/A        | online    | no
2  | n2       | n2   | [Pri1O]    | [HwITY] | user | 100.64.0.2, fd7a:115c:a1e0::2 | false     | 2025-03-16 10:34:49 | N/A        | online    | no

$ headscale route list
ID | Node | Prefix    | Advertised | Enabled | Primary
1  | n2   | 0.0.0.0/0 | true       | true    | -
2  | n2   | ::/0      | true       | true    | -
n1:~$ tailscale exit-node list

 IP             HOSTNAME              COUNTRY     CITY      STATUS
 100.64.0.2     n2.tn.example.com     -           -         -

Followed your steps to reproduce:

  • Rename n2 to n2-old: headscale nodes rename -i 2 n2-old
  • Join n3 as new exit node, enable routes in headscale
  • Rename n3 to n2: headscale nodes rename -i 3 n2

It looks like this on headscale:

$ headscale nodes list
ID | Hostname | Name   | MachineKey | NodeKey | User | IP addresses                  | Ephemeral | Last seen           | Expiration | Connected | Expired
1  | n1       | n1     | [7qgvF]    | [nLMvQ] | user | 100.64.0.1, fd7a:115c:a1e0::1 | false     | 2025-03-16 10:43:22 | N/A        | online    | no
2  | n2       | n2-old | [Pri1O]    | [HwITY] | user | 100.64.0.2, fd7a:115c:a1e0::2 | false     | 2025-03-16 10:43:14 | N/A        | online    | no
3  | n3       | n2     | [ZlrXk]    | [09eDi] | user | 100.64.0.3, fd7a:115c:a1e0::3 | false     | 2025-03-16 10:44:55 | N/A        | online    | no

$ headscale route list
ID | Node   | Prefix    | Advertised | Enabled | Primary
1  | n2-old | 0.0.0.0/0 | true       | true    | -
2  | n2-old | ::/0      | true       | true    | -
3  | n2     | 0.0.0.0/0 | true       | true    | -
4  | n2     | ::/0      | true       | true    | -

and like this on n1:

n1:~$ tailscale exit-node list

 IP             HOSTNAME                  COUNTRY     CITY      STATUS
 100.64.0.2     n2-old.tn.example.com     -           -         -
 100.64.0.3     n2.tn.example.com         -           -         -


n1:~$ ping -c 1 n2-old
PING n2-old.tn.example.com (100.64.0.2) 56(84) bytes of data.
64 bytes from n2-old.tn.example.com (100.64.0.2): icmp_seq=1 ttl=64 time=1.75 ms

--- n2-old.tn.example.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.747/1.747/1.747/0.000 ms


n1:~$ ping -c 1 n2
PING n2.tn.example.com (100.64.0.3) 56(84) bytes of data.
64 bytes from n2.tn.example.com (100.64.0.3): icmp_seq=1 ttl=64 time=2.73 ms

--- n2.tn.example.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 2.731/2.731/2.731/0.000 ms

Summary:

  • Both exit nodes can be selected by their updated name n2-old and n2
  • They are picked up correctly by tailscale
  • Traffic is routed through the selected exit node

I can't reproduce your issue. Please check the steps above carefully, try to reproduce it again and provide detailed, step-by-step instructions to reproduce.

@nblock commented on GitHub (Mar 16, 2025): I tried to reproduce your issue and started with `n1` as regular node and `n2` as the initial exit node: ```bash $ headscale user list ID | Name | Username | Email | Created 1 | | user | | 2025-03-16 10:32:25 $ headscale nodes list ID | Hostname | Name | MachineKey | NodeKey | User | IP addresses | Ephemeral | Last seen | Expiration | Connected | Expired 1 | n1 | n1 | [7qgvF] | [nLMvQ] | user | 100.64.0.1, fd7a:115c:a1e0::1 | false | 2025-03-16 10:32:31 | N/A | online | no 2 | n2 | n2 | [Pri1O] | [HwITY] | user | 100.64.0.2, fd7a:115c:a1e0::2 | false | 2025-03-16 10:34:49 | N/A | online | no $ headscale route list ID | Node | Prefix | Advertised | Enabled | Primary 1 | n2 | 0.0.0.0/0 | true | true | - 2 | n2 | ::/0 | true | true | - ``` ```bash n1:~$ tailscale exit-node list IP HOSTNAME COUNTRY CITY STATUS 100.64.0.2 n2.tn.example.com - - - ``` Followed your steps to reproduce: * Rename `n2` to `n2-old`: `headscale nodes rename -i 2 n2-old` * Join `n3` as new exit node, enable routes in headscale * Rename `n3` to `n2`: `headscale nodes rename -i 3 n2` It looks like this on headscale: ```bash $ headscale nodes list ID | Hostname | Name | MachineKey | NodeKey | User | IP addresses | Ephemeral | Last seen | Expiration | Connected | Expired 1 | n1 | n1 | [7qgvF] | [nLMvQ] | user | 100.64.0.1, fd7a:115c:a1e0::1 | false | 2025-03-16 10:43:22 | N/A | online | no 2 | n2 | n2-old | [Pri1O] | [HwITY] | user | 100.64.0.2, fd7a:115c:a1e0::2 | false | 2025-03-16 10:43:14 | N/A | online | no 3 | n3 | n2 | [ZlrXk] | [09eDi] | user | 100.64.0.3, fd7a:115c:a1e0::3 | false | 2025-03-16 10:44:55 | N/A | online | no $ headscale route list ID | Node | Prefix | Advertised | Enabled | Primary 1 | n2-old | 0.0.0.0/0 | true | true | - 2 | n2-old | ::/0 | true | true | - 3 | n2 | 0.0.0.0/0 | true | true | - 4 | n2 | ::/0 | true | true | - ``` and like this on `n1`: ```bash n1:~$ tailscale exit-node list IP HOSTNAME COUNTRY CITY STATUS 100.64.0.2 n2-old.tn.example.com - - - 100.64.0.3 n2.tn.example.com - - - n1:~$ ping -c 1 n2-old PING n2-old.tn.example.com (100.64.0.2) 56(84) bytes of data. 64 bytes from n2-old.tn.example.com (100.64.0.2): icmp_seq=1 ttl=64 time=1.75 ms --- n2-old.tn.example.com ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 1.747/1.747/1.747/0.000 ms n1:~$ ping -c 1 n2 PING n2.tn.example.com (100.64.0.3) 56(84) bytes of data. 64 bytes from n2.tn.example.com (100.64.0.3): icmp_seq=1 ttl=64 time=2.73 ms --- n2.tn.example.com ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 2.731/2.731/2.731/0.000 ms ``` Summary: * Both exit nodes can be selected by their updated name `n2-old` and `n2` * They are picked up correctly by tailscale * Traffic is routed through the selected exit node I can't reproduce your issue. Please check the steps above carefully, try to reproduce it again and provide detailed, step-by-step instructions to reproduce.
Author
Owner

@masterwishx commented on GitHub (Mar 16, 2025):

can't reproduce your issue. Please check the steps above carefully, try to reproduce it again and provide detailed, step-by-step instructions to reproduce.

Thanks for reproduce it.
In your example in node list :
n1, n2, n3
In my example node list:
100.64.0.15, 100.64.0.4 have both hostname instance-mysite-cloud

Becose oracle cloud was terminated my server, I made new one but hostname is same.

Maybe the easiest solution just to remove the old one with same host name as it's not avaliable at all for now.
Just wanted to inform about such case.

@masterwishx commented on GitHub (Mar 16, 2025): > can't reproduce your issue. Please check the steps above carefully, try to reproduce it again and provide detailed, step-by-step instructions to reproduce. Thanks for reproduce it. In your example in node list : n1, n2, n3 In my example node list: 100.64.0.15, 100.64.0.4 have both hostname instance-mysite-cloud Becose oracle cloud was terminated my server, I made new one but hostname is same. Maybe the easiest solution just to remove the old one with same host name as it's not avaliable at all for now. Just wanted to inform about such case.
Author
Owner

@masterwishx commented on GitHub (Mar 16, 2025):

ID | Hostname                    | Name                         | MachineKey        | NodeKey       | User               | IP addresses
4  | instance-mysite-cloud       | instance-mysite-cloud-old    | [Xxxx]            | [xxxx]        | masterwishx     | 100.64.0.4, fd7a:115c:a1e0::4 
15 | instance-mysite-cloud       | instance-mysite-cloud        | [xxxx]            | [xxxx]        | masterwishx     | 100.64.0.15, fd7a:115c:a1e0::f 

@nblock as you can see hostnames as same !

@masterwishx commented on GitHub (Mar 16, 2025): ``` ID | Hostname | Name | MachineKey | NodeKey | User | IP addresses 4 | instance-mysite-cloud | instance-mysite-cloud-old | [Xxxx] | [xxxx] | masterwishx | 100.64.0.4, fd7a:115c:a1e0::4 15 | instance-mysite-cloud | instance-mysite-cloud | [xxxx] | [xxxx] | masterwishx | 100.64.0.15, fd7a:115c:a1e0::f ``` @nblock as you can see hostnames as same !
Author
Owner

@nblock commented on GitHub (Mar 16, 2025):

Maybe the easiest solution just to remove the old one with same host name as it's not avaliable at all for now.

Yes, does it work once you remove node with ID=4?

@nblock commented on GitHub (Mar 16, 2025): > Maybe the easiest solution just to remove the old one with same host name as it's not avaliable at all for now. Yes, does it work once you remove node with ID=4?
Author
Owner

@masterwishx commented on GitHub (Mar 16, 2025):

Yes, does it work once you remove node with ID=4?

i removed node 4 with exit node ,runned tailscale up --login-server=https://headscale.mysite.com --reset --ssh --advertise-exit-node --accept-dns --accept-routes and rebooted node 15, but still no route on id 15

@masterwishx commented on GitHub (Mar 16, 2025): > Yes, does it work once you remove node with ID=4? i removed node 4 with exit node ,runned `tailscale up --login-server=https://headscale.mysite.com --reset --ssh --advertise-exit-node --accept-dns --accept-routes` and rebooted node 15, but still no route on id 15
Author
Owner

@masterwishx commented on GitHub (Mar 16, 2025):

in node 15 i have in sysctl.conf :

Image

@masterwishx commented on GitHub (Mar 16, 2025): in node 15 i have in sysctl.conf : ![Image](https://github.com/user-attachments/assets/78c10669-984c-4a38-b20b-a61e138a6e91)
Author
Owner

@masterwishx commented on GitHub (Mar 16, 2025):

ohh its working after :

added --force-reauth to :

tailscale up --login-server=https://headscale.mysite.com --reset --ssh --advertise-exit-node --accept-dns --accept-routes

@masterwishx commented on GitHub (Mar 16, 2025): ohh its working after : added `--force-reauth` to : `tailscale up --login-server=https://headscale.mysite.com --reset --ssh --advertise-exit-node --accept-dns --accept-routes `
Author
Owner

@nblock commented on GitHub (Mar 17, 2025):

ohh its working after :

added --force-reauth to :

Great to hear, thanks for sharing the fix.

@nblock commented on GitHub (Mar 17, 2025): > ohh its working after : > > added `--force-reauth` to : Great to hear, thanks for sharing the fix.
Author
Owner

@masterwishx commented on GitHub (Mar 17, 2025):

Great to hear, thanks for sharing the fix.

Yep but still not sure if it work when two hostnames are same...

@masterwishx commented on GitHub (Mar 17, 2025): > Great to hear, thanks for sharing the fix. Yep but still not sure if it work when two hostnames are same...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#960