Setting up ddclient on debian

I followed this to setup my namecheap ddclient:

So i’ve installed ddclient:

apt-get install ddclient

Then configured it:

nano /etc/ddclient.conf

 

ssl=yes
daemon=600
use=cmd, cmd=/root/publicip.sh
protocol=namecheap  
server=dynamicdns.park-your-domain.com 
login=yourdomain.com
password=1b9aafgfgjh1865e024fabb629dbd1d9c462
@

Save and exit the file

Restart ddclient service using the following command

/etc/init.d/ddclient restart

But I was getting error saying that my ddclient was unable to obtain IP address.

To fix that I have created a script to fetch my public IP address:

nano publicip.sh

 

curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

saved it and made it executable

chmod +x ./publicip.sh

Next step is to modify the ddclient config:

nano /etc/ddclient.conf

and added this line:

use=cmd, cmd=/root/publicip.sh

Restarted ddclient and run:

 ddclient -daemon 0 -debug -verbose -noquiet

and make sure all is looking good.

Setting up NoIP on Raspberry Pi

Install No-IP client:

Create a directory for the client software

mkdir /home/noip
cd /home/noip

Download and extract the client software

wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
tar vzxf noip-duc-linux.tar.gz

Now install the software:

cd noip-2.1.9-1
 make
 make install

Next provide your NoIP username, password and refresh interval.
To start the program run:

/usr/local/bin/noip2

Setup automatic startup

nano /etc/init.d/noip

and paste this:

#! /bin/sh
 # /etc/init.d/noip
 ### BEGIN INIT INFO
 # Provides: noip
 # Required-Start: $remote_fs $syslog
 # Required-Stop: $remote_fs $syslog
 # Default-Start: 2 3 4 5
 # Default-Stop: 0 1 6
 # Short-Description: Simple script to start a program at boot
 # Description: A simple script from www.stuffaboutcode.com which will start / stop a program a boot / shutdown.
 ### END INIT INFO
 # If you want a command to always run, put it here
 # Carry out specific functions when asked to by the system
 case "$1" in
 start)
 echo "Starting noip"
 # run application you want to start
 /usr/local/bin/noip2
 ;;
 stop)
 echo "Stopping noip"
 # kill application you want to stop
 killall noip2
 ;;
 *)
 echo "Usage: /etc/init.d/noip {start|stop}"
 exit 1
 ;;
 esac
 exit 0

Make script executable:

chmod 755 /etc/init.d/noip

Test starting the program:

/etc/init.d/noip start

Test stopping the program:

/etc/init.d/Noip stop

Register script to be run at start-up:

update-rc.d noip defaults