Skip to content

acejacek/dynamic-freeDNS42

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

dynamic-freeDNS42

Dynamic record update at FreeDNS::42, for EdgeOS.

This set of steps provide a functionality of dynamic update of your domain at FreeDNS::42. Tested on ERLite-3 running 1.10.x version of EdgeOS.

Installation

  1. Connect via ssh to your router.
  2. Dowload this Python script from https://freedns.42.pl:
curl https://freedns.42.pl/freedns-dyndns.py -o freedns-dyndns.py
  1. Modify default values hardcoded in script. Look at these lines:
params = \
{       "user"          : "yourUserID",
        "password"      : "******",
        "zone"          : "put.your.domain.here",
        "name"          : "@",
        "oldaddress"    : "*",
        "ttl"           : "600",
        "updatereverse" : "0",
}
  1. Elevate your access and save modified script in /config/scripts.
sudo su

cp freedns-dyndns.py /config/scripts/freedns-dyndns.py

All need to be in /config/scripts/ directory, otherwise scripts will not survive system upgrade in future.

  1. Copy script freedns-dyndns-cronjob.sh, to /config/scripts/. Make it executabe.
curl https://raw.githubusercontent.com/acejacek/dynamic-freeDNS42/master/freedns-dyndns-cronjob.sh -o /config/scripts/freedns-dyndns-cronjob.sh

chmod +x /config/scripts/freedns-dyndns-cronjob.sh

Theoretically, this step could be avoided, but it's bloody difficult to escape " characters in router configuration. It's just easier to create such a shell script.

  1. Add task scheduler job in router configuration:
configure
set system task-scheduler task update-freedns executable path /config/scripts/freedns-dyndns-cronjob.sh
set system task-scheduler task update-freedns interval 1h
commit
save

Test

Check the /var/log/messages for any sign of logged activity:

grep FreeDNS /var/log/messages

There should be entry similar to this:

Oct 13 17:34:14 edge FreeDNS::42: result: {'serial': '2005106563', 'ttl': 600, 'name': '@', 'zone': 'your.domain.here', 'addresses': ['123.123.123.123']}

Tune up

Limit the log data. Every scheduler action will record its event in log file, which I find verbose. Modify /config/scripts/freedns-dyndns-cronjob.sh script in following way:

python /config/scripts/freedns-dyndns.py --newaddress "<dynamic>" 2>&1 >/dev/null | logger -t "FreeDNS::42"

This will direct only error messages to logger. Next step, edit /config/scripts/freedns-dyndns.py. Change one line only:

print e

to

print >> sys.stderr, e

Job done, from now on in /var/log/messages only errors will be logged.

About

Dynamic record update at FreeDNS::42, for EdgeOS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages