Live data from Hacker News

Free DDNS with Cloudflare and a cronjob

github.com

51–60 of 202 posts

Re: Free DDNS with Cloudflare and a cronjob

#51
post #37

Since my IP hardly changes, I went from DDNS to an email notifying me when the IP changes with this cron: old_ip=`cat ~/.prev_ip` my_ip=`ifconfig em0 | awk '/inet/ {print $2}' 2>&1` my_email=me@example.com if [ "$my_ip" != "$old_ip" ]; then echo $my_ip > ~/.prev_ip echo $my_ip | mail -r $my_email -s "New IP: $my_ip" $my_email fi

> Since my IP hardly changes...

Same. Our wireline ISPs used to issue new public IPs every 1-12 weeks. Now it's more like 6 mos to never.

I'm thinking this is due to pressure from IPv4 exhaustion and the rise of easy DDNS. There's also an overall shift - from using tech to protect profit-generating services to using lobbyists.

To share an anecdote from the before times: I was once trying to setup a VPN endpoint on a client's DSL connection. Every time I initiated the connection, their public IP would change. The lease renewal was fairly quick and I could trigger 5 changes a minute.

Re: Free DDNS with Cloudflare and a cronjob

#52

Seems to rely on https://api.ipify.org/ to determine public IP. Is there any Cloudflare service one can use to determine the IP instead? That way there’s not an extra company in addition to Cloudflare itself that you need to continue existing.

Kind of, you can use the CF CDN to grab an external IP by using any CF site.

Example: https://www.fullspectrum.dev/a-less-suspect-way-to-get-exter...

Re: Free DDNS with Cloudflare and a cronjob

#54
post #25

Earlier quoted context omitted.

The (above) shared url leveraging the cloudflare.com domain name seems to show ip v6 address, while I've noticed that the following defaults to showing ip v4 address: https://1.1.1.1/cdn-cgi/trace Pick your poison as you wish - either is great! :-)

I’d pick the one that supports IPv6 and then make two separate requests to it. One request over IPv4 and one over IPv6. curl -4 https://www.cloudflare.com/cdn-cgi/trace curl -6 https://www.cloudflare.com/cdn-cgi/trace Also the reason that the 1.1.1.1 one shows only IPv4 address is because 1.1.1.1 is itself an IPv4 address. So any connection to it will have to be using IPv4.

could you not retrieve your ipv6 directly from the system?

Re: Free DDNS with Cloudflare and a cronjob

#55

Earlier quoted context omitted.

Does Cloudflare have a history of sunsetting products they've bought? Acquisitions by Google, Apple, Meta, etc. are yellow flags that the product may cease to exist soon. I wonder if Cloudflare has a better track record in that regard.

No one sunsets products like Google. I’m in the middle of transferring all my domains from Squarespace thanks to Googles sale of that business to that incredibly lousy vendor.

This is how I ended up on Cloudflare. Burn by Google yet again.

Re: Free DDNS with Cloudflare and a cronjob

#56
post #37

Since my IP hardly changes, I went from DDNS to an email notifying me when the IP changes with this cron: old_ip=`cat ~/.prev_ip` my_ip=`ifconfig em0 | awk '/inet/ {print $2}' 2>&1` my_email=me@example.com if [ "$my_ip" != "$old_ip" ]; then echo $my_ip > ~/.prev_ip echo $my_ip | mail -r $my_email -s "New IP: $my_ip" $my_email fi

> Since my IP hardly changes... Same. Our wireline ISPs used to issue new public IPs every 1-12 weeks. Now it's more like 6 mos to never. I'm thinking this is due to pressure from IPv4 exhaustion and the rise of easy DDNS. There's also an overall shift - from using tech to protect profit-generating services to using lobbyists. To share an anecdote from the before times: I was once trying to setup a VPN endpoint on a…

For me it changes reliably on every reconnect, but there are no forced reconnects, and I now have my router not restarting basically ever since I am on openwrt and am done with setting everything up.

Re: Free DDNS with Cloudflare and a cronjob

#58
I’ve been favoring Tailscale lately for establishing magical access to machines at home. Because it permits two-factor authentication based on Google and other systems, it seems more secure than just having things exposed via public IP. That being said I definitely appreciate that being really on the internet has its uses!

Re: Free DDNS with Cloudflare and a cronjob

#59

Seems to rely on https://api.ipify.org/ to determine public IP. Is there any Cloudflare service one can use to determine the IP instead? That way there’s not an extra company in addition to Cloudflare itself that you need to continue existing.

https://www.cloudflare.com/cdn-cgi/trace will return your ip.

This is how I use it in my bash script:

  current_ip=$(curl -s -X GET https://1.1.1.1/cdn-cgi/trace | grep -Po "(?

Re: Free DDNS with Cloudflare and a cronjob

#60

Instead of using DDNS, I have been using Cloudflare tunnels to expose my home services to the internet. The setup is much simpler and it seems like it's more secure too You specify a port and point it to a subdomain and it just immediately works, no maintenance necessary. The daemon only needs to be installed once with a simple terminal command

How can you claim it's simpler in the light of the revelations in noname120's comment?

Dynamic DNS is literally one little service you run to "phone home" to the dynamic DNS provider. This service is bundled in consumer routers; just find it in the WebUI, put in the credentials and turn it on.

You know what could be simple: a periodic job that figures out your public IP address, and if it has changed, generates a hosts file entry for it, and e-mails it to you. If all you care about is just you having access to home while you are roaming about, that could do it. It also occurs to me that it makes a good backup strategy in case something goes wrong with DDNS while you are traveling.

Post reply on HN