juanfont / headscale

An open source, self-hosted implementation of the Tailscale control server
BSD 3-Clause "New" or "Revised" License
23.72k stars 1.3k forks source link

[Feature] Assign IP addresses to non-headscale devices #2169

Open crimewaffle opened 1 month ago

crimewaffle commented 1 month ago

Use case

Currently, when accessing multiple networks with identical subnets (e.g., 10.10.10.0/24), only one network can be routed at a time. Switching between these networks requires manually disabling one subnet route and enabling another, which is inefficient.

Description

Introduce the ability to assign unique Headscale IPs (100.64.0.0/10) to specific devices, bypassing the need to route entire subnets. This would allow direct access to individual devices across multiple networks without conflicting subnet routes.

Example Use Case:

Network1: 10.10.10.0/24 (Switch/AP at 10.10.10.11)
Network2: 10.10.10.0/24 (Another Switch/AP at 10.10.10.175)

With this feature, users could assign a unique Headscale IP (e.g., 100.64.x.x) to the switch at 10.10.10.11 on Network1 and another Headscale IP to the switch at 10.10.10.175 on Network2. This eliminates the need for manual routing of entire subnets and simplifies access to specific devices on overlapping subnets.

Contribution

How can it be implemented?

No response

kradalby commented 1 month ago

If I understand you correctly, I do not think we can do this, the only thing we do is pass a set of routes down to the Tailscale client, which then builds a routing table on what to send where. Headscale by itself cant really map addresses to subnet routers.

If I am misunderstanding and you can find a feature like this in Tailscale's documentation, then we might be able to build it.

As a potential work around, tho tedious, you can announce /32 subnet routes, so for the subnet router that is in front of Switch/AP at 10.10.10.11 you can announce 10.10.10.11/32, but you will have to manage them all "manually" or make some script to talk to the API.

ChibangLW commented 1 month ago

4via6 subnet routers is probably what you want or need.

It should be supported in headscale.

I am not sure it would be a good idea to assign a tailnet ip to non-tailnet devices (if at all possible).

crimewaffle commented 1 month ago

4via6 might actually be it.

i disabled ipv6 tho

implementing that into my workflow is going to be a pain in the ass lmao