Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 19714

Scripting • Network address instead of IP address

$
0
0
I'm 100% new to scripting so this will probably be something stupid I'm missing. But I'm trying to get the current IP of ether1 and add it to an address list. On the address list, I'm getting the network address (e.g. 192.168.200.0/24) instead of just the IP address (192.168.200.1). Am I pulling the data from the wrong value-name?

Here's the code.
Code:
:global currentIP; :local newIP [/ip address get [find interface="ether1"] address]; :if ($newIP != $currentIP) do={    :put [/ip firewall/address-list/add list=wan_ip address=$newIP dynamic=yes];    :put "ip address $currentIP changed to $newIP";    :set currentIP $newIP;}
Any help is much appreciated.

Statistics: Posted by mbd777 — Tue Mar 12, 2024 10:33 pm



Viewing all articles
Browse latest Browse all 19714

Trending Articles