Anyone that has run public services out of their own home has run into the issue where there ISP is dynamically assigning them a Public IP address. So they need some method to dynamically update there DNS records to reflect there changing IP address.
There is several good services that will do this for you, but most lock you into a provider. So I went about creating my own application to accomplish this task.
How to use this tool
Download the latest version from Github You want the
Alternatively you can clone the repository and build using Maven (see the README.md for details)
The Command line syntax is domainName DnsHost Authdata
java -cp target/MyIpUpdater-jar-with-dependencies.jar com.invoke.coffee.MyIpUpdater.main test.home.invoke.coffee do xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Each DNS provider will have there own Auth syntax
|DigitalOcean||do||Personal Access Token|
As an example of what it will look like when it needs to update the DNS record
root@mx:~/MyIpUpdater# java -cp ./MyIpUpdater-jar-with-dependencies.jar com.invoke.coffee.MyIpUpdater.main test.home.invoke.coffee do xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx My current IP address is 18.104.22.168 Domain IP is 22.214.171.124 Updating A record
As an example of what it will look like when it does NOT need to update the DNS record
root@mx:~/MyIpUpdater# java -cp ./MyIpUpdater-jar-with-dependencies.jar com.invoke.coffee.MyIpUpdater.main test.home.invoke.coffee do xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx My current IP address is 126.96.36.199 Domain IP is 188.8.131.52 Record is up to date root@mx:~/MyIpUpdater#
Setting up in Cron
I would expect that most people would want to set this up using something like Cron to regularly check this.
For me I used the following cron tab entry to check every day. (I actually run this in a LXC container on proxmox)
0 1 * * * java -cp /root/MyIpUpdater/MyIpUpdater-jar-with-dependencies.jar com.invoke.coffee.MyIpUpdater.main test.home.invoke.coffee do xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx >> /root/MyIpUpdater/cron.log
>> /root/MyIpUpdater/cron.log will log the checking and any status changes into a text file that I can check later.
Currently this only support Digital ocean (as thats the one I cared about) but can easily support other providers.
Java is not the most lightweight choice for this (Python would have worked as well) But I have been trying to improve my Java Programing so that was the language of chose.
I later may want to create some notification when the IP gets updated, but with the log I can see whenever this happens.