Command Line to Get pptp Local Address

Hello Guys, good night, I`m triying to find what is the correct command line to get ip local address response and save it on a variable.

Thanks very much.

local myip [/ip address get [find interface=ether1] address] ; put $myip

Ok, the command line:

local myip [/ip address get [find interface=ether1] address] ; put $myip

Returns the address of the interface but also de netmask. How can i delete the netmask? I only need the IP address.

Thanks very much.

It seems Mikrotik script authors did not expect anyone to need an IP address without the subnet size indication, so it is not really straightforward:


local myip [/ip address get [find interface=ether1] address] ; put [pick $myip 0 [find $myip / 0]]

The manual has it all but you have to know what you are looking for :slight_smile:

Thansk very much Sindy for your fast answering. Your code works for me fine

Cheers