Using DDNS by MyDNS

Resister your information

At first, visit MyDNS site https://www.mydns.jp/ and resister your information.

Information

  • ID: mydnsxxxxxx
  • Password: XXXXXXXXX
  • Domain: lama-lab.mydns.jp

Records

  • * = A
  • * = AAAA
  • www = A
  • www = AAAA

IP Notification

$ sudo vi /etc/cron.hourly/mydns-ip-notify

The contents of the file is

#!/bin/bash

URL="https://ipv4.mydns.jp/login.html"
URLv6="https://ipv6.mydns.jp/login.html"

AUTH="ID:PASSWORD"

RESULT=`curl -s -S -I -f -u ${AUTH} ${URL} | head -1`
logger -t MyDNS "${URL} - ${RESULT}"
RESULTv6=`curl -s -S -I -f -u ${AUTH} ${URLv6} | head -1`
logger -t MyDNSv6 "${URLv6} - ${RESULT}"

This script notify IP to MyDNS and log the result to log file.

Here, ID is your ID and PASSWORD is your password.

Change the permission of the file

$ sudo chmod u+x /etc/cron.hourly/mydns-ip-notify

Add the script to the cron job

$ sudo crontab -e
@reboot sleep 60 && /etc/cron.hourly/mydns-ip-notify

Notice: This is required to notify IP at a reboot time.

Last Updated on August 27, 2024 by Kenn


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *