Ahh yes, that paramount goal of every geek. Their very own T1 with a static IP. Nirvana, really.
Until then I still have to put up with a cable modem. So as promised here is my Perl code that updates ZoneEdit with my current IP.
May not be the most elegant solution, but its totally free and does what I need it to. The base code was originally done by Erik Aronesty of ZoneEdit, then I modified it to work with the external page idea brought up by Wildheart.Code:#!/usr/bin/perl use LWP::UserAgent; use LWP::Simple; #### README: change these to match the zones you want $zones = ''; #comma delimited list of zones $pass = ''; $login = ''; #### README: (optional) change these to a directory where you want them to be... ie: /var/log or c:/temp $logfile = 'ze-ip.log'; $ipfile = 'ze-ip.txt'; mark("START",100,"Starting dynamic IP program"); #read the previous ip address open S, "$ipfile"; $prev_ip = ; close S; #Setup a file on a public html server that returns your external IP #In this case I just used an Apache SSI: REMOTE_ADDR $ip = get("http://"); mark("READ",100,"Determined ip to be: ".$ip); if (!($ip eq $prev_ip)) { #report the current ip address to zoneedit.com $ua = new LWP::UserAgent; $ua->credentials('dynamic.zoneedit.com:80', 'ZoneEdit Access', $login, $pass); $request = new HTTP::Request('GET', "http://dynamic.zoneedit.com/auth/dynamic.html?zones=$zones"); $response = $ua->request($request); if ($response->is_success) { #record successful update of the ip address open S, ">$ipfile"; print S $ip; close S; } else { mark("ERROR", $response->code, $response->message); } } else { mark("NOCHNG",100,"No change was detected in the external ip."); } sub mark { my ($type, $code, $message) = @_; open E, ">>$logfile"; print localtime()."\t$type\t".$code."\t".$message."\n"; print E localtime()."\t$type\t".$code."\t".$message."\n"; close E; }
Let me know if you have any questions about this.


Reply With Quote
I just moved to an area that is considered rural, which means I am stuck with 512kbps ADSL.

Bookmarks