ChangeIP.com Forums

A User-to-User Dynamic DNS Forum
* Grand Reopening! *
Grand Reopening!
It is currently 07 Oct 2008 04:04

All times are UTC - 8 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: DNS Client For Linux
PostPosted: 10 Apr 2006 21:05 
Junior Member

Joined: 18 May 2005 16:47
Posts: 6
Has anyone tried to setup a solution to update the DNS from a linux client?
I have viewed the whitepaper regarding this topic and get the idea of how it could be done but I'd rather not re-invent the wheel.
...Robert


Top
 Profile  
 
 Post subject: DNS Client For Linux
PostPosted: 30 Jun 2006 07:52 
Junior Member

Joined: 30 Jun 2006 07:47
Posts: 1
You can do this with a quick shell script:
Code:
#!/bin/sh
wget -q --http-user=YOUR_USERNAME \\
--http-passwd=YOUR_PASS \\
'https://www.changeip.com/update.asp?u=YOUR_USERNAME&cmd=update&set=1&offline=0'


Put this in cron to run every hour or so.


Top
 Profile  
 
 Post subject:
PostPosted: 12 Aug 2006 12:51 
Junior Member

Joined: 20 Oct 2005 18:16
Posts: 15
Though it's not as easy, you should try to only send updates if something has changed. If you get http://ip.changeip.com and compare it to the previous version and only update when it changes you won't be sending as many updates. I know some DDNS servers will block you if you send invalid updates too often.

-Dan


Top
 Profile  
 
 Post subject: My Solution To DNS Update, Rock Solid and Very Happy!
PostPosted: 04 Feb 2007 04:52 
Junior Member

Joined: 18 May 2005 16:47
Posts: 6
Here is my solution by modifications to Tristan Nixon's original script.
This script compares the dns record with the router IP (in my case Netcomm NB9W) and if they differ enforces the update.
I also have a different version for Netcomm NB5W which requires a POST mechanism for router/modem login instead.

... Robert :-)

#!/usr/bin/perl -Tw

# updatedns - ChangeIP.com Auto Client Script
# by Tristan Nixon ( corvi42@silencegreys.com )
# based very loosely upon the script by: Bob Lee (crazyboblee@hotmail.com)
# License: http://www.gnu.org/copyleft/gpl.html
#
# I have tried to make this program responsible in
# such a way that it will be optimal for both running as a cron
# task to update the dns should your ip change, and as part of a
# network init script
# it will also update your /etc/hosts file so that your hostname
# is set correctly for local resolution
# ( ie it adds an entry with the ppp ip when you go online, and modifies this to a local address when offline )
# sometimes apache or other daemons
# complain if you're locally using a hostname that doesn't properly resolve,
# this should solve this problem
#
# usage: updatedns <offline>
#
# if the command is run without arguments, it will
# check if it is neccessary to update the dns
# ( ie if the ppp interface has a different ip from the dns record )
# and then do so this is how it should be run if you want to set
# or update a dns record when your machine goes online or when your ip changes
#
# if it is run with an argument: 'updatedns offline'
# ( or any argument that resolves to true in perl: 'updatedns 1' or 'updatedns foobar' etc. )
# then it will set the dns record to point to $public_offlineip
#
# all of this is logged to /var/log/updatedns.log
#
# you must edit the variables below to get this thing working for you
# important variables:
# $uid - your changeip.com userid
# $pwd - your changeip.com password
# $hostname - the hostname to which you want your computer to be bound
# $offlineip - the ip for your hostname so you can get to your own machine when you're offline
# $public_offlineip - the ip others should go to when you're offline
# $iface - your dynamic / dialup interface, this should be fine as it is for most people
# $hostsfile - location of your local hosts file, this should be fine for most people
# $logfile - the location of the logfile, this should be fine for most people
# $dnsserver - the server & port to go to to update - I don't see why you'd want to change this

## ##
## START MAIN PROGRAM ##
## ##

# make the environment safe
clean_env();
$ENV{PATH} = '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin';

# variables
my $offline = $ARGV[0] ? 1 : 0;
my $uid = 'myuid'; # set this to your changeip.com userid
my $pwd = 'mypwd'; # set this to your changeip.com password
my $hostname = 'myhostname'; # set this to your hostname
my $offlineip = '127.0.0.1'; # set this to your own local interface
my $public_offlineip = $offlineip; # set this to the ip other should go to when you're offline
my $iface = 'ppp0';
my $hostsfile = '/etc/hosts';
my $logfile = '/var/log/updatedns.log';
my $dnsserver = 'www.changeip.com:443';
my $pppip = get_router_ip();
my $dns_entry = get_dns();
print \"ip: $pppip\\n\";
print \"dns: $dns_entry\\n\";
my $ruid = 'myrouteradmin:myrouterpwd';
my $rurl = 'http://192.168.1.1/wancfg.cmd?action=view';

print \"checking match\\n\";

# if we already match the dns record, exit now
#( ! $offline && $pppip eq $dns_entry ) and exit( 0 );
( $pppip eq $dns_entry ) and exit( 0 );

print \"updating records\\n\";

# update the dns
update_dnsset1();

## ##
## END MAIN PROGRAM ##
## ##

# subroutines

sub clean_env
{
foreach my $key ( %ENV ){
$ENV{$key} = untaint( $ENV{$key} );
}
}

sub untaint{

my $stringToClean = $_[0];
( ! defined( $stringToClean ) || $stringToClean eq '' ) and return '';

# remove invalid characters
$stringToClean =~ s/[;&\"`\\$\\\\<>\\|]//g;


Top
 Profile  
 
 Post subject: Linux Client Status Update
PostPosted: 15 Mar 2007 09:45 
Junior Member

Joined: 18 May 2005 16:47
Posts: 6
I have been using my update linux clients for both NB9 and NB5W routers now for quite some time and the mechanism is absolutely bullet proof. This is more than I can say for Homing Beacon.

...Robert :-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2008 phpBB Group

We use phpbb-seo to help us!