About dyupd2.py
dypupd2.py is a dynamic DNS clients for Linux written in
Python (version 2). It supports multiple
hostnames, dynamic DNS
services, and network interfaces. Only IPv4 is supported and I have no
plans yet to add IPv6 support because I do not have a public IPv6
address myself.
If your computer is connected to a box that does
NAT, it
will not be able to determine your public IP address and, thus, will
not work correctly. Try switching to a bridge mode instead if
possible.
dyupd2.py is a complete rewrite of the original dyupd.py. It adds
HTTPS for encrypted updates and it just is better. It also does not
use the Linux ifconfig
command to get your IP address like the
original but queries the operating system directly in a way that may
or may not work with operating systems other than Linux (I haven't
tested it. Hmm, maybe I should try it with FreeBSD some day.)
Services
I have been using this for years with the Finnish
dy.fi and I used to use it also with the
Dyn. It has always just worked with both services
(except once when dy.fi let their SSL sertificate expire) There are
(or at least used to be) other services that use the same protocol and
should also work with dyupd2.py.
License
Both dyupd.py and dyupd2.py are released under the
GNU General Public License, version 2
and - as Python scripts - naturally come with source code.
Documentation
After setting up an account with your favorite service you have to
create a little configuration file. The content should be something
like this:
interface = eth0
username = your_user_name
password = your_password
url = http://www.dy.fi/nic/update?hostname=...
status = /etc/dyupd2/status
refresh = 30
The values are:
interface
The name of the network interface that has your
public IP address
username
and password
The credentials for your account
url
The update URL for your service
(e.g. http://www.dy.fi/nic/update?hostname=...
if you use dy.fi)
status
A path to a status file that dyupd will create and
update when it runs
refresh
The number of days between forced update even if IP has
not changed
Note: The correct value for refresh
depends on the
service. Setting it too low may cause your account to be blocked, and
too high may let your hostname to expire in between.
After creating a configuration you can try to run the script once with
command python2 dyupd2.py {dyupd2.conf}
. It should do an update
because the status file did not exist and it should create it.
Afterwards the status file should contain something like this:
ip=111.222.333.444
lastupdate=1460633027
time=1460633027
While you should not make any changes to the file (clear or delete it
to force an update), you can read the following information from it:
ip
The current IP address (the example is invalid ;-)
lastupdate
UNIX timestamp when the hostname(s) was last updated
time
UNIX timestamp when the script was last run
You can use a command like date --date='@1460633027
to convert the
timestamps to a human readable format.
Now you can create a cron job or a systemd timer to run the script
every now and then. You have to a configurations for each service you
use and run the script separately for each. (Hmm, maybe I should allow
multiple configuration on the command line if it is not yet
supported...)
Note: If there are multiple users on your system, place at least the
configuration file in a place and with such permissions that the other
users cannot read the plain text password! (Obviously the script
should not be writable by anyone else, either.)
Configuration for dyupd.py
I do not know if the old script still works and I suggest you use the
newer one instead. However, it uses a diffent configuration file:
server = members.dyndns.org
username = test
password = test
hostname = test.dyndns.org
forcedupdate = 6
status = test.dyndns.org.status
interface = eth0
The script needs the ifconfig
command to be in your path. Some
distros do not add such commands to the path of ordinary users and you
might have to add /sbin/
and/or /usr/sbin
yourself.
Protocol
The dynamic DNS protocol is documented in at least these two
locations: