In order to keep the no-ip.com hostname up-to-date with the dynamic IP address a client can be used. The process of using one of these clients is described in http://www.no-ip.com/support/guides/routers/why_software_update_clients_are_preferred.html. The Dynamic Update Client (DUC) is available from http://www.no-ip.com/downloads.php in variants for Windows, Mac and Linux. Only the configuration of the last of these will be dealt with here.
The following guidance might be useful in helping to configure noip2 Linux client.
The basic procedure followed is described in http://www.no-ip.com/support/guides/update_clients/setting_up_linux_update_client.html.
$ cd /usr/local/src/ $ mkdir noip && cd noip $ ls -l total 0 $ wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz --20:36:13-- http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz => `noip-duc-linux.tar.gz' Resolving www.no-ip.com... 204.16.252.112 Connecting to www.no-ip.com|204.16.252.112|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 102,789 (100K) [application/x-tar] 100%[===========================================================================================================>] 102,789 105.05K/s 20:36:16 (104.73 KB/s) - `noip-duc-linux.tar.gz' saved [102789/102789] $ $ pwd
Having downloaded the software build it as follows:
# make gcc -Wall -g -O2 -Dlinux -DPREFIX=\"/usr/local\" noip2.c -o noip2 # pwd /usr/local/src/noip/noip-2.1.4 # # make install if [ ! -d /usr/local/bin ]; then mkdir -p /usr/local/bin;fi if [ ! -d /usr/local/etc ]; then mkdir -p /usr/local/etc;fi cp noip2 /usr/local/bin/noip2 /usr/local/bin/noip2 -C -c /tmp/no-ip2.conf Auto configuration for Linux client of no-ip.com. Please enter the login/email string for no-ip.com fred@example.com Please enter the password for user 'fred@example.com' ******** Only one host [fred.no-ip.org] is registered to this account. It will be used. Please enter an update interval:[30] Do you wish to run something at successful update?[N] (y/N) n New configuration file '/tmp/no-ip2.conf' created. mv /tmp/no-ip2.conf /usr/local/etc/no-ip2.conf # # cd /usr/local/etc/ # pwd /usr/local/etc # ls -l total 20 ... -rw------- 1 root root 144 Jun 11 20:54 no-ip2.conf ... # more no-ip2.conf 0.0.0.0 # whereis noip2 noip2: /usr/local/bin/noip2 # echo '/usr/local/bin/noip2' >> /etc/rc.local
Check the status of the running application:
$ sudo /usr/local/bin/noip2 -S 1 noip2 process active. Process 7768, started as noip2 Using configuration from /usr/local/etc/no-ip2.conf Last IP Address set aaa.bbb.ccc.ddd Account fred@example.com configured for: host fred.no-ip.org Updating every 30 minutes via /dev/eth0 with NAT enabled. $
Rather than having to manually start the script it is best to automate the process. A basic process is provided in http://www.no-ip.com/support/guides/update_clients/setting_up_linux_update_client.html but it can be made more robust.
Make a copy of a start-up file redhat.noip.sh (available in the downloaded noip-duc-linux.tar.gz tarball) for the new noip2 process, adjusting the sh script as necessary for local conditions.
#cd /etc/init.d # mv /tmp/redhat.noip.sh noip2 # chmod 0755 noip2 # ls -l total 584 -rwxr-xr-x 1 root root 1128 Feb 21 2005 acpid ... -rwxr-xr-x 1 root root 1555 Jun 13 16:34 noip2 ... -rwxr-xr-x 1 root root 2232 Jan 18 22:40 zm # vi noip2 ...
Add to the configuration and check the run-level:
# chkconfig --add noip2 # # chkconfig --list | grep noip noip2 0:off 1:off 2:off 3:on 4:on 5:on 6:off #
If necessary the chkconfig --level command option can be used to add/modify the run-level(s) the process is switched on for.
At the same time the opportunity was taken to clean up some (other) process that are running but are really not required in day-to-day multi-user operation:
# service kudzu stop # chkconfig kudzu off # service cups stop Stopping cups: [ OK ] # chkconfig cups off # service isdn stop # chkconfig isdn off # # chkconfig --list | grep "5:on" xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off portmap 0:off 1:off 2:off 3:on 4:on 5:on 6:off rawdevices 0:off 1:off 2:off 3:on 4:on 5:on 6:off iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off lm_sensors 0:off 1:off 2:on 3:on 4:on 5:on 6:off irqbalance 0:off 1:off 2:off 3:on 4:on 5:on 6:off haldaemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off messagebus 0:off 1:off 2:off 3:on 4:on 5:on 6:off sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off cups-config-daemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off vsftpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off xfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off ddclient 0:off 1:off 2:on 3:on 4:on 5:on 6:off anacron 0:off 1:off 2:on 3:on 4:on 5:on 6:off microcode_ctl 0:off 1:off 2:on 3:on 4:on 5:on 6:off smartd 0:off 1:off 2:on 3:on 4:on 5:on 6:off readahead_early 0:off 1:off 2:off 3:off 4:off 5:on 6:off smb 0:off 1:off 2:on 3:on 4:on 5:on 6:off network 0:off 1:off 2:on 3:on 4:on 5:on 6:off ntpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off arptables_jf 0:off 1:off 2:on 3:on 4:on 5:on 6:off crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off mysqld 0:off 1:off 2:off 3:on 4:on 5:on 6:off lvm2-monitor 0:off 1:on 2:on 3:on 4:on 5:on 6:off nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off snmpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off gpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off mcsysinfo 0:off 1:off 2:on 3:on 4:off 5:on 6:off noip2 0:off 1:off 2:off 3:on 4:on 5:on 6:off readahead 0:off 1:off 2:off 3:off 4:off 5:on 6:off sendmail 0:off 1:off 2:on 3:on 4:on 5:on 6:off mdmonitor 0:off 1:off 2:on 3:on 4:on 5:on 6:off syslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off acpid 0:off 1:off 2:off 3:on 4:on 5:on 6:off cpuspeed 0:off 1:on 2:on 3:on 4:on 5:on 6:off autofs 0:off 1:off 2:off 3:on 4:on 5:on 6:off rpcidmapd 0:off 1:off 2:off 3:on 4:on 5:on 6:off apmd 0:off 1:off 2:on 3:on 4:on 5:on 6:off squid 0:off 1:off 2:on 3:on 4:on 5:on 6:off rpcgssd 0:off 1:off 2:off 3:on 4:on 5:on 6:off #
Start the noip2 process:
# service noip2 start
Or if it is already running:
# service noip2 restart Stopping no-ip client daemon: [ OK ] Starting no-ip client daemon: One noip2 process is already active, and the multiple instance flag (-M) is not set. # /usr/local/bin/noip2 -S No noip2 processes active. Configuration data from /usr/local/etc/no-ip2.conf. Account fred@example.com configured for: host fred.no-ip.org Updating every 30 minutes via /dev/eth0 with NAT enabled. # # service noip2 restart Stopping no-ip client daemon: [FAILED] Starting no-ip client daemon: # /usr/local/bin/noip2 -S 1 noip2 process active. Process 31475, started as noip2 Using configuration from /usr/local/etc/no-ip2.conf Last IP Address set 0.0.0.0 Account fred@example.com configured for: host fred.no-ip.org Updating every 30 minutes via /dev/eth0 with NAT enabled. #
A monitor script as shown below was produced:
# write a new log each day myDate=`date +%Y%m%d` # set up log file ipFileName="/tmp/ip-details-$myDate.log" echo "===== IP DETAILS LOG =====" >> $ipFileName echo "" >> $ipFileName # set delimiter and date echo "= = = = = = = = = =" >> $ipFileName date >> $ipFileName # external IP wget -qO - http://whatismyip.org/ >> $ipFileName echo " : external IP addr" >> $ipFileName # internal IP /sbin/ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1, " : internal IP addr" }' >> $ipFileName echo "- - - - - BEGIN no-ip OUTPUT - - - - -" >> $ipFileName sudo /usr/local/bin/noip2 -S >> $ipFileName 2>&1 echo "- - - - - END no-ip OUTPUT - - - - -" >> $ipFileName # email the result /bin/mail -s "IP details query" fred@example.com < $ipFileName
This script writes a log file, an example of the contents being as shown below, and this is also emailled:
===== IP DETAILS LOG ===== = = = = = = = = = = Thu Jun 14 06:20:01 BST 2007 aaa.bbb.ccc.ddd : external IP addr 192.168.xxx.yyy : internal IP addr - - - - - BEGIN no-ip OUTPUT - - - - - 1 noip2 process active. Process 31475, started as noip2 Using configuration from /usr/local/etc/no-ip2.conf Last IP Address set aaa.bbb.ccc.ddd Account fred@example.com configured for: host fred.no-ip.org Updating every 30 minutes via /dev/eth0 with NAT enabled. - - - - - END no-ip OUTPUT - - - - -
The script is executed as a cron job as often as deemed necessary (in this case twice per day).