mirror of
https://github.com/juanfont/headscale.git
synced 2026-01-11 20:00:28 +01:00
Custom/change IP address #504
Closed
opened 2025-12-29 02:19:10 +01:00 by adam
·
25 comments
No Branch/Tag Specified
main
update_flake_lock_action
gh-pages
kradalby/release-v0.27.2
dependabot/go_modules/golang.org/x/crypto-0.45.0
dependabot/go_modules/github.com/opencontainers/runc-1.3.3
copilot/investigate-headscale-issue-2788
copilot/investigate-visibility-issue-2788
copilot/investigate-issue-2833
copilot/debug-issue-2846
copilot/fix-issue-2847
dependabot/go_modules/github.com/go-viper/mapstructure/v2-2.4.0
dependabot/go_modules/github.com/docker/docker-28.3.3incompatible
kradalby/cli-experiement3
doc/0.26.1
doc/0.25.1
doc/0.25.0
doc/0.24.3
doc/0.24.2
doc/0.24.1
doc/0.24.0
kradalby/build-docker-on-pr
topic/docu-versioning
topic/docker-kos
juanfont/fix-crash-node-id
juanfont/better-disclaimer
update-contributors
topic/prettier
revert-1893-add-test-stage-to-docs
add-test-stage-to-docs
remove-node-check-interval
fix-empty-prefix
fix-ephemeral-reusable
bug_report-debuginfo
autogroups
logs-to-stderr
revert-1414-topic/fix_unix_socket
rename-machine-node
port-embedded-derp-tests-v2
port-derp-tests
duplicate-word-linter
update-tailscale-1.36
warn-against-apache
ko-fi-link
more-acl-tests
fix-typo-standalone
parallel-nolint
tparallel-fix
rerouting
ssh-changelog-docs
oidc-cleanup
web-auth-flow-tests
kradalby-gh-runner
fix-proto-lint
remove-funding-links
go-1.19
enable-1.30-in-tests
0.16.x
cosmetic-changes-integration
tmp-fix-integration-docker
fix-integration-docker
configurable-update-interval
show-nodes-online
hs2021
acl-syntax-fixes
ts2021-implementation
fix-spurious-updates
unstable-integration-tests
mandatory-stun
embedded-derp
prtemplate-fix
v0.28.0-beta.1
v0.27.2-rc.1
v0.27.1
v0.27.0
v0.27.0-beta.2
v0.27.0-beta.1
v0.26.1
v0.26.0
v0.26.0-beta.2
v0.26.0-beta.1
v0.25.1
v0.25.0
v0.25.0-beta.2
v0.24.3
v0.25.0-beta.1
v0.24.2
v0.24.1
v0.24.0
v0.24.0-beta.2
v0.24.0-beta.1
v0.23.0
v0.23.0-rc.1
v0.23.0-beta.5
v0.23.0-beta.4
v0.23.0-beta3
v0.23.0-beta2
v0.23.0-beta1
v0.23.0-alpha12
v0.23.0-alpha11
v0.23.0-alpha10
v0.23.0-alpha9
v0.23.0-alpha8
v0.23.0-alpha7
v0.23.0-alpha6
v0.23.0-alpha5
v0.23.0-alpha4
v0.23.0-alpha4-docker-ko-test9
v0.23.0-alpha4-docker-ko-test8
v0.23.0-alpha4-docker-ko-test7
v0.23.0-alpha4-docker-ko-test6
v0.23.0-alpha4-docker-ko-test5
v0.23.0-alpha-docker-release-test-debug2
v0.23.0-alpha-docker-release-test-debug
v0.23.0-alpha4-docker-ko-test4
v0.23.0-alpha4-docker-ko-test3
v0.23.0-alpha4-docker-ko-test2
v0.23.0-alpha4-docker-ko-test
v0.23.0-alpha3
v0.23.0-alpha2
v0.23.0-alpha1
v0.22.3
v0.22.2
v0.23.0-alpha-docker-release-test
v0.22.1
v0.22.0
v0.22.0-alpha3
v0.22.0-alpha2
v0.22.0-alpha1
v0.22.0-nfpmtest
v0.21.0
v0.20.0
v0.19.0
v0.19.0-beta2
v0.19.0-beta1
v0.18.0
v0.18.0-beta4
v0.18.0-beta3
v0.18.0-beta2
v0.18.0-beta1
v0.17.1
v0.17.0
v0.17.0-beta5
v0.17.0-beta4
v0.17.0-beta3
v0.17.0-beta2
v0.17.0-beta1
v0.17.0-alpha4
v0.17.0-alpha3
v0.17.0-alpha2
v0.17.0-alpha1
v0.16.4
v0.16.3
v0.16.2
v0.16.1
v0.16.0
v0.16.0-beta7
v0.16.0-beta6
v0.16.0-beta5
v0.16.0-beta4
v0.16.0-beta3
v0.16.0-beta2
v0.16.0-beta1
v0.15.0
v0.15.0-beta6
v0.15.0-beta5
v0.15.0-beta4
v0.15.0-beta3
v0.15.0-beta2
v0.15.0-beta1
v0.14.0
v0.14.0-beta2
v0.14.0-beta1
v0.13.0
v0.13.0-beta3
v0.13.0-beta2
v0.13.0-beta1
upstream/v0.12.4
v0.12.4
v0.12.3
v0.12.2
v0.12.2-beta1
v0.12.1
v0.12.0-beta2
v0.12.0-beta1
v0.11.0
v0.10.8
v0.10.7
v0.10.6
v0.10.5
v0.10.4
v0.10.3
v0.10.2
v0.10.1
v0.10.0
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.1
v0.8.0
v0.7.1
v0.7.0
v0.6.1
v0.6.0
v0.5.2
v0.5.1
v0.5.0
v0.4.0
v0.3.6
v0.3.5
v0.3.4
v0.3.3
v0.3.2
v0.3.1
v0.3.0
v0.2.2
v0.2.1
v0.2.0
v0.1.1
v0.1.0
Labels
Clear labels
CLI
DERP
DNS
Nix
OIDC
SSH
bug
database
documentation
duplicate
enhancement
faq
good first issue
grants
help wanted
might-come
needs design doc
needs investigation
no-stale-bot
out of scope
performance
policy 📝
pull-request
question
regression
routes
stale
tags
tailscale-feature-gap
well described ❤️
wontfix
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/headscale#504
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @cg31 on GitHub (May 11, 2023).
Headscale is assigning IPs to machines in registering order as x.x.x.1 ... x.x.x.2 ... x.x.x.N.
Is it possible to add a command to assign/change the IP associated with a machine?
The reason is when using script to do automatic job, we can simply use fixed IPs directly.
@cg31 commented on GitHub (May 11, 2023):
Someone already mentioned it in https://github.com/juanfont/headscale/pull/983#issuecomment-1340170494
@san3Xian commented on GitHub (May 17, 2023):
+1 ,now I can only specify the ip of the machine by modifying the ip_addresses column in the machines table via
sqlite3 db.sqlite, which is a poor experience.@rjmalagon commented on GitHub (Jul 3, 2023):
@gbraad commented on GitHub (Jul 4, 2023):
On the headscale coordination server
On the tailscale client
@rjmalagon commented on GitHub (Jul 4, 2023):
Im my case, I used a more blunt approach to replace my custom tailnet IPV6 range to the standard one.
SELECT ip_addresses FROM machines;UPDATE machines SET ip_addresses = replace( ip_addresses, 'fdad:1cd0:8088', 'fd7a:115c:a1e0') ;@kradalby commented on GitHub (Oct 2, 2023):
While this was closed with a standardised message, I do not believe we will accept this feature for the time being, it does require more thought than it might seem on the surface and we are currently not willing to open this can of worms.
People can as mentioned use DB modification if needed, but you should rather base your network of not depending on the assigned IPs.
@github-actions[bot] commented on GitHub (Dec 31, 2023):
This issue is stale because it has been open for 90 days with no activity.
@github-actions[bot] commented on GitHub (Jan 7, 2024):
This issue was closed because it has been inactive for 14 days since being marked as stale.
@aapeliv commented on GitHub (Sep 15, 2024):
For anyone trying to backfill IPv6 addresses still on v0.22.3, this works:
@surepy commented on GitHub (Oct 31, 2024):
newer versions changed the table schema so it's now
for ipv4
@ArcticLampyrid commented on GitHub (Nov 3, 2024):
DNS is not always reliable. In my opinion, manually providing a custom IP for infrastructure will be beneficial for maintenance work.
@Geofferey commented on GitHub (Dec 3, 2024):
I know the issue is closed, however if you still Google, you'll probably land here.
Here's a quick script to assist those with changing IPs of nodes in headscale
v0.23.0.If you're like me and not SNATing or OCD I hope you'll appreciate this.
https://gist.github.com/Geofferey/e3c49d195a01229e61b878f4530bd052
wget https://gist.githubusercontent.com/Geofferey/e3c49d195a01229e61b878f4530bd052/raw/d0711e21ba645798aa438228725f3a884686ff3a/hschip.shsudo cp hschip.sh /usr/bin/hschipsudo chmod +x /usr/bin/hschipsudo hschip nodname 100.64.0.2You'll need
sudo apt-get install sqlite3ofcThe script has several sanity checks to determine if you're on
headscale versionv0.23.0, the node exist, IP is valid + tailscale CIDR:100.64.0.0/10and that the IP is not actively being used by another node... Sorry, no v6 support 😭😭😭I couldn't have engineers screwing with the DB by hand and there may be a requirement to ensure the IP is controlled since we are full routing across non tailscale nets. We are not using v6 support in our env so I wasn't gonna go the extra mile.
@TheWebMachine commented on GitHub (Dec 9, 2024):
Perfect timing! I just setup headscale for the first time tonight and wanted to move my exit node to .1!
This worked perfectly. Thank you!
@ngaro commented on GitHub (Jan 9, 2025):
Seeing that all PR's with code to implement this feature contain comments really similar to the "I do not believe we will accept this feature for the time being, it does require more thought than it might seem on the surface and we are currently not willing to open this can of worms." I assume that changing IP's will cause unexpected/buggy behavior that we are missing...
For now the only things I can think off are these things:
(Note that this is just what I expect can happen, I didn't examine the inner working of Headscale and Tailscale enough to be sure)
This shouldn't be a large issue and should just feel like laggy behavior for a few seconds
Is this behavior that you noticed and are there also other problems ?
@Oni commented on GitHub (Jan 24, 2025):
(Sorry for joining the discussion late)
You need fixed IPS if the DNS server is hosted inside the tailnet, headscale requires a fixed ip in (of course):
What about an approach similar to DHCP servers? You basically reserve ips to certain nodes.
After headscale reboots, when a node tries to connect, the server checks if it has a reserved ip. If not, it assigns a non-reserved ip.
This approach would cut down the complexity of dealing with ip changes, but would still provide the advantage of controlling ips of nodes.
@jamesandariese commented on GitHub (Mar 12, 2025):
This is exactly where I want it. I've considered using a subnet route for this instead and that's viable but more complex and requires accepting subnet routes to access DNS which I'd rather avoid if possible.
in addition to DNS, I also have a split horizon setup for my http ingress and since I can't use CNAMEs for that without a third DNS server, I have similar options.
to avoid excessive complexity, I'm going to be updating the env var for the DNS IP and likely using the external json file DNS support for the ingress.
This would solve my problems today and seems likely to provide a seamless path forward. you have all 0 of my votes :D
@kradalby commented on GitHub (Mar 13, 2025):
The IPs are fixed and will never change, you just can choose them. I think this is a non-issue.
@Oni commented on GitHub (Mar 13, 2025):
That's a great info to hear: I've never noticed this!
@almereyda commented on GitHub (Mar 15, 2025):
I think this would read
if I'm not mistaken, guided by the last sentence of the comment. The closed status of the issue adds another data point to this interpretation.
@MulverineX commented on GitHub (May 3, 2025):
@Geofferey could you please update your script for headscale v25?I just confirmed that it works, I just had to change the/var/lib/headscalepath to my headscale config path@mtmn commented on GitHub (Oct 12, 2025):
Apologies for necrobumping, but schema has changed and on
0.26.1the approach from @gbraad needs to be reformatted a bit.@burzaca commented on GitHub (Oct 28, 2025):
In my case I had to change the id of the peer as well:
Of course, the id was unused, but when I changed only the ipv4 it would not take effect
@Geofferey commented on GitHub (Oct 29, 2025):
@burzaca Does this mean the
hschipscript that I wrote is no longer compatible with recent schema changes?@reinob commented on GitHub (Nov 19, 2025):
I just swapped the ipv4 and ipv6 of two nodes, and it worked instantly without having to restart the clients (they pick up the change almsot immediately) and without having to change the id. (I did stop headscale while editing the db and started it again).
The script "hschip" would appear to work, as it already uses the nodes table with { hostname,ipv4,ipv6 }. I didn't use it though.
@TornaxO7 commented on GitHub (Dec 1, 2025):
I'd be interested in this feature because I selfhost a DNS server in my tailscale network.