Mikrotik script giving LA...
Mikrotik script giving LAN IP address
- Accueil
- Espace Client
- Community Forum
- Services
- Dynamic DNS Service
- Mikrotik script giving LAN IP address
- Community Forum
- Mikrotik script giving LAN IP address
Topic: Mikrotik script giving LAN IP address
There is some thing wrong with the script it giving me router internal ip not wan ip
Reply with quote | Report
/system script
add name=Dynu
policy=read,write,test
source=":global ddnsuser mydynusuername
:global ddnspass "dynupassword"
:global theinterface "IN"
:global ddnshost "myhost.dynu.com"
:global ipddns [:resolve $ddnshost];
:global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]
:if ([ :typeof $ipfresh ] = nil ) do={
:log info ("DynuDDNS: No IP address on $theinterface .")
} else={
:for i from=( [:len $ipfresh] - 1) to=0 do={
:if ( [:pick $ipfresh $i] = "/") do={
:set ipfresh [:pick $ipfresh 0 $i];
}
}
:if ($ipddns != $ipfresh) do={
:log info ("DynuDDNS: IP-Dynu = $ipddns")
:log info ("DynuDDNS: IP-Fresh = $ipfresh")
:log info "DynuDDNS: Update IP needed, Sending UPDATE...!"
:global str "/nic/update?hostname=$ddnshost&myip=$ipfresh"
/tool fetch address=api.dynu.com src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/Dynu.".$ddnshost)
:delay 1
:global str [/file find name="Dynu.$ddnshost"];
/file remove $str
:global ipddns $ipfresh
:log info "DynuDDNS: IP updated to $ipfresh!"
} else={
:log info "DynuDDNS: dont need changes";
} }
add name=Dynu
policy=read,write,test
source=":global ddnsuser mydynusuername
:global ddnspass "dynupassword"
:global theinterface "IN"
:global ddnshost "myhost.dynu.com"
:global ipddns [:resolve $ddnshost];
:global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]
:if ([ :typeof $ipfresh ] = nil ) do={
:log info ("DynuDDNS: No IP address on $theinterface .")
} else={
:for i from=( [:len $ipfresh] - 1) to=0 do={
:if ( [:pick $ipfresh $i] = "/") do={
:set ipfresh [:pick $ipfresh 0 $i];
}
}
:if ($ipddns != $ipfresh) do={
:log info ("DynuDDNS: IP-Dynu = $ipddns")
:log info ("DynuDDNS: IP-Fresh = $ipfresh")
:log info "DynuDDNS: Update IP needed, Sending UPDATE...!"
:global str "/nic/update?hostname=$ddnshost&myip=$ipfresh"
/tool fetch address=api.dynu.com src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/Dynu.".$ddnshost)
:delay 1
:global str [/file find name="Dynu.$ddnshost"];
/file remove $str
:global ipddns $ipfresh
:log info "DynuDDNS: IP updated to $ipfresh!"
} else={
:log info "DynuDDNS: dont need changes";
} }
Reply with quote | Report
Author | Topic: Mikrotik script giving LAN IP address |
---|---|
mohamed saffar Joined: 25/10/2015 |
Mikrotik script giving LAN IP address jeudi 14 janvier 2016 12:04
There is some thing wrong with the script it giving me router internal ip not wan ip
|
timothytw Joined: 02/05/2002 |
Mikrotik script giving LAN IP address vendredi 15 janvier 2016 10:30
Could you please post your script here so that we may take a look?
|
lokka Joined: 25/10/2015 |
Mikrotik script giving LAN IP address vendredi 15 janvier 2016 10:32
/system script
add name=Dynu policy=read,write,test source=":global ddnsuser mydynusuername :global ddnspass "dynupassword" :global theinterface "IN" :global ddnshost "myhost.dynu.com" :global ipddns [:resolve $ddnshost]; :global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ] :if ([ :typeof $ipfresh ] = nil ) do={ :log info ("DynuDDNS: No IP address on $theinterface .") } else={ :for i from=( [:len $ipfresh] - 1) to=0 do={ :if ( [:pick $ipfresh $i] = "/") do={ :set ipfresh [:pick $ipfresh 0 $i]; } } :if ($ipddns != $ipfresh) do={ :log info ("DynuDDNS: IP-Dynu = $ipddns") :log info ("DynuDDNS: IP-Fresh = $ipfresh") :log info "DynuDDNS: Update IP needed, Sending UPDATE...!" :global str "/nic/update?hostname=$ddnshost&myip=$ipfresh" /tool fetch address=api.dynu.com src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/Dynu.".$ddnshost) :delay 1 :global str [/file find name="Dynu.$ddnshost"]; /file remove $str :global ipddns $ipfresh :log info "DynuDDNS: IP updated to $ipfresh!" } else={ :log info "DynuDDNS: dont need changes"; } } |
It is currently samedi 21 décembre 2024 22:07 US Mountain Standard Time
samedi 21 décembre 2024 22:07