Community discussions

MikroTik App
 
huntah
Member Candidate
Member Candidate
Topic Author
Posts: 287
Joined: Tue Sep 09, 2008 3:24 pm

ROS 7.x - Get address not working

Wed Oct 04, 2023 9:03 pm

Hi,

can any tell me if this scipt is working on ROS 7.x
global ddnsip [ /ip address get [/ip address find interface="ether1" ] address ]
Error: invalid internal item number

It was working perfectly on 6.x ..

If I put in a corresponding number of the interface it works.. Something must've changed..
What is the new way in 7.x .. I could not find it in wiki or forum..

https://help.mikrotik.com/docs/display/ ... g+examples
The Check IP is not working on any of my ROS 7x
 
msatter
Forum Guru
Forum Guru
Posts: 2912
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: ROS 7.x - Get address not working

Wed Oct 04, 2023 9:10 pm

Works fine here: :put [ /ip address get [/ip address find interface="ether2" ] address ]

Using: MikroTik RouterOS 7.12beta1
 
User avatar
eworm
Forum Guru
Forum Guru
Posts: 1071
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: ROS 7.x - Get address not working  [SOLVED]

Thu Oct 05, 2023 1:41 am

Just a guess... Possibly you have several ip addresses on that interface now?

Try that for the first address:
:global ddnsip [ /ip/address/get ([ /ip/address/find where interface="ether1" ]->0) address ];
... or add more properties to your filter.
 
huntah
Member Candidate
Member Candidate
Topic Author
Posts: 287
Joined: Tue Sep 09, 2008 3:24 pm

Re: ROS 7.x - Get address not working

Thu Oct 05, 2023 5:56 pm

Just a guess... Possibly you have several ip addresses on that interface now?

Try that for the first address:
:global ddnsip [ /ip/address/get ([ /ip/address/find where interface="ether1" ]->0) address ];
... or add more properties to your filter.
Yes.. exactly I have more addresses! If I remove them it works the old fashioned way. Disable additional addresses does not help!
But your solution works with multiple addresses!.. Odd thing to change it like this..

Thank you very much for help! Much appriciated!
 
User avatar
eworm
Forum Guru
Forum Guru
Posts: 1071
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: ROS 7.x - Get address not working

Thu Oct 05, 2023 11:35 pm

If you want to handle active addresses only add "disabled=no" to your filter:
:global ddnsip [ /ip/address/get ([ /ip/address/find where interface="ether1" disabled=no ]->0) address ];
It is all about your code! 😜

Who is online

Users browsing this forum: No registered users and 3 guests