Code: Select all
:global addr [/ip address get [find interface="bridge1"] address]
Thanks, Jiri
:global addr [/ip address get [find interface="bridge1"] address]
{
/ip cloud
:local ipv4 [get public-address]
:local ipv6 [get public-address-ipv6]
:put $ipv4
:put $ipv6
}
{
:local addrs [:toarray ""]
/ip/address
:foreach id in=[find interface="bridge1"] do={
# do something, like
:set addrs {$addrs , [get $id address]}
}
:put $addrs
}
> :put [/ip/address/find where !(address in 192.168.0.0/16) and !(address in 172.16.0.0/12) and !(address in 10.0.0.0/8)]
> /ip/address/find where <press F1 here>
the answer is No.By the way, the :put command should be inside of the for loop, right?
"dynamic" and "invalid" are not shown in "F1" help message, but usable..., we can see usable query parameters by
Okay, all right.Sorry, I confused you and OP.
And for IPv6 is there any way?Unfortunately there is no flag that indicates the IPv4 address is global or not
{
:local addresses [:toarray ""]
/ipv6/address
:foreach id in=[find interface="bridge1" global] do={
# do something, like
:set addresses {$addresses , [get $id address]}
}
:put $addresses
}
/ipv6 address print where interface=WAN and global :local wanipv6global [/ipv6 address get [find where interface=WAN and global] address]Obviously some problems can occour if the interface have more than one address.....