Re:Cloudflare S-1
by JorgeGT on Thursday August 15, 2019 @03:46PM
(#20708942)
You forgot the API! I have my own dynamic DNS with a raspberry and the cloudflare API for instance, it's very useful.
[ Parent
| on HN ]
Oh I didn't know you could do that. Do you move the Rpi around a lot? What do you use the dynamic dns for?
Many ISPs around the world give you public IPs without NAT, but they're dynamic and change every once in a while.
Exactly my case! So I have a cronjob that compares the current IP with the previous one and, if different, sends an API request to update the DNS record.
Can you do a quick write up about how to do this? As a web developer, I feel like I should know how to host my own website from my own machine, but I've always struggled to get all the right steps in place. It'd be nice to hear from someone more experienced, so I can make sure to do it correctly!
Re:Cloudflare S-1
by icebraining on Friday August 16, 2019 @02:41AM
(#20712722)
Essentially you write a script in any language that:
1) checks what's your current IP (an easy way is to do a GET request to http://icanhazip.com/, available thanks to Red Hat engineer Major Hayden)
2) checks what was the last IP you sent to Cloudflare (saved in a text file on your disk or something like data)
3) if they are different, send a PUT request to the Cloudflare API with the new IP: https://api.cloudflare.com/#dns-records-for-a-zone-update-dn...
4) Then save that new IP in the text file, so you can check next time
Finally, you edit your crontab to run that script every few hours or so.
Re:Cloudflare S-1
by baud147258 on Friday August 16, 2019 @07:43AM
(#20714140)
I've checked icanhazip.com and it's not returning the same ip as the one from ipconfig. What does it mean? Note I know nothing how networks work and that I'm in a corporate network
Re:Cloudflare S-1
by amdavidson on Friday August 16, 2019 @08:35AM
(#20714497)
Your corporate network is using network address translation (NAT) to map an external address, shown on icanhazip.com, to a local network address, shown in ipconfig. You likely share this external address with many other users and mapping services to it will be challenging without having access to the routing/forwarding configuration.
Re:Cloudflare S-1
by baud147258 on Friday August 16, 2019 @08:55AM
(#20714666)
Okay, thank you for this information.
Oh I didn't know this, mine has always been static.
What's the reason for having such a low lease time on public IPs?