In this blog post, I’m going to show you how to write a sketch to update a DNS record hosted by one of the most famous Dynamic DNS service providers, no-ip.
Dynamic IP addresses
If you connect to Internet using a home or mobile connection, you’ll probably have a dynamic public IP address, that is it changes everytime you connect.
If you need to talk to a device on Internet, you need to write – in the message you send on the net – its public IP address: if this IP is dynamic, you may not know it.
In Internet you can find free Dynamic DNS (DDNS) services: they allow you to associate a name you choose with an IP address and they allow you to keep that association updated.
The update could be done in different ways:
- using a client running on your PC;
- with a feature present in your router:
- asking Arduino to do it for us 😉
One of the most used site offering dynamic DNS service is No-IP.
If you register for free to No-IP Free service, you can configure up to 5 hosts for Hosts/Redirects feature:
For this tutorial, I registered the following host: enctutorial.no-ip.info.
Every DDNS client performs the following steps:
- gets the actual public IP (asking the router, an external website…);
- compares that IP with the one resolved from DNS alias;
- if they are different, it updates the DNS record via service provider’s API.
In the next page, a DDNS client for Arduino…