Now we must install something on our computer to tell dyndns about our dynamic ip address. It must run automatically each time when our IP address changes.
We are going to use ipcheck.py, an open-source tool written in Python. More on ipcheck.py project homepage.
- Create a directory which will serve for ipcheck's data files.
md /mnt/snapshots/ipcheck cd /mnt/snapshots/ipcheck
- Download the script.
wget http://ipcheck.sourceforge.net/ipcheck.py
- run the script a first time with the --makedat option.
python ipcheck.py --makedat username password hostnames ppp0: error fetching interface information: Device not found ipcheck.py: No address found on interface ppp0 use -i
... oops, we must specify some device correctly...
python ipcheck.py --makedat -i eth0 username password hostname ipcheck.py: ip1 looking up lsaffre.dyndns.org ipcheck.py: result: 'lsaffre.dyndns.org'[]['213.219.89.238'] ipcheck.py: lsaffre.dyndns.org good 192.168.2.110 -update successful
Now if we point a browser to lsaffre.dyndns.org we should get an answer.
... oops, we don't.
What went wrong? ipcheck.py told dyndns.org to use 192.168.2.110 as address for lsaffre.dyndns.org. This is asterix's local ip address. This is of course wrong.
python ipcheck.py --makedat -r checkip.dyndns.org username password hostname ipcheck.py: ip1 looking up lsaffre.dyndns.org ipcheck.py: result: 'lsaffre.dyndns.org'[]'213.219.89.238'] ipcheck.py: lsaffre.dyndns.org good 213.219.91.17 -update successful
- Now it works: we point a browser to lsaffre.dyndns.org
python ipcheck.py -v -l -r checkip.dyndns.org username password hostname ipcheck/0.215 ipcheck.py: Fri Jul 30 19:27:05 2004 ipcheck.py: opt_router set to checkip.dyndns.org ipcheck.py: opt_username = lsaffre ipcheck.py: opt_password = ******** ipcheck.py: opt_hostnames = lsaffre.dyndns.org ipcheck.py: PWD = /home/luc/ipcheck ipcheck.py: web based ip detection for localip ipcheck.py: Trying URL http://checkip.dyndns.org ipcheck.py: webip.out file created ipcheck.py: webip detected = 213.219.91.17 ipcheck.py: Good, filehosts and hostnames are the same. ipcheck.py: Good, no ipcheck.err file. ipcheck.py: Good, no ipcheck.wait file. ipcheck.py: Checking hosts in file vs command line. ipcheck.py: The database matches local address. No hosts update.
Now we must create a cron job who will run every 5 minutes. See www.michianageeks.net/2004/cronjob.xhtml