In this small guide we will build a small dyndns serivce based on php. All you need is some webspace with php.
This project is not meant to be a 100% substitute for a professional dyndns. But it's a good start for your own experiments with php and dyndns. This dyndns script is small and easy to understand, even for php beginners. It's easy to extend with additional functions.
Keep in mind it's not meant for productional environment. Use a https connection if possible.
Main features:
- ip-update function for updating ip-adress
- forwarding to target ip-adress for http & https
- support for any port and path
- support for any protocol via parameter: http, https, ftp and more
- show current ip-adress
- save history of ip-adresses (optional)
Many dyndns web services started charging money for their services. Last year i read about a project of some people, who started programming their own php dyndns script. Based on this script i started to change some parts.
There are some parmeters supported by this script explained here:
Script parameters:
protocol=http (you can use any protocol you want (for example "VNC", "FTP", "SMB", "HTTPS"...) standard ist "http"
port=Portnumber (1-xxxxx)
pfad=path, subfile or filename (f.e. /subfile/start.html). "/" is automatically added.
Special script parameters:
protocol=showip -> displays current target ip adress
protocol=ipupdate -> used to update ip adress (parameter 'pw' & 'ip' needed)
protocol=cryptpw -> hashing function (sha256) (parameter 'pw' needed)
protocol=wol -> used for wake on lan feature (testing), (parameter 'mac' & 'port' needed)
protocol=cryptpwuser -> hashing function for username & password (testing) (sha256) (Parameter 'pw' & 'user' needed)
Examples using this script:
http://www.YourDomain.de/index.php?user=User&pw=Password&ip=<ipaddr>&protocol=ipupdate
Updates ip-adress (this is an example used by a fritzbox router, <ipaddr> delivers the ipadress within routers web-gui).
http://www.YourDomain.de/index.php?user=User&pw=Password&mip=127.0.0.1>&protocol=ipupdate
Updates ip-adress via webbrowser, parameter 'mip' contains the target ip-adress
http://www.YourDomain.de/index.php?protocol=cryptpw&pw=Username
Returns sha256 hashed parameter 'pw', for example username or password
http://www.YourDomain.de/index.php?user=User
Forwards your webbrowser to target ip-adress, without parameters http and port 80 is used
http://www.YourDomain.de/index.php?user=User&protocol=ftp&port=21
Forwards your webbroswer to target ip-adress as FTP://[IP-Adress]:21
http://www.YourDomain.de/index.php?user=User&protocol=vnc&port=5600
Forwards your webbrowser to target ip-adress using VNC//[IP-Adress]:5600
http://www.YourDomain.de/index.php?user=User&protocol=http&port=777&pfad=FunnyPath
Forwards your browser to http://[IP-Adress]:777/FunnyPath