💾 Archived View for gemini.mingmengtou.org › dynamic-dns.gmi captured on 2023-06-16 at 16:41:41. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-11-30)
-=-=-=-=-=-=-
setting up a home gemini server was also the first time that i used a dynamic dns - late to the party again! i already subscribe to a kvm server for web-hosting and this is physically elsewhere in europe.
i bought a cloudns.net dns hosting plan for web-hosting reasons (DNS) and cloudns provide dynamic dns with their plans. i think that this is more cost effective for me than running my own dns servers and paying for the ip addresses. also i don't need to pay extra for a reliable dynamic dns service.
i could have used my server hosting provider's dns but i have more control over my dns records with a dns hosting plan than i would have otherwise.
a fully qualified domain name (FQDN): gemini.mingmengtou.org
formed: hostname.domain.tld
DNS A records for the domain mingmengtou.org point to my web-server. an A record for gemini.mingmingtou.org that points to a dynamic ip. easy to do with the cloudns records system.
cloudns provide scripts in a number of scripting languages to update the A record with the dynamic ip. i started off with the wget script but i now use their python script. scripts include an option for emailing us when the we may have multiple dynamic dns. i plan to take advantage of that when i set up my next home gemini server.
dynamic ip update scripts will obviously fail if broadband is interrupted; in this case cron sends a server internal email to /var/mail/[user].
i use this command to view cron emails because i'm interested in how often the link between my server and the internet breaks:
cat /var/mail/[user] | sed -nr '/Subject: Cron|Date:|IOError:/p'
replace [user] as you need.
outputs the bits of the emails that instrest me so far:
Subject: Cron <[user]@gemini> python /home/[user]/dynamic-url-python.py Date: Fri, 05 Mar 2021 00:16:28 +0000 IOError: [Errno socket error] [Errno 0] Connection timed out Subject: Cron <[user]@gemini> python /home/[user]/dynamic-url-python.py Date: Fri, 05 Mar 2021 22:36:02 +0000 IOError: [Errno socket error] [Errno -3] Temporary failure in name resolution
i replaced my user name with [user].
i opened ports on my home router for gemini (1965) and ssh (of course non-standard) and gave my gemini pi server a static ip.
the first entry keeps the dynamic dns A record up to date. the second my own script to log ip changes. if you do something similar change [user] to what works for you.
my broadband provider issued ip obviously changes from time to time and this arrangement cannot prevent all network errors but the downtime is minimal.
we can check our ip with:
$ dig +short [our FQDN]
i'm interested in how often the ip may change so i wrote a bash script to log the changes to within a few minutes of the change. to play nice the script randomly picks a 'what is my ip' service from a list so that it doesn't keep polling the same service. the script is on a 6 minute cronjob.
i had a bit of fun writing it and as it may be of use to you:
2021-03-16 - source code for my daft bash script.
2021-03-16 - daft ip change logging bash script for download (2.0KiB).
sha256sum 16939544fd36fec8672b096901e5dd3e7a319b42daea883ff436b61f16f77f37 publicipscript-2021-03-16.tar.gz
the script has many, many, comments so i won't further explain the workings here. I put a licence on it for the sake of putting a licence on it.
---
return to gemini.mingmengtou.org index page.
---
neil.gemini@mingmengtou.org
content licensed CC-BY-SA 4.0 unless stated.