dynDNS Update Script through a specific Interface

I have been using the DynDNS update script from the forums and it seems everything works fine. I just want to know how do I point the update script to work over a specific PPPOE interface. Currently I uses two PPPOE out interfaces and routes force the first one to be default for browsing. I want the Dyn DNS script to update the second PPPOE interface ip to DNS name.

I currently is using the following script:

__

_# Set needed variables
:local username “DYNDNSUsername”
:local password “DYNDNSPassword”
:local hostname “DYNDNS Domain Name”

:global dyndnsForce
:global previousIP
\

print some debug info

:log info (“UpdateDynDNS: username = $username”)
:log info (“UpdateDynDNS: hostname = $hostname”)
:log info (“UpdateDynDNS: previousIP = $previousIP”)
\

get the current IP address from the internet (in case of double-nat)

/tool fetch mode=http address=“checkip.dyndns.org” src-path=“/” dst-path=“/dyndns.checkip.html”
:local result [/file get dyndns.checkip.html contents]
\

parse the current IP result

:local resultLen [:len $result]
:local startLoc [:find $result ": " -1]
:set startLoc ($startLoc + 2)
:local endLoc [:find $result “” -1]
:local currentIP [:pick $result $startLoc $endLoc]
:log info “UpdateDynDNS: currentIP = $currentIP”
\

Remove the # on next line to force an update every single time - useful for debugging, but you could end up getting blacklisted by DynDNS!

#:set dyndnsForce true
\

Determine if dyndns update is needed

more dyndns updater request details available at > http://www.dyndns.com/developers/specs/syntax.html

:if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={
:set dyndnsForce false
:set previousIP $currentIP
/tool fetch user=$username password=$password mode=http address=“members.dyndns.org” src-path=“/nic/update?hostname=$hostname&myip=$currentIP” dst-path=“/dyndns.txt”
:local result [/file get dyndns.txt contents]
:log info (“UpdateDynDNS: Dyndns update needed”)
:log info ("UpdateDynDNS: Dyndns Update Result: ".$result)
:put ("Dyndns Update Result: ".$result)
} else={
:log info (“UpdateDynDNS: No dyndns update needed”)
}_



Where will I specify the PPP-out1 to be used as interface for IP

Thank you for your help.

:local currentIP [/ip address get [find interface="PPP-out1"] address];

HTH,

Thank very much.

Am I right if I say this will then look like this..

Set needed variables

:local username "DYNDNSUsername"
:local password "DYNDNSPassword"
:local hostname "DYNDNS Domain Name"
:local currentIP [/ip address get [find interface="PPP-out1"] address];

You have been very helpful

Marius

Am I right if I say this will then look like this..

Set needed variables

:local username “DYNDNSUsername”
:local password “DYNDNSPassword”
:local hostname “DYNDNS Domain Name”
:local currentIP [/ip address get [find interface=“PPP-out1”] address];

You are right, but my example was incomplete, because IP address is returned with netmask, so complete code should be:

:local currentIP [/ip address get [find interface="PPP-out1"] address];
:for i from=( [:len $currentIP] - 1) to=0 do={ 
	:if ( [:pick $currentIP $i] = "/") do={ 
		:set tempIP [:pick $currentIP 0 $i]
	} 
}
:set currentIP $tempIP

Finnaly ‘currentIP’ variable contains IP address without netmask.

HTH,