:local activeInterface; /ip route { :local gwintarray; :local counter; :local intfinder; :foreach counter in=[find dst-address=0.0.0.0/0] do={ :if ([get $counter active] = true) do={ :set $activeInterface [get $counter gateway]; } } }
:local activeAddress; /ip address { :set $activeAddress [get [find interface=$activeInterface] address]; :set $activeAddress [:pick $activeAddress 0 [:find $activeAddress "/"]]; }
:local ddnsuser "your_no-ip_user"; :local ddnspass "your_no-ip_pass"; :local ddnshost "hostname.no-ip.org"; :local str "/nic/update?hostname=$ddnshost&myip=$activeAddress"; /tool fetch url="http://dynupdate.no-ip.com/$str" mode=http user=$ddnsuser password=$ddnspass \ dst-path=("/ServiceDNS.".$ddnshost);
:local str "/nic/update?hostname=$ddnshost&myip=$activeAddress"; /tool fetch url="http://dynupdate.no-ip.com/$str" mode=http user=$ddnsuser password=$ddnspass \ dst-path=("/ServiceDNS.".$ddnshost);
:delay 2; :local str [/file find name="ServiceDNS.$ddnshost"]; :log info [/file get $str contents]; /file remove $str
# # Get interface name :local activeInterface; /ip route { :local gwintarray; :local counter; :local intfinder; :foreach counter in=[find dst-address=0.0.0.0/0] do={ :if ([get $counter active] = true) do={ :set $activeInterface [get $counter gateway]; } } } # IP # Get IP-address of actived interface :local activeAddress; /ip address { :set $activeAddress [get [find interface=$activeInterface] address]; :set $activeAddress [:pick $activeAddress 0 [:find $activeAddress "/"]]; } # NO-IP # No-IP User account info :local ddnsuser "your_no-ip_user"; :local ddnspass "your_no-ip_pass"; :local ddnshost "hostname.no-ip.org"; # # Updating data on NO-IP :local str "/nic/update?hostname=$ddnshost&myip=$activeAddress"; /tool fetch url="http://dynupdate.no-ip.com/$str" mode=http user=$ddnsuser password=$ddnspass \ dst-path=("/ServiceDNS.".$ddnshost); # 2 # Wait 2 seconds :delay 2 # # Displays information about the status of the update and delete the downloaded file :local str [/file find name="ServiceDNS.$ddnshost"]; :log info [/file get $str contents]; /file remove $str
Source: https://habr.com/ru/post/275761/
All Articles