Topic: IP changes and DNS

So I have comcast cable internet at home. I have few domains that point to my box at home. The problem is that every 2-3 comcast spits me a new IP and I have to the domain site where I got my domains and change the ip its pointing to, to the new one. Any way to automate this or avoid this?

I usually only notice the change when I am not at home, and I try to visit my site and its down sad

Last edited by scuzzo (2006-08-16 18:02:32)

For example, Linux had at least two completely independent USB stacks before Linus Torvalds rejected them both and wrote a third one from scratch, after he found both existent Linux  stacks unsatisfactory.  (When pressed for an explanation as to why he selected the API he did, Torvalds stated: "because I wanted to."

Re: IP changes and DNS

dyndns.org or zoneedit.com.

Re: IP changes and DNS

If you have "real" domain names and knows a little danish, http://www.gratisdns.dk is a free and a damn good service. Many existing clients can dynamically update the pointer there when local change occurred.

Here's the script I'm using myself. I'm always happy to recieve contructive criticism, so don't hold back..

#!/bin/sh
# $Id: ddns_updater.sh 650 2006-02-13 21:36:06Z ibs $
# 
# Update ip address on gratisdns.dk from crontab. It only returns output if 
# changed.
# 
# Requirements: 
#       - crontab entry, ie: "*/2 * * * * /usr/local/sbin/ddns_updater.sh"
#       - curl, because you got it already (otherwise it a small edit to change client)
#
ext_if="fxp0"   
user="username"  
password="passwd"
dns_file="/var/run/gratisdns.ip"
update_list="one.com another.org"

EXIT_SUCCESS=0             
EXIT_FAILURE=1

if [ `id -u` -ne 0 ]
then
        echo "Only root may run this program."
        exit $EXIT_FAILURE
fi

usage(){
        echo "Usage: $0"
}

get_ip(){
        if [ -f $dns_file ]
        then
                registered_ip=`cat ${dns_file}`
        else
                registered_ip=""
        fi
        current_ip=`ifconfig ${ext_if} | awk '/inet / { print $2 }'`
}

update_hosts(){
        if [ "$registered_ip" != "$current_ip" ]
        then
                echo -n "Local ip address changed, updating dns entries.. "

                for hostname in $update_list
                do
                     curl "https://ssl.gratisdns.dk/ddns.phtml?u=$user&p=$password&h=$hostname&d=$hostname" >/dev/null 2>&1
                done
                echo "done."

                echo -n "Registering new ip.. "
                        echo $current_ip > $dns_file
                echo "done."
        fi
}

#
# Main 
#
get_ip
update_hosts

exit $EXIT_SUCCESS

Last edited by ibs (2006-08-17 00:07:53)

Re: IP changes and DNS

zoneedit has a neat trick in its documentation on the site.  there's a single command you can run to update your site's IP on their DNS servers.  it's just lynx with some flags.  let's see what it is...

lynx -source -auth=username:password 'http://dynamic.zoneedit.com/auth
/dynamic.html?host=thehomerow.net'

pretty neat, eh?  I have that set to run once an hour in my crontab smile.

Re: IP changes and DNS

asemisldkfj wrote:
lynx -source -auth=username:password 'http://dynamic.zoneedit.com/auth
/dynamic.html?host=thehomerow.net'

pretty neat, eh?  I have that set to run once an hour in my crontab smile.

Nice, exactly like in my script above. The difference is that I don't want to push too much traffic to the dns hosting site so I only execute the update command if my ip address has changed. That makes is possible to run the command a lot more frequent in my crontab. Who can wait an hour? wink

Re: IP changes and DNS

hmmm, I should try something like that!

Re: IP changes and DNS

There's also ddclient.

ddclient.sf.net wrote:

Ddclient is a Perl client used to update dynamic DNS entries for accounts on Dynamic DNS Network Services' free DNS service. It was origanally written by Paul Burry and is now maintaned by developers for ddclient on sourceforge. It has the capability to update more than only dyndns and it can fetch your WAN-ipaddress on a few different ways. Check the configuration pages to find how to do this.

Last edited by terror (2006-10-25 00:16:38)

"I am not discouraged, because every wrong attempt discarded is another step forward."  --  Thomas Edison

Re: IP changes and DNS

I use ddclient for my DynDNS.org account

"UBER" means I don't drink the coffee... I chew the beans instead
             -- Copyright BSDnexus