GNU/Linux Desktop Survival Guide by Graham Williams |
|||||
A Dynamic DNS service is provided by No-IP. After signing up for the free service, perhaps with a hostname of ktware.redirect.net, you can download the noip2 client that you run on your local machine. With appropraite setup this can run as a daemon and will forward your IP address to the DNS server to update your symbolic nome for your host. The client can also automatically identify if your host is sitting behind a router and will do the right thing, by getting the IP address stored in the router (rather than the IP address of your host which is probably something like 192.168.0.2).
To get the client:
$ wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz $ tar zxvf noip-duc-linux.tar.gz $ cd noip-2.1.1/ $ make |
To test things as a normal user, create a local configuration:
$ ./noip2 -c CONFIG -C |
$ ./noip2 -c CONFIG -i <ipaddress> |
$ ping ktware.redirectme.net |
Then you can set it up as a daemon as root, using the supplied Debian
script to stop and start the daemon. As root, compile thge client as
above, then do an install:
# make install |
You can now simply run noip2 as root and, as a daemon, it will update the server. With option -S all currently running daemons will be listed. To kill one of the daemons use the -K option.
To run the daemon automatically when the machine is booted place the following script into /etc/init.d/noip2:
#! /bin/sh # /etc/init.d/noip2 # Supplied by no-ip.com # Modified for Debian GNU/Linux by Eivind L. Rygge <eivind@rygge.org> # . /etc/rc.d/init.d/functions # uncomment/modify for your killproc DAEMON=/usr/local/bin/noip2 NAME=noip2 test -x $DAEMON || exit 0 case "$1" in start) echo -n "Starting dynamic address update: " start-stop-daemon --start --pidfile /var/run/noip2.pid \ --make-pidfile --exec $DAEMON echo "noip2." ;; stop) echo -n "Shutting down dynamic address update:" start-stop-daemon --stop --pidfile /var/run/noip2.pid \ --oknodo --retry 30 --exec $DAEMON echo "noip2." ;; restart) echo -n "Restarting dynamic address update: " start-stop-daemon --stop --pidfile /var/run/noip2.pid \ --oknodo --retry 30 --exec $DAEMON start-stop-daemon --start --pidfile /var/run/noip2.pid \ --exec $DAEMON echo "noip2." ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit 0 |
# chmod a+rx /etc/init.d/noip2 |
Now you can start the daemon and check that it is running:
$ wajig start $ noip2 -S 1 noip2 process active. Process 7065, started as noip2 Using configuration from /usr/local/etc/no-ip2.conf Last IP Address set 230.127.57.182 Account kayon.toga@togaware.com configured for: group ktware Updating every 30 minutes via /dev/eth0 with NAT enabled. |
To have the daemon start and stop at boot and shutdown time create the following symbolic links:
# cd /etc/rc2.d # ln -s ../init.d/noip2 S95noip2 # cd /etc/rc0.d # ln -s ../init.d/noip2 K05noip2 |