I’m looking for a command to give me back all the usable ips in a range.i.e
if i have a 192.168.29.1/30 in ip addresses
thus,
network 192.168.29.0
broadcast 192.168.29.3
Usable Ip address 192.168.29.2 (The gateway will be 192.168.29.1)
I know i can use a command like ip address get network to get the network ip for instance.
How can i get the Usable ip?(192.168.29.2) in this case from the ip addresses?
I want to use this in a script,but i cant find a command that will return me the usable ips?
I'm sure that it is very clear that all the addresses between 10.5.50.0 to 10.5.50.254 might be configured on RouterOS.
However it is not able to specify all usable IP addresses from this subnet, 'ip arp print' show information about current used IP address on the network (however client can switch off PC and ARP entry will be available until timeout).
Yeah,it is clear looking at it,but i was houping for some sort of way to tell my script all these ips,so that it could add rules accordingly.But it’s ok,i sort of have a work around currently using the | operator.
Another question,How can i use &&(and) in find commands?
Say i want to combine /ip address find interface=ether1 and /ip address find disabled=no (I want to find all enabled ips on ether1)
Trying
/ip address find(interface=ether1 && disabled=no) does not work
How can i find all enabled ip’s on intercae ether1?
There is workaround for v2.9 also.
Run find command with one parameter, after that check from values that were found earlier against other param:
:local lfound [ /ip address find interface=ether1 ];
:for i=0 to=[:len $lFound] do={
:if ( [/ip address [:pick $lFound $i] disabled ] = no ) do={
# here you will have ip addresses with interface=ether1 and disabled=no
}
}
Say i have a 172.16.0.0/16 and a 192.169.0.0/16 on a certain interface and i only want to list the ips in the 192 range.
something like
ip /address find [interface=interface src-address=????]
The ??? part must give me all ips in the 192.169.0.0/16 range on the interface.
(I don’t have a 192.169.0.0/16 ip address,I have a lot of /30,/29 etc,but all of them is inside the 192.168.0.0/16 range,i want to list al these ips,i.e 192.169.1/32,192.169.5/32,etc)