Using MyIpUpdater to update dynamic public Addresses

Introduction

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 MyIpUpdater-jar-with-dependencies.jar file.

Alternatively you can clone the repository and build using Maven (see the README.md for details)

The Command line syntax is domainName DnsHost Authdata

For example

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

Provider keyword authdata
DigitalOcean do Personal Access Token

Example

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 173.209.164.230
Domain IP is 173.209.164.233
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 173.209.164.230
Domain IP is 173.209.164.230
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.

Other notes

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.