[Feature] Can derper be set with priority? #1159

Open
opened 2025-12-29 02:28:37 +01:00 by adam · 6 comments
Owner

Originally created by @hausen1012 on GitHub (Nov 27, 2025).

Use case

First of all, I am deeply grateful to you for developing such a user-friendly tool for remote networking.
In some cases, some servers that are not very useful are used as transit servers due to their low latency. However, I actually have a server with higher bandwidth, and I prefer to use this server instead of the server with low latency. But I cannot remove the server with low latency because I need it as a backup server. So this is what I am struggling with.
If I can set priorities in derper.yaml, I believe this would be a great solution. Would this be considered?
Thank you!

Description

I would like to request support for configurable server priority in derper.yaml.

Currently, DERP clients always choose the server with the lowest latency. In some cases, this leads clients to use a low-latency but low-bandwidth server that should only serve as a backup.

By allowing administrators to assign a priority value to each DERP server, clients could prefer higher-priority servers regardless of small latency differences, while keeping lower-priority servers available as fallbacks. This would give administrators more control over routing behavior and improve reliability and performance in multi-server environments.

Contribution

  • I can write the design doc for this feature
  • I can contribute this feature

How can it be implemented?

No response

Originally created by @hausen1012 on GitHub (Nov 27, 2025). ### Use case First of all, I am deeply grateful to you for developing such a user-friendly tool for remote networking. In some cases, some servers that are not very useful are used as transit servers due to their low latency. However, I actually have a server with higher bandwidth, and I prefer to use this server instead of the server with low latency. But I cannot remove the server with low latency because I need it as a backup server. So this is what I am struggling with. If I can set priorities in derper.yaml, I believe this would be a great solution. Would this be considered? Thank you! ### Description I would like to request support for configurable server priority in derper.yaml.  Currently, DERP clients always choose the server with the lowest latency. In some cases, this leads clients to use a low-latency but low-bandwidth server that should only serve as a backup.  By allowing administrators to assign a priority value to each DERP server, clients could prefer higher-priority servers regardless of small latency differences, while keeping lower-priority servers available as fallbacks. This would give administrators more control over routing behavior and improve reliability and performance in multi-server environments. ### Contribution - [ ] I can write the design doc for this feature - [ ] I can contribute this feature ### How can it be implemented? _No response_
adam added the enhancementquestion labels 2025-12-29 02:28:37 +01:00
Author
Owner

@nblock commented on GitHub (Nov 27, 2025):

If I can set priorities in derper.yaml, I believe this would be a great solution.

Does tailscale debug force-prefer-derp <ID> work for you?

@nblock commented on GitHub (Nov 27, 2025): > If I can set priorities in derper.yaml, I believe this would be a great solution. Does `tailscale debug force-prefer-derp <ID>` work for you?
Author
Owner

@nblock commented on GitHub (Dec 2, 2025):

It seems that there is no priority field in the DERP configuration: DERPMap, DERPHomeParams, DERPRegion, DERPNode.

Forcing a specific DERP via tailscale debug force-prefer-derp <ID> might be useful as a workaround.

@nblock commented on GitHub (Dec 2, 2025): It seems that there is no priority field in the DERP configuration: [DERPMap](https://pkg.go.dev/tailscale.com/tailcfg#DERPMap), [DERPHomeParams](https://pkg.go.dev/tailscale.com/tailcfg#DERPHomeParams), [DERPRegion](https://pkg.go.dev/tailscale.com/tailcfg#DERPRegion), [DERPNode](https://pkg.go.dev/tailscale.com/tailcfg#DERPNode). Forcing a specific DERP via `tailscale debug force-prefer-derp <ID>` might be useful as a workaround.
Author
Owner

@SamyDjemai commented on GitHub (Dec 4, 2025):

@nblock DERPHomeParams has a RegionScore attribute which can be set to multiply DERP server latencies with a given factor, so as an example we can multiply a DERP region's latency by 0.01 to prioritize it, while multiplying another's by 100 will prevent most clients from connecting to it.
Is this feature supported in Headscale?

@SamyDjemai commented on GitHub (Dec 4, 2025): @nblock [DERPHomeParams](https://pkg.go.dev/tailscale.com/tailcfg#DERPHomeParams) has a `RegionScore` attribute which can be set to multiply DERP server latencies with a given factor, so as an example we can multiply a DERP region's latency by `0.01` to prioritize it, while multiplying another's by `100` will prevent most clients from connecting to it. Is this feature supported in Headscale?
Author
Owner

@hausen1012 commented on GitHub (Dec 4, 2025):

It seems that there is no priority field in the DERP configuration: DERPMap, DERPHomeParams, DERPRegion, DERPNode.

Forcing a specific DERP via might be useful as a workaround.tailscale debug force-prefer-derp <ID>

This is helpful. Thank you very much

@hausen1012 commented on GitHub (Dec 4, 2025): > It seems that there is no priority field in the DERP configuration: [DERPMap](https://pkg.go.dev/tailscale.com/tailcfg#DERPMap), [DERPHomeParams](https://pkg.go.dev/tailscale.com/tailcfg#DERPHomeParams), [DERPRegion](https://pkg.go.dev/tailscale.com/tailcfg#DERPRegion), [DERPNode](https://pkg.go.dev/tailscale.com/tailcfg#DERPNode). > > Forcing a specific DERP via might be useful as a workaround.`tailscale debug force-prefer-derp <ID>` This is helpful. Thank you very much
Author
Owner

@hausen1012 commented on GitHub (Dec 4, 2025):

@nblock DERPHomeParams has a attribute which can be set to multiply DERP server latencies with a given factor, so as an example we can multiply a DERP region's latency by to prioritize it, while multiplying another's by will prevent most clients from connecting to it.
Is this feature supported in Headscale?RegionScore``0.01``100

This seems to be a key point affecting priority. If headscale supports it, that would be great

@hausen1012 commented on GitHub (Dec 4, 2025): > [@nblock](https://github.com/nblock) [DERPHomeParams](https://pkg.go.dev/tailscale.com/tailcfg#DERPHomeParams) has a attribute which can be set to multiply DERP server latencies with a given factor, so as an example we can multiply a DERP region's latency by to prioritize it, while multiplying another's by will prevent most clients from connecting to it. > Is this feature supported in Headscale?`RegionScore``0.01``100` This seems to be a key point affecting priority. If headscale supports it, that would be great
Author
Owner

@SamyDjemai commented on GitHub (Dec 4, 2025):

Upon a quick source code check, I can't seem to find DERPHomeParams being used or mentioned anywhere. I think this will require changes to some functions such as derp.mergeDERPMaps to set up this feature

@SamyDjemai commented on GitHub (Dec 4, 2025): Upon a quick source code check, I can't seem to find `DERPHomeParams` being used or mentioned anywhere. I think this will require changes to some functions such as `derp.mergeDERPMaps` to set up this feature
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#1159