Below works, and I get WAN1's gateway of 10.10.20.1
Code: Select all
:return [/ip dhcp-client get [find interface="WAN1" ] gateway ]}
Code: Select all
:global newgw do={ :return [/ip dhcp-client get [find interface="WAN1" ] gateway ]}
Code: Select all
:put $newgw
However, I get this :
Why does this happen?;(eval (eval /returnvalue=(eval (eval /ip dhcp-client getnumber=(eval (eval /ip dhcp-client findwhere=$interface;$add-default-route;$default-route-
distance;$use-peer-dns;$use-peer-ntp;$dhcp-options;$script;$status;$address;$netmask;$gateway;$dhcp-server;$primary-dns;$secondary-dns;$primary-ntp
;$secondary-ntp;$caps-managers;$expires-after;$invalid;$dynamic;$disabled;$comment;$.id;$.nextid;$.dead;(= $interface WAN1);5));value-name=gateway)
)))
I eventually want to get a new variable to read WAN1GW%WAN1 for example 10.10.20.1%WAN1
Code: Select all
:global defRouteWAN1GW ($newgw . "%WAN1")