Add Me!Close Menu Navigation

My technical corner about Linux, Perl, programming, computer networks and network security

Add Me!Open Categories Menu

Dynamic dns based on a bash and php script

Having dynamic IP address is full of hindrances if you want to use your machine from other place in the world. But if you have your own domain, a linux based desktop and server (which manages of your domain) I can help you probably. I have used this script for years and I haven’t any problems. I hope that it will help you too.

 

You need the following things:

  • A linux based server which manages your domain by the bind service.
  • A httpd server with php support on the server
  • A linux based client computer
  • Elinks program on the client to connect to the server and leave an IP address

 

The script contains:

1) The script which is works on the client:

  • send_ip.sh – to connect to a web server on the server and leave an IP address. You have to add this script to the crontab service

2) Scripts which are work on the server:

  • domain.tld.sh – for checking the ipek.ip if a new IP address was left. You have to add this script to the root crontab service
  • ipek.php – a simple PHP script which only writes an IP address from clients which were connected

 

How it works:

  1. send_ip.sh is launched periodically on the client and tries connect to the server to the ipek.php location script
  2. domain.tld.sh is launched periodically on the server and checks ipek.ip for a new IP address. If an IP address isn’t changed then it will do nothing. Otherwise, the script changes a domain configuration in the bind service and restarts it. Afterwards a new IP address will be assigned to the subdomain (see the $SUBDOMAIN option)

 

Security information

ipek.php should has a completely unusual address location, for example: domain.tld/get-my-ip-jackass-now-73923448/ipek.php – otherwise you risk that your domain may be assigned to a foreign IP address. ;-)

 

Download the scripts package

DOWNLOAD: Domain on a dynamic IP address

Leave a Reply

You must be logged in to post a comment.