Hello World
Occasional Visitor
Sorry for the newb questions; Do I need the dns-update.sh script in addition to the dns-start script? How often does this update an IP address? ThanksThis script is for Google DNS. Most of them are similar. Change the Google URL to the URL for your DDNS service. It also assumes you have entware (or entware-ng) installed for the root certs so SSL works. If you don't have the root certs installed and don't want to, you can add --no-check-certificate to the wget command to connect to your provider insecurely.
Create a file called /jffs/scripts/dns-update.sh with this in it. Chmod it 700. Add it to cron with this command "cru a dnsupdate 0 * * * * /jffs/scripts/dns-update-ip.sh"
Code:#!/bin/sh /usr/bin/logger -t $(basename $0) "started [$@]" # Define these variables for your system username=YOUR USERNAME password=YOUR PASSWORD hostname=YOUR DOMAIN NAME # Define path to certs so HTTPS works in wget # Certificates are installed using 'opkg install ca-certificates' export SSL_CERT_DIR=/opt/etc/ssl/certs # Get our public IP address from ICanHazIP.com # Force use of IPv4 since IPv6 might be broken ip=`wget -4 -q http://icanhazip.com -O -` # Compare IP address in DNS to current one dns_ip=`nslookup $hostname 8.8.8.8|grep ^Address|grep -v 8.8.8.8|grep -v ::1|awk -F: '{print $2}'|awk '{print $1}'` if [ "$dns_ip" = "$ip" ]; then /usr/bin/logger -t $(basename $0) "completed, no change [$@]" exit 0 fi # Make sure we use SSL enabled wget # the wget in the flash has ssl now (hmmm...) so no need for this anymore #wget=/opt/bin/wget wget=/usr/sbin/wget # Register our new IPv4 address with Google # Force use of IPv4 since we know for sure IPv6 tunnel is broken now $wget -4 -q "https://$username:$password@domains.google.com/nic/update?hostname=$hostname&ip=$ip" -O /tmp/g.log /usr/bin/logger -t $(basename $0) "Updated IP to $ip [$@]"