Community discussions

MUM Europe 2020
 
1001001
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 70
Joined: Mon Sep 24, 2012 12:46 pm

Dynamic DNS Script for custom solution

Mon Apr 28, 2014 11:04 am

Hi would you kindly take a look at this script an tell if there es anything wrong with it or if it can be optimized somehow.

Thank you.

# set mandatory variables
:local username [/system identity get name ]
:local password "test"

:global dyndnsForce
:global previousIP

:log info ("previous IP is $previousIP")

# get currentIP to file currentip.txt
/tool fetch mode=http url="http://ddns.xxxxxx.xxx/nic/checkip" dst-path=/currentip.txt
# parse file currentip.txt for current IP
:local currentIP [/file get currentip.txt contents]

:set dyndnsForce true

# Update dynlan1.de
# The following checks first whether or not the currentIP matches the previousIP and based on that information either in case they don't match updates $username.xxxxxx.xxx with the currentIP or in case they do match logs that no update was needed
:if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={

:set dyndnsForce true
:set previousIP $currentIP
/tool fetch mode=http url="http://$username:$password@ddns.xxxxxx. ... ckmx=NOCHG" dst-path=/dyn.txt
:set previousIP $currentIP
:log info ("Updated $username.xxxxxx.xxx to $currentIP")
:log info ("current IP is $currentIP")
} else={
:log info ("$currentIP = $previousIP No update needed!")
}
Last edited by 1001001 on Thu May 08, 2014 10:16 am, edited 1 time in total.
 
1001001
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 70
Joined: Mon Sep 24, 2012 12:46 pm

Re: Dynamic DNS Script for custom solution

Tue Apr 29, 2014 1:22 pm

Using this script I encountered that when run on a router that should tunnel all traffic through vpn, ist ist not chekcing throught the vpn but rather throught the actual internet connection.
Does anybody have an idea how that coul be mitigated?

Thank you.

Best regards

1001001
 
1001001
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 70
Joined: Mon Sep 24, 2012 12:46 pm

Re: Dynamic DNS Script for custom solution

Tue Apr 29, 2014 1:37 pm

nevermind, fixed it by adding a nwe route for the request.

Who is online

Users browsing this forum: No registered users and 19 guests