Community discussions

 
Vita077
just joined
Topic Author
Posts: 1
Joined: Mon Oct 15, 2018 11:26 am

Sending Caller ID vpn-client to no-ip.com

Mon Oct 15, 2018 11:33 am

Hello! This script works great in Scheduler. What needs to be corrected in him to make it work in the PPP profile?
# Connection options for NO-IP.com
:local ddnsuser "userlogin"
:local ddnspass "userpass"
:local ddnshostname "ddnshostname"
:local ddnsinterface "<vpninterfacename>"

# Description of global variables
:global ddnslastip
:local str
:local ddnsip
:local ip

:if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip "0" }

:local ddnsip [/ppp active get [find name="vpnclientlogin"] caller-id]

:if ([ :typeof $ddnsip ] = nil ) do={
:log info ("ServiceDNS: No ip address on $ddnsinterface .")
} else={

# Exclude the mask from the IP address obtained on the interface
:for i from=( [:len $ddnsip] - 1) to=0 do={
:if ( [:pick $ddnsip $i] = "/") do={
:set ddnsip [:pick $ddnsip 0 $i];
}
}

:if ($ddnsip != $ddnslastip) do={

:log info ("ServiceDNS: $ddnshostname -> $ddnsip")

# Send a new IP address to the No-IP service using an HTTP request
:local str "/nic/update?hostname=$ddnshostname&myip=$ddnsip"
/tool fetch url="http://dynupdate.no-ip.com/$str" mode=http user=$ddnsuser password=$ddnspass \ dst-path=("/ServiceDNS.".$ddnshostname)
:delay 1

# Save the results in log files
:local str [/file find name="ServiceDNS.$ddnshostname"];
:log info [/file get $str contents];
/file remove $str
:global ddnslastip $ddnsip

}

}

Who is online

Users browsing this forum: No registered users and 9 guests