Logging of Dynamically obtain IP Address from ISP

Hi folks!

Is Mikrotik RouterOS capable to log Public/ Private IP Addresses obtain dynamically from ISP?

If yes, how?

Thank you so much.

What do you mean?

Sent from my SCH-I545 using Tapatalk

What I mean is, I want my RB951G-2HnD to log each dynamic Public IP Address that my router is getting from my ISP.

Is it possible?

Thank you.

Yeah. You could script that. Similar to the dynamic dns scripts people use.

Sent from my SCH-I545 using Tapatalk

Nice.

Can you guide me on how I can learn to construct that script? or much better if you can show me a sample script?

Thank you so much, Sir.

I’d basically have to write the script. I’ll do it later today or tomorrow if I get a chance.

-Eric

Sent from my SCH-I545 using Tapatalk

Basically this…

Variables

:local currentLocalSiteInterface “ether01-gateway”
:local currentLocalSite
:local forceUpdate false

Script

:global localSite

:if ($currentLocalSiteInterface != “” && $currentLocalSite = “”) do={

:set currentLocalSite [/ip address get [/ip address find interface=$currentLocalSiteInterface] address]

:set currentLocalSite [/ip dhcp-client get [/ip dhcp-client find interface=$currentLocalSiteInterface] address]
:set currentLocalSite [:pick $currentLocalSite 0 [:find $currentLocalSite "/" -1]]

}

:if ([:typeof $localSite] = “nothing”) do={
:set localSite “”
}

:if ($currentLocalSite != $localSite) do={
:set forceUpdate true
:set localSite $currentLocalSite
}

:if ($forceUpdate) do={

DO WHATEVER YOU WANT HERE …

}