|
WilDDNS : Documentation
Although WilDDNS already works perfectly, it's still highly BETA. So be aware that it could fail,
if you're planning to implement a WilDDNS solution in a production environment.
ATTENTION: Please remeber to replace "nzym.net/wilddns/" with your own wilddns installation path.
For this installation you're accessing now it should be something like:
Domain not set! WOHOO, this is an open access DNS master magic installation!
General call information
user = username (HTTP Basic Auth)
pass = password (HTTP Basic Auth)
host = hostname
addr = IP Address or * for automatic detection
Complete update URL for eg. the WGET way:
http://[user]:[pass]@nzym.net/wilddns/wilddns.php?host=[host]&addr=*
|
WGET/Shell script
The WGET way implemented as a shell script for Linux:
#!/bin/bash
URL=http://nzym.net/wilddns/wilddns.php
USER=[user]
PASS=[pass]
HOST=[host]
OUT=/var/log/wilddnsupd.out
ADDR=*
wget --quiet --output-document=$OUT --http-user=$USER --http-password=$PASS "$URL?host=$HOST&addr=$ADDR"
|
and as a BATCH script for Windows:
@echo off
SET URL=http://nzym.net/wilddns/wilddns.php
SET USER=[user]
SET PASS=[pass]
SET HOST=[host]
SET OUT=C:\wilddnsupd.out
SET ADDR=*
wget --quiet --output-document=%OUT% --http-user=%USER% --http-password=%PASS% "%URL%?host=%HOST%&addr=%ADDR%"
|
For windows you'll also need a wget binary. Download it here.
DD-WRT
The DD-WRTs "Custom DDNS Service" can also be used. Therefor you have to set the configuration fields as follows:
DDNS Service: Custom
DYNDNS Server: nzym.net
User Name: [user]
Password: [pass]
Host Name: [host]
URL: /wilddns/wilddns.php?addr=*&host=
That's all for now. Click on "Apply Settings" and your WilDDNS host name should now be updated.
More information on this can be found in the DD-WRT wiki.
Or add a cron job under Administration|Management|Cron as follows:
*/30 * * * * root /usr/bin/wget -O /var/log/wilddns.out \
wget --quiet --output-document=$OUT --http-user=[user] --http-password=[pass] \
"http://nzym.net/wilddns/wilddns.php?host=[host]&addr=*"
Perl script with IP update check
The following is a Perl script wich does perform a check on the interfaces ip address
and updates WilDDNS only if it has changed.
You need to set at least the server name [server], the host name [host], the user name [user]
and the password [pass]. The interface field [interface] can be left blank, but this disables
the ip address check.
You can download this script here.
#!/usr/bin/perl
my $server='[server]';
my $url='/wilddns/wilddns.php';
my $user='[user]';
my $pass='[pass]';
my $host='[host]';
my $addr='*';
my $if='[interface]';
my $lastipf='/var/log/wilddns.lastip';
my $out='/var/log/wilddns.out';
## no need to change anything below this line
## -----------------------------------------------------------------------------------------------------------
use strict;
use LWP::UserAgent;
use Data::Dumper;
## file handling subroutines
sub wprint { open (OUT,">$_[0]"); print OUT $_[1]; close (OUT); }
sub wread { open (IN,"<$_[0]"); my $in=<IN>; close (IN); return $in; }
## load last updated ip
my $lastip=wread($lastipf);
## get current ext ip
my @ips=(`ifconfig $if`=~/inet addr:(\S+)/g);
my $ip=@ips[0];
## check for ip change
if ($ip eq $lastip) {
#print "Still the same :)\n";
exit(0);
}
## prepare uri
my $uri="http://${user}:${pass}\@${server}${url}?addr=${addr}&host=${host}";
## access wilddns
my $ua=LWP::UserAgent->new();
my $re=$ua->request(HTTP::Request->new(GET=>$uri));
if ($re->is_success){
wprint($lastipf,$ip);
}
else { #'WWW-Authenticate' is the realm-name <- ??
die "Error: ",$re->header('WWW-Authenticate') || 'Error accessing',
"; ", $re->status_line, "\n at $url\n Aborting";
}
## output response to out file
#print Dumper($re);
wprint($out,$re->{_content});
exit(0);
|
Last updated: 2014-04-15 11:42:31
|