Difference between revisions of "Ros3 Dyn DNS"
(Updates Script) |
(→Info) |
||
Line 1: | Line 1: | ||
− | =Info | + | =Info |
− | The following script should be created | + | The following script example should be created to update your ChangeIP.com or MyDDns.com Dynamic DNS account. Once created you should schedule this to run once in a while. The :local variables should be edited to include your unique username and password, interface name, etc. The script here should allow auto-detection of the default gateways interface name. This script below can be used if you have more than 1 WAN connection, but only 1 is active at a time. |
This script will work as is, just navigate to System/Scripts and run it. This particular script works good with a 5 minute interval to update your Dynamic DNS with a scheduler. | This script will work as is, just navigate to System/Scripts and run it. This particular script works good with a 5 minute interval to update your Dynamic DNS with a scheduler. |
Revision as of 18:47, 18 July 2009
=Info The following script example should be created to update your ChangeIP.com or MyDDns.com Dynamic DNS account. Once created you should schedule this to run once in a while. The :local variables should be edited to include your unique username and password, interface name, etc. The script here should allow auto-detection of the default gateways interface name. This script below can be used if you have more than 1 WAN connection, but only 1 is active at a time.
This script will work as is, just navigate to System/Scripts and run it. This particular script works good with a 5 minute interval to update your Dynamic DNS with a scheduler.
Setup
For this script to function correctly, there are a few things that will need to be setup. Not necessary, but always good to have in place.
- Routerboard Identity Setup rb_Identity
- Routerboard Time Setup, either manually rb_time_manual or via NTP rb_ntp_setup
Enhancements
- Check out Dynamic DNS Schedule to create a schedule, that will run the script at a predefined period.
Script
# MyDDns International Account # Local user variables :local DnsUser "enter your MyDDns username here" :local DnsPass "enter your MyDDns password here" :local DnsHost "enter your MyDDns hostname here" :local DnsInterface "enter your PPPoE interface name here" # Global user variables # if you have another PPPoE account with this script you need to change LastDnsIpInter to something unique; search/replace :global LastDnsIpInter :if ([ :typeof $LastDnsIpInter ] = nil) do={ :global LastDnsIpInter "0"} # Get the current Ip Address :local DnsIp [/ip address get [/ip address find interface=$DnsInterface] address ] # Check for updates :if ([ :typeof $DnsIp ] = nil ) do={ :log info ("DynDns: No Ip address present on ". $DnsInterface ) } else={ :local NewIp [ :pick $DnsIp 0 [ :find $DnsIp "/" ] ] :if ($NewIp != $LastDnsIpInter) do={ :log info ("DynDns: ". $DnsInterface ." Sending update.") :local DnsResult ( [ :put [ /tool dns-update name=$DnsHost address=$NewIp key-name=$DnsUser key=$DnsPass ] ] ) :global LastDnsIpInter $NewIp } else={ # Uncomment the line below if you want to see when updates aren't needed # :log info "DynDns: ($DnsInterface) No update needed" } }