What's new

Best way to do DDNS updates when behind another (DSL) router?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

This 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 [$@]"
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? Thanks
 
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? Thanks

Good question!

The "cru a dnsupdate 0 * * * * /jffs/scripts/dns-update-ip.sh" command goes in your /jffs/scripts/services-start script so that it gets added to cron every time the router is booted. It might be the only command in that file.
 
Hi, folks

Im new here and regarding Cron jobs.

I have a RT-AC68U (TM-1900 converted), Unfortunately My ISP is PPPoA and my Modem (Netgear DM-200) doesnt support PPPoA to PPPoE Bridging (I found out late), so I have double Nat and My WAN IP is a private IP. The thing is that I have a no-ip DDNS, and since My modem reboots 1 or 2 times a day due to power failure ( Electricity in my country is a mess). I have to find a way to update the IP address. I was thinking about a Cron job that detect when the WAN port loss connection (When the modem reboot), then wait a few minutes or just dectect when the WAN Port is back online, before checking the new public IP address then update it at no-ip.

is that possible?
 
Hi, folks

Im new here and regarding Cron jobs.

I have a RT-AC68U (TM-1900 converted), Unfortunately My ISP is PPPoA and my Modem (Netgear DM-200) doesnt support PPPoA to PPPoE Bridging (I found out late), so I have double Nat and My WAN IP is a private IP. The thing is that I have a no-ip DDNS, and since My modem reboots 1 or 2 times a day due to power failure ( Electricity in my country is a mess). I have to find a way to update the IP address. I was thinking about a Cron job that detect when the WAN port loss connection (When the modem reboot), then wait a few minutes or just dectect when the WAN Port is back online, before checking the new public IP address then update it at no-ip.

is that possible?
https://www.snbforums.com/threads/the-tm-ac1900-is-not-supported.48056/
 
His problem is not anyhow related to TM, so no need to be so restrictive!!!

I think you all are only jealous he got your router for 1/3 you paid for yours.

If you would have searched 5 sec. (google no-ip DDNS asus double nat) you would find answers like those: https://www.snbforums.com/threads/double-nat-can-be-used-for-ddns-why-not-by-a-router.30005/
https://www.snbforums.com/threads/custom-ddns-update-rate.29716/#post-230630
 
Last edited:
His problem is not anyhow related to TM, so no need to be so restrictive!!!

I think you all are only jealous he got your router for 1/3 you paied for yours.

If you would have searched 5 sec. (google no-ip DDNS asus double nat) you would find answers like those: https://www.snbforums.com/threads/double-nat-can-be-used-for-ddns-why-not-by-a-router.30005/
https://www.snbforums.com/threads/custom-ddns-update-rate.29716/#post-230630
I'm not restricted forum rules, is it illegal so is it.
https://www.snbforums.com/threads/a...d-forks-on-non-asus-devices-is-illegal.44636/

Q: Why can't I update my (modded) TM-AC1900 firmware?
A: Because you are running Asuswrt-Merlin on an UNSUPPORTED model, and Asus recently changed the firmware validation process to prevent such a thing. You will have to revert back to the original TM-AC1900. Beyond that, you're on your own.
 
Last edited:
his problem is general for all devices, so what?
He never asked for conversion or update for his special router.
Only for help to get DDNS running.
 
his problem is general for all devices, so what?
He never asked for conversion or update for his special router.
Only for help to get DDNS running.

Hi, folks
I have a RT-AC68U (TM-1900 converted),
This is enough to not get help with illegal software.
 

I'm not asking for conversion. Mine is already converted.

His problem is not anyhow related to TM, so no need to be so restrictive!!!

I think you all are only jealous he got your router for 1/3 you paid for yours.
/QUOTE]

Thanks


I'm aware of several methods to get the DDNS IP address updated. I just wanted to see if it was possible to create the rule when the WAN port lose and get connection back, since that's the way that fit me better (and maybe some others).

I'm not restricted forum rules, is it illegal so is it.
https://www.snbforums.com/threads/a...d-forks-on-non-asus-devices-is-illegal.44636/

Q: Why can't I update my (modded) TM-AC1900 firmware?
A: Because you are running Asuswrt-Merlin on an UNSUPPORTED model, and Asus recently changed the firmware validation process to prevent such a thing. You will have to revert back to the original TM-AC1900. Beyond that, you're on your own.

Again, I'm not asking for conversion or unbricking.

As far as I'm concerned, the TM-1900 is an ASUS router, branded/capped by T-Mobile, so technically I'm using an ASUS router and I'm not asking for conversion/unbricking.


his problem is general for all devices, so what?
He never asked for conversion or update for his special router.
Only for help to get DDNS running.

Thanks again.
 
I'm not asking for conversion. Mine is already converted.
Converted is illegal and not supported.
You are running Asuswrt-Merlin on an UNSUPPORTED model.
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top