Browsed by
Tag: technology

CloudFlare Dynamic DNS Updates from a Router

CloudFlare Dynamic DNS Updates from a Router

So you got screwed over with the No-IP debacle and now you want to host your own DDNS service using CloudFlare. Easy right? Well apparently not. Here is how i did it with my Asus RT-N66U router running AsusWRT-Merlin firmware. The information below might also apply to DD-WRT, OpenWRT, or Tomato, but i can’t confirm this as i don’t have a router that supports those firmwares.

1) Your router needs to have a version of WGET that supports SSL. 

This was the biggest hurdle i ran into. Out of the box, AsusWRT-Merlin only comes with a stripped down version of WGET that doesn’t support HTTPS links. To work around this, I had to install OPTWARE so that i could install WGET-SSL. After Optware is installed, just type in “ipkg wget-ssl install”. This will install a full version of wget into the /opt/bin folder. 

You might also be able to use CURL (which is installed by default with OPTWARE) but i had trouble getting it to work with CloudFlare. Apparently the version of CURL that OPTWARE installs by default uses an outdated version of OpenSSL (0.9.7m) that doesn’t support SHA256. Every time i tried to hit CloudFlare’s API, it returned an error. So i just stuck with WGET-SSL.

2) Write a script that will update CloudFlare with your new IP. 

To do this, i referenced this blog post to come up with a script that would work on AsusWRT-Merlin. The most import thing you need is the record ID of the A record you want to update. See the above linked blog post on how to obtain that ID. Once you have it, you can simply plug that info into my script. Here is the final script i came up with:

3) Save the above script in the /jffs/scripts folder and call it “dhcpc-event”

Before you can do this you will need to enable the JFFS section of the flash memory. Once that has been enabled, just save the above script into that location as a file called “dhcpc-event”. (I recommend using vi and doing it from the command line to avoid formatting issues)

As described in this wiki article, the dhcpc-event script is called whenever a DHCP event occurs on the WAN interface. This means any time your IP changes, this script will run. Which is exactly what we want it to do. When DHCP gives you a new IP, we want this script to update CloudFlare. 

After you’ve created the script, be sure to set it to executable. (chmod a+rx dhcpc-event) Then test it by running it. (./dhcpc-event) Remember that the script has a 30 second pause at the beginning to ensure the WAN interface is fully up and operational before it does anything. So don’t worry when it just sits there for a while after you execute it. After 30 seconds, you should see a valid JSON response with the newly update IP listed in the “content” section. I recommend setting your A record to a bogus ip (E.g. 8.8.8.8) before testing the script. That way you can verify your script updated the record correctly. 

And now you’re done. Anytime your IP changes, your router will call the script and update your IP. Again, this might work with DD-WRT or other firmwares, though i’m not sure of the specifics. If your firmware doesn’t have the dhcpc-event script like AsusWRT does, another option would be to simply create a script and then schedule it to run via CRON every hour or two. I’d definitely build in some checks to ensure you’re not constantly updating CloudFlare though. See this post for that info

Netflix Rant… Sort of.

Netflix Rant… Sort of.

No this rant isn’t about the price increase. In fact i think people who complained about the price increase need to get their priorities straight. It was a $6 increase. If you can’t afford $6 a month then you should probably cancel the service all together. Netflix raised the prices because they want to improve their streaming service and phase out their disk service. Simple as that. Change is good. Welcome to the 21st century. 

With that said, my main problem with Netflix lately has been the reliability of the disks. They just can’t seem to send me disks that work. That irritates the crap out of me simply because the ONLY reason i have the disk service is because they don’t stream new content. If they did I, along with most everyone else i believe, would cancel the disk service immediately.

The problem i’m having actually exemplifies why Netflix is phasing out their disk service. It’s costly, it’s unreliable, and it’s based on OLD technology. The internet is THE future of content delivery. The only reason we can’t stream everything right now is because of the monopoloy on good content. The entertainment industry is fighting tooth and nail to milk every penny out of the legacy disk business before it finally dies.

People who bash streaming services such as Netflix are obviously out of touch with reality. In 5 or 10 years Disks will be viewed the same way we view cassette tapes, vinyl records, and the phonograph; Irrelevant old technology. 

That said, with all of the problems i have with Netflix’s disks i still have the greatest respect for the company. I think they are heading in the right direction. I just hope they can hold out and win the battle against the old farts who control the Entertainment business. I think we will all be better off when that day comes.

Anyways, that’s just my 2 cents. Take it for whatever you think its worth.