get gateway in variable

Hello. Pls explaine me how can i get in variable the gateway

Is gateway dynamic or static?

If you add comment to your default gateway like “DEFAULT_ROUTE” then you can easily get and store it in variable. I used int fail voer script which emails/sms me the details along with the gateway dynamically.

:local GW [/ip route get [find comment="DEFAULT_ROUTE"] gateway ]
:log info "$GW"
:put $GW

E.g:
gw.png