It is quite interesting that it is used for RB750 as a gateway of a network. But the RB750 at my home is not the gateway.
The following is my home network structure:
Internet<---->RV042<---->SG100-24<---->RB750
See that? While the RB750 runs the script, the script will keep checking the fake IP (192.168.0.197), but not the WAN IP.
How can I fix it? Is there any way to rebuild the script?
Ideally, you want to get the WAN IP directly from the RV042 router in some way. Does this device have FTP or SSH capabilities? The RB750 has the ability to send/receive FTP/SSH. If the RV042 is able to “export” the ip to a plain text file, or send it directly via SSH, then these might be possible.
Another solution is to use a service such as http://whatismyipaddress.com to get the public IP. The downside is it adds another failure point out of your control.
The first no-ip script could be changed to something like this (untested):
# No-IP automatic Dynamic DNS update
#--------------- Change Values in this section to match your setup ------------------
# No-IP User account info
:local noipuser "your_no-ip_user"
:local noippass "your_no-ip_pass"
# Set the hostname or label of network to be updated.
# Hostnames with spaces are unsupported. Replace the value in the quotations below with your host names.
# To specify multiple hosts, separate them with commas.
:local noiphost "hostname.no-ip.net"
#------------------------------------------------------------------------------------
# No more changes need
:global previousIP
# Get the current IP
/tool fetch url="http://bot.whatismyipaddress.com/" mode=http dst-path=pubIP.txt
:local currentIP [/file get pubIP.txt contents]
:if ($currentIP != $previousIP) do={
:log info "No-IP: Current IP $currentIP is not equal to previous IP, update needed"
:set previousIP $currentIP
# The update URL. Note the "\3F" is hex for question mark (?). Required since ? is a special character in commands.
:local url "http://dynupdate.no-ip.com/nic/update\3Fmyip=$currentIP"
:local noiphostarray
:set noiphostarray [:toarray $noiphost]
:foreach host in=$noiphostarray do={
:log info "No-IP: Sending update for $host"
/tool fetch url=($url . "&hostname=$host") user=$noipuser password=$noippass mode=http dst-path=("no-ip_ddns_update-" . $host . ".txt")
:log info "No-IP: Host $host updated on No-IP with IP $currentIP"
}
} else={
:log info "No-IP: Previous IP $previousIP is equal to current IP, no update needed"
}