суббота, 18 апреля 2015 г.

Узнаем внешний реальный IP при работе Mikrotik за NAT.

Узнаем через сервис checkip.dyndns.org/dyndns.checkip.html
# 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 "</body>" -1]
:global currentIP [:pick $result $startLoc $endLoc]
Результат будет записан в переменную currentIP.

Подписаться на новые статьи.

Комментариев нет:

Отправить комментарий