I have Wan interface with 4 ips (means 4 ips are assigned to single interface and only one ip is active rest are disabled)
I am using followign script to print WAN ip in LOG window
:global externalInterface "ether1"
:local currentIP
:set currentIP [/ip address get [find interface="$externalInterface"] address]
:log warning "$currentIP"
But when I execute the script, I get this error in terminal
interrupted
invalid internal item number
When I select LAN interface which have only one IP, it prints the ip ok,
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.
: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)