How to update your duckdns IP automatically from your raspberry pi
Computer networkin cables
General

Hi, being able to access your home network when you are out it's a very usefull thing. But knowing that you ISP can update your home router public IP you need a way to access updated IP. That is where Dynamic DNS comes to the rescue.

DuckDNS

There are a lot of free DDNS services but the catch is find where the service stops being free or impose some limitation. I personally like the simplicity of duckdns.org. GO ahead and try for yourself, you can login with your google account. With that done choose a subdomain for your home IP, you can have up to 5. It will be in the following format: YOUR_NAME.duckdns.org. You can write on the box the current IP that the domain is pointing to.

Before we proceed be sure to take note of the token to update your IP, should be in the top right corner of the duckdns page. Just copy that we will need it in the next step.

Now we need a way to update our IP. Some routers support doing that automatically other dont. But if you want to access your network you probably have some device that you want to connect to. I will pass the steps to update your ip every 20 minutes from a raspberry pi but for any linux based system it will work as well.

Hop to your raspberry pi's terminal and type the following:

crontab -e

Crontab is the way to schedule jobs on linux we'll be using that to update our IP.

When the file opens you can pass the commando to hit the following:

*/20 * * * * curl -v https://duckdns.org/update/CHOOSEN_DOMAIN/TOKEN
Be sure to replace your TOKEN and the CHOOSEN_DOMAIN 

And that's all folks. Now every 20 minutes your ip will be updated if you want you can check out how crontab works and use another timespan, just dont go with a much shorter timespan, DuckDNS is a free service do not abuse it 😉.

Be safe and healthy.

Ver em outros idiomas: PT EN ES