My router sets a wrong IP address when updating dynDNS, probably the one that my ISP gives me internally. So I had to write a little bash script for setting the IP address. Thanks to the api provided by dyn.com I was able to do just that.
#!/bin/bash
IP_stored=$(cat IP.txt)
IP_current=$(wget http://ipinfo.io/ip -qO -)
HOST="somewhere.dlinkddns.com"
USERNAME="username" //whaaaat
PASSWORD="password" //why did I post this??
URL="members.dyndns.org/nic/update"
URLEND="&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"
if [ "$IP_stored" != "$IP_current" ]
then
curl "http://${USERNAME}:${PASSWORD}@${URL}?hostname=${HOST}&myip=${IP_current}${URLEND}"
echo "${IP_current}" > IP.txt
fi
Cronjob
*/5 * * * * cd /home/pi/script/ && bash dynDNSupdate.sh
https://help.dyn.com/remote-access-api/perform-update/
http://askubuntu.com/questions/95910/command-for-determining-my-public-ip
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.