ipcheck.py homepage

[Source Forge] [dyndns]

   
Download the latest release View the changelog
   
Mailing List Low volume list for announcements about major releases.
   
Older Releases Older releases directory.
   

We currently support all options and recommendations as of January 1, 2002.

SSL support

If you are using Python2, https will fail. Dyndns recently upgraded to apache2 ssl from apache with mod_ssl. Python ssl library always fails with an EOF error. New versions of ipcheck.py will detect what version of python you are running and work around the problem by disabling https. Otherwise, https will be enabled by default.

Custom Domains

We support updating your MyDynDns custom domains with the -c option. Note that you need to keep separate data files if you want to update both your custom domains and your dyndns domains. Example:
python ipcheck.py -c -l -d /etc/mydyndns uname pword foo.com
python ipcheck.py -l -d /etc/dyndns uname pword foo.dyndns.org,bar.dyndns.org

Introduction

This is a simple Python script to register your dynamic IP address using the NIC V2.0 protocol. We aim to be fully compliant with the dyndns client specification. A big thank you to everyone that has contributed to this script or sent along a note of encouragement. I try to keep organized with who sent in what but if I've missed something in the acknowledgements section of the script, please let me know.

The script is very easy to use and supports multiple methods for determining the external IP (parsing interfaces on the local machine, web based IP detection, direct support for devices from Linksys, Netgear, Draytek, Netopia, HawkingTech, Watchgard, Cayman, Nexland, ZyXEL, SMC, Compex, UgatePlus, DLink and Cisco).

Run the script with no command line arguments for quick start instructions.

Documentation

Make sure you can write to the current directory for data
files and that you always run from the same directory.
The first time you run the script, you will be asked to run
with the --makedat option.  This will create the data files
and complete the update.  You should only do this once.
Subsequent runs should be made without the --makedat option.

For help with different options: python ipcheck.py -h
For supported devices listing  : python ipcheck.py --devices
For long detailed help text    : python ipcheck.py --help

In the following examples, ... = username password hostnames
where hostnames is a comma separated list of hosts you wish
to be updated.  The -l option creates an ipcheck.log file.

Example 1: the external IP is on eth0 of the current machine
python ipcheck.py -l -i eth0 ...

Example 2: you are using the Linksys routing device
python ipcheck.py -l -L linksyspassword ...

Example 3: you want to use web based ip detection
python ipcheck.py -l -r checkip.dyndns.org:8245 ...

Usage  : ipcheck.py [options] Username Password Hostnames
or       ipcheck.py [options] --acctfile acct_info_file 

Options:  -a address     manually specify the address 
          -b             backup mx option ON (default OFF) 
          -c             custom dns option (default dynamic) 
          -d dir         directory for data files (default current)
          -e script      execute script after a successful update 
          -f             force update regardless of current state 
          -g             NAT router, let dyndns guess your IP 
                         (do not use this in a cronjob, try -r) 
          -h             print this help text 
          --help         print all available help text 
          -i interface   interface for local address (default ppp0) 
          -l             log debugging text to ipcheck.log file 
          --syslog       log debugging text to syslog (Unix only) 
          -m mxhost      mx host to send if -b (default none) 
          -o             set dyndns offline mode 
          -p             proxy bypass on port 8245 
          -q             quiet mode (unless there is an error) 
          -r URL         NAT router, use web IP detection 
          -s             static dns option (default dynamic) 
          -t             test run, do not send the update 
          -v             verbose mode 
          -w             wildcard mode ON (default OFF) 
          --makedat      create the ipcheck.dat file by dns lookup
          --devices      print router options (Linksys, Netgear, etc)

For help with different options: python ipcheck.py -h
For supported devices listing  : python ipcheck.py --devices
For long detailed help text    : python ipcheck.py --help


The script will locate the address of your router automatically by 
looking at the default route of the machine you are running on. 
Then it will read the status page for the external IP address 
and use that for updates.  You need to specify the admin password 
with the appropriate option. 

          -L password    Linksys (BEFSR41) NAT router password 
          -N password    Netgear (RT311) NAT router password 
          -D password    Draytek (Vigor2000) NAT router password 
          -O password    Netopia (R9100) NAT router password 
          -H password    HawkingTech router password 
          -W password    Watchguard SOHO NAT firewall password 
          -Y password    Cayman DSL 3220H NAT router password 

You can change the default username for the above devices with: 

          -U username    override default NAT router username 
                         leave this option out to use the default 

Devices that do not need a username: 

          -X             Nexland router (no password set) 
          -Z password    ZyXEL prestige router password 
          -S             SMC Barricade (no password needed) 
          -M password    Compex NetPassage 15 
          -G             UgatePlus (no password needed) 
          -7 password    DLink DI701 password 

Cisco devices: 

          -C password    Cisco (667i) DSL router password 
          -I password    Cisco (700 series) ISDN router password 

For Cisco IOS devices and any others that understand SNMP, you 
can also use --snmp to detect the external IP. 

          --snmp snmp_agent,community,numeric_objectid 

You will need the pysnmp module from http://pysnmp.sourceforge.net/ 
You also need to know the agent, community and numeric objectid: 
python ipcheck.py --snmp 172.62.254.254,public,.1.3.5.2.1.2.10.2.5.4 ...
where ... = username password hostnames 


Start ipcheck.py with no arguments to get some quick examples.

The script creates data files in the current working directory.
Make sure you have write permission and that you run the script
from the same directory each time.  You can use the -d option
to specify an alternate directory for data files. 

The first time you run the script, you will be asked to run
with the --makedat option.  This will create the data files
and complete the update.  You should only do this once.
Subsequent runs should be made without the --makedat option.

If -f is set, all hosts will be updated regardless of the 
current error, wait or IP state.  You should never need this. 

You can place your username password and hostnames in a file 
(all on the first line) and use the --acctfile option if you do 
not wish your password to show up on a ps. 

The best way to run ipcheck is in the /etc/ppp/ip-up.local file 
or the BSD ppp.linkup file (you will need to sleep 30 before 
running the script since ppp.linkup runs before the link is up.) 
The script will also run from a cronjob.  Just make sure the 
hostnames are the same in each execution.  You should make sure
it is using the same directory each time for data files.  The -d 
option can be used to specify where data files go.

The file ipcheck.dat contains the IP address and hostnames 
used in the last update.  If the ipcheck.dat file is older 
than 25 days, an update will be made to touch 
the hostnames. 

The file ipcheck.wait is created if dyndns requests a wait 
before retrying.  This file will be automatically removed when 
the wait is no longer in effect. 

The file ipcheck.err is created if the response is an error. 
It will not try to update again until this error is resolved. 
You must remove the file yourself once the problem is fixed. 

If your ISP has a badly behaved transparent proxy on port 80 
traffic, you can try the -p option to use port 8245. 

If a http message is sent to dyndns.org, the response will be 
saved in the ipcheck.html file.

Custom domains can be specified with the -c option.  You must 
first complete the create database step on the Dyndns web page. 
Suppose you have the domain ipcheck.org defined as an A record 
and your nodes aliased to ipcheck.org with CNAME records.  Use: 
python ipcheck.py -c username password ipcheck.org 

Note that if you intended to maintain both a custom domain and 
a dyndns domain (ie. ipcheck.dyndns.org) you should be using 
the -d option to keep the data files in separate directories. 
The custom domains are not compatible with the offline, mx, 
backmx and wildcard options.  Setup your database accordingly. 

The script can find your public IP address in one of several ways:

1) interface IP detection is the default method and appropriate
if the machine you are running on has an interface with the public
IP addressed assigned.  The script knows how to query various 
operating systems for the address of an interface specified 
with the -i option (default ppp0).  Note on Win32 systems 
specify the MAC address device after -i and on BeOS systems 
specify the interface number after -i (eg. -i 1). 

2) router IP detection is used if you have a routing device
such as a Netgear RT311.  Use the --devices option to get a
help on specific devices.  This method is used by the script
if you specify one of the device-related options.

3) web IP detection may be used if your device is not supported
python ipcheck.py -r checkip.dyndns.org:8245 ... 
where ... = username password hostnames 
This method is used if you specify the -r option.
IMPORTANT: Do not run web based IP detection more often 
than once every 15 minutes.  It is costing dyndns bandwidth. 

4) you can explicitly set the desired IP address with -a

5) when -g is used, the script will not send any IP address
at all (even ones detected by the previous options).  Only
the account information will be sent to the dyndns server.
The dyndns server will assign the hostnames to the source
IP address of the request.  The assigned address is saved in
the ipcheck.dat file.  IMPORTANT: Do not run this from a cronjob
unless you know the address saved in the ipcheck.dat file 
matches locally detected public IP to prevent unnecessary updates.

If your have an unsupported device and are willing to help with
some testing, email me. 

The ipcheck homepage can be found at:
http://ipcheck.sourceforge.net/

Client development information can be found at:
http://support.dyndns.org/dyndns/clients/devel/

Please include the ipcheck.log file if you email me with a problem. 
kal@users.sourceforge.net


kal@users.sourceforge.net
ipcheck.py

ipcheck.py homepage

[Source Forge] [dyndns]

   
Download the latest release View the changelog
   
Mailing List Low volume list for announcements about major releases.
   
Older Releases Older releases directory.
   

Introduction

This is a simple Python script to register your dynamic IP address using the NIC V2.0 protocol. We aim to be fully compliant with the dyndns client specification. A big thank you to everyone that has contributed to this script or sent along a note of encouragement. I try to keep organized with who sent in what but if I've missed something in the acknowledgements section of the script, please let me know.

We currently support all options and recommendations as of June 12, 2001, including myDynDNS custom domains. The script is very easy to use and supports multiple methods for determining the external IP (parsing interfaces on the local machine, web based IP detection, direct support for devices from Linksys, Netgear, Draytek, Netopia, HawkingTech, Watchgard, Cayman, Nexland, ZyXEL, SMC, Compex, UgatePlus, DLink and Cisco).

Run the script with no command line arguments for quick start instructions.

Documentation


Make sure you can write to the current directory for data
files and that you always run from the same directory.
The first time you run the script, you will be asked to run
with the --makedat option in addition to any other options.
This will create the data files for the hostnames and options 
your specify on the command line.  You should only do this once.
Subsequent runs should be made without the --makedat option.

For help with different options: python ipcheck.py -h
For supported devices listing  : python ipcheck.py --devices
For long detailed help text    : python ipcheck.py --help

Example 1: the external IP is on eth0 of the current machine
python ipcheck.py -l -i eth0 username password hostnames

Example 2: you are using the Linksys routing device
python ipcheck.py -l -L linksyspassword username password hostnames

Example 3: you want to use web based ip detection
python ipcheck.py -l -r checkip.dyndns.org:8245 ...

where ... is your dyndns username password and hostnames.
Hostnames should be comma delimited if there are more than one.

Usage  : ipcheck.py [options] Username Password Hostnames
or       ipcheck.py [options] --acctfile acct_info_file 

Options: -a address     manually specify the address 
         -r URL         NAT router, use web IP detection 
         -A text        scan syslog for an IP after text (Unix only) 
         -F filename    guess the WAN IP from a firewall log 
         -b             backup mx option ON (default OFF) 
         -c             custom dns option (default dynamic) 
         -d dir         directory for data files (default current)
         -e script      execute script after a successful update 
         -f             force update regardless of current state 
         -g             NAT router, let dyndns guess your IP 
                        (do not use this in a cronjob, try -r) 
         -h             print this help text 
         --help         print all available help text 
         -i interface   interface for local address (default ppp0) 
         -l             log debugging text to ipcheck.log file 
         --syslog       log debugging text to syslog (Unix only) 
         -m mxhost      mx host (default NOCHG) 
         -o             set dyndns offline mode 
         -p             proxy bypass on port 8245 
         -q             quiet mode (unless there is an error) 
         -s             static dns option (default dynamic) 
         -t             test run, do not send the update 
         -v             verbose mode 
         -w             wildcard mode ON (default OFF) 
         --makedat      create the ipcheck.dat file by dns lookup
         --devices      print router options (Linksys, Netgear, etc)

For help with different options: python ipcheck.py -h
For supported devices listing  : python ipcheck.py --devices
For long detailed help text    : python ipcheck.py --help


The script will locate the address of your router automatically by 
looking at the default route of the machine you are running on. 
Then it will read the status page for the external IP address 
and use that for updates.  You need to specify the admin password 
with the appropriate option. 

         -L password    Linksys (BEFSR41) NAT router password 
         -N password    Netgear (RT311) NAT router password 
         -D password    Draytek (Vigor2000) NAT router password 
         -O password    Netopia (R9100) NAT router password 
         -H password    HawkingTech router password 
         -W password    Watchguard SOHO NAT firewall password 
         -Y password    Cayman DSL 3220H NAT router password 
         -P password    MacSense password 
         -Q pword,iface password and interface for Instant Internet 
         -V password    Eicon Diva (see -E for no password) 
                        (untested)
         -B password    New Barricade with password on port 88

You can change the default username for the above devices with: 

         -U username    override default NAT router username 
                         leave this option out to use the default 

Devices that do not need a username: 

         -P port       Nexland Pro800Turbo, WAN port, port==any
                           use the first connected port; port=[01]
                           use the port'th port if available, else any;
                           port=-[01] use port'th port if available,
                           else fail.
         -X             Nexland router (no password set) 
         -Z password    ZyXEL prestige 642R router password 
         -J password    ZyXEL prestige 642ME router password 
         -S             SMC Barricade (no password needed) 
         -M password    Compex NetPassage 15 
         -G             UgatePlus (no password needed) 
         -7 password    DLink DI701 password 
         -E             Eicon Diva (no password needed) 

Cisco devices: 

         -C password    Cisco (667i) DSL router password 
         -I password    Cisco (700 series) ISDN router password 

For Cisco IOS devices and any others that understand SNMP, you 
can also use --snmp to detect the external IP. 

         --snmp snmp_agent,community,numeric_objectid 

You will need the pysnmp module from http://pysnmp.sourceforge.net/ 
You also need to know the agent, community and numeric objectid: 
python ipcheck.py --snmp 172.62.254.254,public,.1.3.5.2.1.2.10.2.5.4 ...
where ... = username password hostnames 


Start ipcheck.py with no arguments to get some quick examples.

The script creates data files in the current working directory.
Make sure you have write permission and that you run the script
from the same directory each time.  You can use the -d option
to specify an alternate directory for data files. 

The first time you run the script, you will be asked to run
with the --makedat option.  This will create the data files
and complete the update.  You should only do this once.
Subsequent runs should be made without the --makedat option.

If -f is set, all hosts will be updated regardless of the 
current error, wait or IP state.  You should never need this. 

You can place your username password and hostnames in a file 
(all on the first line) and use the --acctfile option if you do 
not wish your password to show up on a ps. 

The best way to run ipcheck is in the /etc/ppp/ip-up.local file 
or the BSD ppp.linkup file (you will need to sleep 30 before 
running the script since ppp.linkup runs before the link is up.) 
The script will also run from a cronjob.  Just make sure the 
hostnames are the same in each execution.  You should make sure
it is using the same directory each time for data files.  The -d 
option can be used to specify where data files go.

The file ipcheck.dat contains the IP address and hostnames 
used in the last update.  If the ipcheck.dat file is older 
than 25 days, an update will be made to touch 
the hostnames. 

The file ipcheck.wait is created if dyndns requests a wait 
before retrying.  This file will be automatically removed when 
the wait is no longer in effect. 

The file ipcheck.err is created if the response is an error. 
It will not try to update again until this error is resolved. 
You must remove the file yourself once the problem is fixed. 

If your ISP has a badly behaved transparent proxy on port 80 
traffic, you can try the -p option to use port 8245. 

If a http message is sent to dyndns.org, the response will be 
saved in the ipcheck.html file.

Custom domains can be specified with the -c option.  You must 
first complete the create database step on the Dyndns web page. 
Suppose you have the domain ipcheck.org defined as an A record 
and your nodes aliased to ipcheck.org with CNAME records.  Use: 
python ipcheck.py -c username password ipcheck.org 

Note that if you intended to maintain both a custom domain and 
a dyndns domain (ie. ipcheck.dyndns.org) you should be using 
the -d option to keep the data files in separate directories. 
The custom domains are not compatible with the offline, mx, 
backmx and wildcard options.  Setup your database accordingly. 

The script can find your public IP address in one of several ways:

1) interface IP detection is the default method and appropriate
if the machine you are running on has an interface with the public
IP addressed assigned.  The script knows how to query various 
operating systems for the address of an interface specified 
with the -i option (default ppp0).  Note on Win32 systems 
specify the MAC address device after -i and on BeOS systems 
specify the interface number after -i (eg. -i 1). 

2) router IP detection is used if you have a routing device
such as a Netgear RT311.  Use the --devices option to get a
help on specific devices.  This method is used by the script
if you specify one of the device-related options.

3) web IP detection may be used if your device is not supported
python ipcheck.py -r checkip.dyndns.org:8245 ... 
where ... = username password hostnames 
This method is used if you specify the -r option.
IMPORTANT: Do not run web based IP detection more often 
than once every 15 minutes.  It is costing dyndns bandwidth. 

4) you can explicitly set the desired IP address with -a

5) when -g is used, the script will not send any IP address
at all (even ones detected by the previous options).  Only
the account information will be sent to the dyndns server.
The dyndns server will assign the hostnames to the source
IP address of the request.  The assigned address is saved in
the ipcheck.dat file.  IMPORTANT: Do not run this from a cronjob
unless you know the address saved in the ipcheck.dat file 
matches locally detected public IP to prevent unnecessary updates.

If your have an unsupported device and are willing to help with
some testing, email me. 

The ipcheck homepage can be found at:
http://ipcheck.sourceforge.net/

Client development information can be found at:
http://support.dyndns.org/dyndns/clients/devel/

Please include the ipcheck.log file if you email me with a problem. 
kal@users.sourceforge.net


kal@users.sourceforge.net