Why not? Our programs using API have not been magically converted to REST API!
Not really, for some small task it’s fine.
But when you collect hundreds of routes, doing routing table look ups with full table,.. this will crash the REST api often. Then you have to reconfigure the services to get it working again. API works just fine and can handle that. So, as long as the REST api is not really production ready it is not a replacement.
This is broken since 7.20 or something.
No, wrong. It’s working until 7.21beta5. With next versions it’s not longer working.
BGP VPNv4 Issue still exist on 7.21beta11 (SUP-203163)
Has anyone tried/seen this work? I was hoping this would be an easy way to get the IPv4 address from an interface without all the :pick and :find nonsense.
:put [ /ip address get [find interface=bridge1] address]
192.168.88.1/24
:put [:pick [ /ip address get [find interface=bridge1] address] 0 [:find [ /ip address get [find interface=bridge1] address] "/"]]
192.168.88.1
This doesn't return anything though ![]()
:put [:toip [ /ip address get [find interface=bridge1] address]]
The issue noted!
The issue is /ip/address/get returns a str type, not an ip-prefix type, for address. And, apparently, new :toip only deals with getting a IP without CIDR from an actual ip-prefix variable, not str.
:put [:typeof [/ip address get [find interface=vlan163] address]]]
# str
Now, :toip should deal with /ip/address since that be #1 use case for the new "improved :toip command to get IPv4 address from IPv4 CIDR address" IMO. And, it bad idea to change /ip/address/get ... address to return the ip-prefix type, since it used a string for a long time and thus break some existing scripts - although theoretically it should have always used ip-prefix type.
But it does work if you do actually have an ip-prefix variable:
:global somelansubnet 192.168.100.1/24
:put "typeof $[:typeof $somelansubnet] does work with toip: $[:toip $somelansubnet]"
# typeof ip-prefix does work with toip: 192.168.100.1
So it works, in a sense... but the :toip is way less useful if can't deal with a string containing an IP prefix type.
If you search for toip in this topic, you'll see why this change was added ![]()
-
Normally the type for the fields containing "IP address with prefix length" almost everywhere in RouterOS is
strlike you wrote. And it's like that for both IPv4 and IPv6 values. -
However, this has changed with VETH. For the VETH interfaces, the
addressproperty contains an array ofip-prefixandip6-prefix. -
Probably almost no one had the need for extracting those values in scripts for a long time, until @noradtux, who needed to extract the IPv6 address from the field V7.21beta [testing] is released! - #156 by noradtux. The IPv6 address, being of type
ip6-prefixcorrectly truncate the suffix part when being converted to string. However, that causes information lost, if someone (like @noratux) needs the orignal IPv6 address. -
@noradtux reported that as bug, and MikroTik silently made the change in 7.21beta2 (not documented) where
ip6-prefixnow has the full suffix too, when converted to string. -
This broke existing scripts, including mine, V7.21beta [testing] is released! - #123 by CGGXANNX & V7.21beta [testing] is released! - #145 by CGGXANNX.
-
I reported it as bug, requesting the old behavior to be restored.
-
MikroTik restored the old
ip6-prefixbehavior in 7.21beta5. And for use-cases like the ones from @noradtux, where the original IPv6 address including suffix needs to be extracted from the VETHaddress(which is an array ofip-prefixandip6-prefix),:toip6has been updated to be able to convertip6-prefixtoip6, extracting the invisible suffix part too:- console - improve :toip6 command to get IPv6 addresses from IPv6 prefixes;
V7.21beta [testing] is released! - #242 by EdPa & V7.21beta [testing] is released! - #250 by CGGXANNX.
-
Same functionality is implemented in 7.21beta7 for the
:toipIPv4 counterpart.
Conclusion: You can use it to extract the IPv4 address without prefix length from the address field of VETH interfaces for now ![]()
...or the decade of forum posts complaining about scripting's lack of conversion to/from ip-prefix. ;). I'm sure @rextended has some war stories about this.
MikroTik was willing to change the type on VETH since it's relatively new and, for container creation, type does matter. But /ip/address address= has been a string & every router use it, so not so easy to change it's type to ip-prefix without the release thread being populated with variants of "you broke my script". So it is a tricky problem...
But they should close the loop on the conversions, on way or another, since there is still no conversion from "ip-prefix-in-string" to an ip-prefix type. Now, IDK, if :toip should be "overloaded" to take a "ip-prefix-in-string" (like address in /ip/address) to get you an IP address, or just add a new :toip-prefix like:
:put [:toip [:toip-prefix [/ip address get [find interface=bridge1] address]]], or some command to better deal with IP subnet more generically, like say in :convert.
But when scripting syntax varies by command, it really adds to the complexity. So VETH address acting different the /ip/address is kinda problem too...
:put [[:parse ":return 10.0.0.10/24"]]
# return 10.0.0.10/24 ip-prefix type
Just tested:
:put [:toip [[:parse ":return [/ip address get [find where interface=bridge1] address] "]] ]
# or better
{
:local fullIP [/ip address get [find where interface=bridge1] address]
:local onlyIP [:toip [[:parse ":return $fullIP"]] ]
:put "From $fullIP <$[:typeof fullIP]> to $onlyIP <$[:typeof onlyIP]>"
}
# result example:
[rex@tended] > {
{... :local fullIP [/ip address get [find where interface=bridge1] address]
{... :local onlyIP [:toip [[:parse ":return $fullIP"]] ]
{... :put "From $fullIP <$[:typeof $fullIP]> to $onlyIP <$[:typeof $onlyIP]>"
{... }
From 6.7.8.9/23 <str> to 6.7.8.9 <ip>
[rex@tended] >
Found a bug with 7.21beta (all revs) and 7.20 does not have this issue. I’m using CCR1016-12S-1S+ as my router and it has 3 of the Mikrotik S-RJ01 modules. After rebooting the router, every one of these S-RJ01 modules says Auto Negotiation failed but Rate locks at 1Gbps. Communication is only broken on 100Mbps device cause its Rate locked at 1Gbps. Only way to correct is disable Auto Negotiation and then reenable it.
Please fix.
Thanks for the explanation, that's a sordid tale of woe if I ever heard one. Kind of a shameful display from a networking manufacturer to make everyone dance to work with IP addresses.
Guess I'll stick with my existing clumsy workarounds.
Version 7.21rc1 has been released:
I need the link to 7.21 beta 11. I just took notice that in rc1 I have no veth interface. It’s completely missing.
(Webfig and Winbox)
model CRS309-1G-8S+
Also missing in cli. Downgraded all the way back to beta2. Still missing! Don’t know how the !@#$# I missed that!
Forced to downgrade to stable 720.6
When you need a link to whatever version, look at the link for the available version and replace the version number (in this case beta11 instead of rc1) in two places in the link.
I tried that but I beleive it’s in a different directory.
https://download.mikrotik.com/routeros/7.21rc1/ ←–
I tried b and beta but no go! I guess it’s gone.
Nevermid, I got it!
Change the URL according to what you need.
https://download.mikrotik.com/routeros/7.21beta11/all_packages-x86-7.21beta11.zip
