Closed FarrowStrange closed 3 years ago
Would be great if Hetzner would host an own https://ifconfig.co
instance. With this they could add a dynamic IP option which updates the DNS entry with just one request.
Otherwise I think there are this options:
https://ifconfig.co
that do the same and you can choose between them-p ifconfig.co
(could lead to problems when the service return also something else than the IP address or the service doesn't support all options)I think I have found an acceptable solution - Some DNS providers like Cloudflare, Google, OpenDNS (Cisco) or Akamai provide services to query the public ip address via DNS.
In case of those resolvers the DNS infrastructure is more reliable and faster than a single service like ifconfig.co
.
- ns1.google.com
- ns2.google.com
- ns3.google.com
- ns4.google.com
$ dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{print $2}'
$ dig -6 TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{print $2}'
- 1.1.1.1
- 2606:4700:4700::1111
$ dig -4 ch TXT +short whoami.cloudflare @1.1.1.1 | awk -F'"' '{print $2}'
$ dig -6 ch TXT +short whoami.cloudflare @2606:4700:4700::1111 | awk -F'"' '{print $2}'
- resolver1.opendns.com | resolver1.ipv6-sandbox.opendns.com
- resolver2.opendns.com | resolver2.ipv6-sandbox.opendns.com
- resolver3.opendns.com | resolver3.ipv6-sandbox.opendns.com
- resolver4.opendns.com | resolver4.ipv6-sandbox.opendns.com
dig -4 A +short myip.opendns.com @resolver1.opendns.com
dig -6 AAAA +short myip.opendns.com @resolver1.ipv6-sandbox.opendns.com
Sounds like a good idea and I also tried that. Only thing is that it creates another dependency, which in my case also created a new Linux user (tested under Manjaro).
Can you tell me what additional dependency you mean? Why do you need an additional user? The binares of dig
and awk
should be available in most operating systems.
At least for Manjaro it dig
comes with the bind
package and this creates an user. But seems like it's just special thing in that case. But then let's go for this approach!
Under Debian/Ubuntu, dig is part of the dnsutils package. This provides various client programs related to dns, like dig, nslookup
and nsupdate
. Maybe there is such a tool / utils package under Manjaro / Arch as well.
It should be checked whether there are alternatives to external services with which the public IP address can be determined. At the current time "ifconfig.co" is used to determine the public IPv4 and IPv6 addresses.
Maybe there is a solution which can be mapped via the Hetzner services.