Source code from
linode-dyndns.py is distributed in public domain.
Feel free to use and modify as needed. Please, share you modifications,
it can be useful to others.
Latest version can be found at official mercurial repositories:
hg clone http://src.ultrav.com.br/linode-dyndns/
This script uses linode-python module and needs a Linode API key. You can create your API key in profile at Linode panel. You also need IDs from objects you want to change. The following code lists all domains and entries registered in your Linode account:
1 2 3 4 5 6
from linode import api linode = api.Api('YOURAPIKEY') for domain in linode.domain_list(): print domain['DOMAINID'], domain['DOMAIN'] for record in linode.domain_resource_list(domainid=domain['DOMAINID']): print record['TYPE'], record['NAME'], record['TARGET']
You also needs an URI from a web service that prints your IP in plain text. By default script uses a web service hosted on my servers, you can change it to another or host your own with following PHP script:
<?php printf("%s", $_SERVER['REMOTE_ADDR']); ?>
Create an AAAA entry in your domain. Use list script above to show IDs from your resources. Edit variables in begining of script and run it:
1 2 3
vinicius@ultrav:/usr/local/bin$ ./linode-dyndns.py 2013-07-07 22:48:23 INFO: Registered IP address is 22.214.171.124, setting to 126.96.36.199 2013-07-07 22:48:25 INFO: IP address successfully updated!
Copy script to
/usr/local/bin/ and create a crontab entry to run it every
0 */6 * * * /usr/local/bin/linode-dyndns.py &2>> /tmp/linode-dyndns.log