Accessing home-servers using a personal domain name

I work remotely so being able to connect to my work hardware is important, especially when I need powerful hardware like that used for deep-learning. I’ve found that using a personal domain for an alias to be incredibly useful as :

  • Domains are easier to to remember than IP addresses (61.2.123.456 vs server.bdd.io).
  • Domain names stay the same. IP addresses change, especially those issued by consumer Internet Service Providers.
  • Using a domain allows for the registration of SSL certificates for webapps. See my guide on setting up JupyterHub and Tensorboard with SSL as an example. SSL certificates are important because it’s what enables you to communicate securely over HTTP. Without a domain, you can still use SSL but you’ll need to deal with self-signed certificates which are confusing to configure and won’t show as valid by default in browsers.

Pre-requisites

  • This guide uses Ubuntu 16.04.3 LTS, though any linux/unix distribution would work.
  • Ensure necessary ports have been forwarded on your router.
  • I use google domains. You can use other domain registration services, but the instructions will differ slightly.

Configuring a custom subdomain

Google domains management page

  • Select the servers tab.

Creating

  • Create a synethetic record.
  • Select Dynamic DNS.
  • Create a subdomain you want to use as an alias to your home server. In my case, mlbox.bdd.io and tf.bdd.io.

3

  • Make note of your username and password. You’ll use this later to configure the ddclient

4

Configuring dynamic DNS for IP updates

Install ddclient . DDclient is a client used to update dynamic DNS entries.

sudo apt-get install ddclient

Edit your ddclient configuration file. sudo vi /etc/ddclient.conf where xxx.bdd.io is your domain and the login and password are the same from the steps above. IMPORTANT passwords must be surrounded by single quotes in the configuration file.

# /etc/ddclient.conf
protocol=dyndns2
use=web
server=domains.google.com
ssl=yes
login=xxxxxxx
password='xxxxxxxxxx'
xxx.bdd.io

Check to make sure your client succesfully updates it’s record.

sudo ddclient -daemon=0 -debug -verbose -noquiet

...
...
SUCCESS:  xxx.bdd.io: : IP address was set to 1.1.1.1.
SUCCESS:  yyy.bdd.io: : IP address was set to 1.1.1.1.

Now go ahead and check your google domains dashbaord to make sure it now has your correct IP address.

Sometimes DNS changes can take several hours to propogate.

All done!

Congratulations! You should now be able to access your remote machine via a handy-dandy subdomain!