#!/usr/bin/perl # From http://www.matthewohare.com/ use as a basis for your own script # Perl/Linux based Dynamic IP Updater for Sitelutions DNS # Change /usr/bin/perl to wherever perl is (try a "whereis perl") # Change "eth0" to whatever you use to connect to the net (eth1/ppp0 etc) # Change ifconfig to wherever it is kept on your machine # Enter your username, password and id for the domain(s - comma separated) # Make sure this is executed every time your IP changes - try a call # from ifup-post ...or you might want to run it as a cron job instead use warnings; use strict; use HTTP::Request::Common qw(POST); use LWP::UserAgent; my $ipaddress; my $interface="eth0"; my $ifconfig="/sbin/ifconfig"; my @lines=qx|$ifconfig $interface| or die("Can't get info from ifconfig: ".$!); foreach(@lines){ if(/inet addr:([\d.]+)/) { $ipaddress = $1; } } # Create and send the HTTPS request using POST # Remember to change the parameters to match YOUR domains/userid etc # - ttl can also be sent, if not (as here) it will stay the same my $ua = LWP::UserAgent->new(); my $req = POST 'https://www.sitelutions.com/dnsup', [ id => '999999x,999999y', user => 'your_email@address', pass => 'your_sitelutions_password', ip => $ipaddress ]; my $response = $ua->request($req); if ($response->is_error()) { printf "%s\n", $response->status_line; } else { my @contents = split(/\n/, $response->content()); foreach (@contents) { printf "ERROR: at least one update failed\n" if $_ !~ /success/i } printf "$interface IP address: $ipaddress sent to Sitelutions.com\n" }