I am using followign script to print WAN ip in LOG window
Code: Select all
:global externalInterface "ether1"
:local currentIP
:set currentIP [/ip address get [find interface="$externalInterface"] address]
:log warning "$currentIP"
Code: Select all
interrupted
invalid internal item number
I want to print wan ip which is active at a moment
I tried following script, but it prints all the IP addresses assigned to WAN interface, even the disabled ones. I want to print only active (enabled) IP address.
Code: Select all
:global ifs [/ip address find interface="ether1"]
:local ifips ""
:foreach ifip in=$ifs do={
:if ( $ifips = "" ) do={:set ifips "$[/ip address get $ifip address]"} else {:set ifips "$ifips \n$[/ip address get $ifip address]"}
}
:log warning ($ifips)