Anyone who has tried to get into touch with me or read this blog these last few days can atest to the fact that I haven’t been reachable.
My deepest apologies
.
To understand what happened, here’s a quick lowdown on how my setup works:
I’m self hosting this blog as well as my mail on a converted EasyGate that I got as a beta tester. The machine is connected onto my internet router (a Trio 3D antique) and then onto the internet. My ISP provides a temporary IP address, and as such, I need to use a dynamic DNS record to be able to keep things updated.
Now, the Trio 3D (as with most of it’s features) has a half assed (excuse my French) DynDNS system built in. I say half assed because it doesn’t accept any provider except the historic DynDNS and because it quite often forgets to update. Last week it completely stopped updating, and as an added bonus, I couldn’t get back into DynDNS to do things manually.
As a work around, I set up OVH (who are my registrar) to route my DNSes manually until I got a permanent fix. That worked until the IP changed Tuesday or Wednesday.
Now things are sorted out. I’m using OVH’s own DynDNS servers (much simpler) and am using a home built client to avoid all the dependancies other clients bought in.
The client is written in bash and depends on bash, sed and wget to work. It’s best used in a cron job, but can also be run on interface specific events if need be.
It uses a web based IP fetcher to work out your IP adresse, and if it’s changed since you last run the script, it updates your DynDNS records for you.
Without further ado, here’s the code:
#/bin/bash
USERNAME='myusername'
PASSWORD='mypassword'
HOSTS=('first_url.test.com' 'second_url.test.com')
SERVER="www.ovh.com"
#
#
#
CURRENT_IP=`wget -O - 'http://checkip.dyndns.org/' 2>/dev/null | sed -e 's/.*Address: \([^<]*\).*/\1/'` if [ -f /tmp/my_ip ]; then OLD_IP=`cat /tmp/my_ip`; fi # # Don't update unless ip has changed # if [ "x"$CURRENT_IP == "x"$OLD_IP ]; then exit; fi; echo "IP changed from " $OLD_IP " to " $CURRENT_IP echo "Saving new IP" echo $CURRENT_IP > /tmp/my_ip
for HOST in ${HOSTS[@]};
do
echo "Updating " $HOST " to " $CURRENT_IP
wget -O - "http://${USERNAME}:${PASSWORD}@${SERVER}/nic/update?system=dyndns&hostname=${HOST}&myip=${CURRENT_IP}&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG" 2>/dev/null
echo ""
done
Et voila, I hope this helps someone out there