Community discussions

  • 1
  • 4
  • 5
  • 6
  • 7
  • 8
 
pe1chl
Forum Guru
Forum Guru
Posts: 5533
Joined: Mon Jun 08, 2015 12:09 pm

Re: Metarouter images

Tue Aug 14, 2018 7:39 pm

I think Metarouter running something else than RouterOS is a long abandoned concept...
 
User avatar
IPANetEngineer
Trainer
Trainer
Posts: 985
Joined: Fri Aug 10, 2012 6:46 am
Location: Jackson, MS, USA
Contact:

Re: Metarouter images

Tue Aug 14, 2018 10:56 pm

I think Metarouter running something else than RouterOS is a long abandoned concept...
Unfortunately I think yo're right...we all got so excited when CCR came out that it could be an inexpensive hypervisor but I don't think it will happen.
Global - MikroTik Support & Consulting - English | Francais | Español | Portuguese +1 855-645-7684
https://iparchitechs.com/services/mikro ... l-support/ mikrotiksupport@iparchitechs.com
 
starter48
just joined
Posts: 1
Joined: Tue Dec 12, 2017 6:19 am

Re: Metarouter images

Wed Aug 15, 2018 5:14 am

This is lede for metaroute:
https://github.com/cuihaoleo/lede-mr-mips
Any pre-built images available?
For RB2011: viewtopic.php?f=15&t=128998 it does work with ROS v6.42.6
 
User avatar
NathanA
Forum Veteran
Forum Veteran
Posts: 793
Joined: Tue Aug 03, 2004 9:01 am

Re: Metarouter images

Wed Aug 15, 2018 12:21 pm

Even MetaROUTER running RouterOS inside of itself seems to be a long-abandoned concept. The problems with stability are endemic to MetaROUTER itself and don't have anything to do with the OpenWRT patches. There are so many unaddressed stability bugs that affect MetaROUTER both on mipsbe and ppc that it is unusable even for RouterOS-as-guest.

For when I need a good value single-board-computer, I still use RouterBoards, but simply replace RouterOS with OpenWRT entirely. In some cases this means I install 2 RouterBoards for a customer instead of 1: one RouterBoard to run RouterOS and do routing, and a second RouterBoard to run OpenWRT and whatever custom applications the client needs. Twice as expensive, but at least it is completely stable. It would be nice to be able to put everything on one device, but v7 is still vaporware and MetaROUTER on v6 has so much bit-rot at this point that I don't see that happening anytime soon.

-- Nathan
 
talz
newbie
Posts: 31
Joined: Wed Mar 15, 2017 9:01 pm

Re: Metarouter images

Wed Oct 31, 2018 10:59 pm

hi guys.

I work for a company that heavily uses mikrotiks, and as one of the only software developers that works for my company, I've written tons of code using the mikrotik scripting language. Unfortunately, it is by far the worst programming/scripting language I have ever had the displeasure of working with. I could write a book on all the things that it does, or is missing that annoy me. I have been looking for a way to run Python on a mikrotik forever, and was aware that you could replace RouterOS with OpenWRT completely, but we have too many techs that know how to use RouterOS, and don't know how to use Linux, to be able to remove RouterOS from our devices completely.

Recently, I was able to get OpenWRT running in metarouter, and actually install Python2.7. I was then able to use some python routeros libraries to talk to the host mikrotik device using the mikrotik API! In theory, that means I can replace all my mikrotik scripts that run on the device itself with Python scripts that run in metarouter, and Python can perform all the logic, like checking if WAN links are up or down, changing routes between WAN links, sending email alerts about rogue DHCP servers, and whatever else needs doing.

Nathan's comment about MetaRouter not being stable is concerning however. It would be amazing if I could use Python, but not if it means we're going to have stability issues. So far, in my testing, I haven't come across any obvious stability issues, but I've only been play around with metarouter for the past day or two.

What kind of issues are common with running OpenWRT on metarouter?
 
nicolino
just joined
Posts: 11
Joined: Tue Dec 15, 2015 12:49 am

Re: Metarouter images

Wed Oct 31, 2018 11:38 pm

Hey Talz,

Nice to see you are also trying to leverage this great (but unfortunately abandoned) feature.

If your read through the entire thread you will find the most common issue is the metarouter guest OpenWRT kernel crashing, causing the host (yes, your actual, real, physical MK router) crash as well.
Believe it or not.

I think there was one OpenWRT version not crashing but with some other issues I don't recall right now.

Hope you hit the correct version and results are stable for your implementation. Please stay around and share any good or bad news you might have.

Regards, thank you!
Nico
 
talz
newbie
Posts: 31
Joined: Wed Mar 15, 2017 9:01 pm

Re: Metarouter images

Wed Oct 31, 2018 11:51 pm

Interesting...

It seems like I actually ran into that yesterday. I think I was using http://openwrt.wk.cz/trunk/mr-mips/open ... 079.tar.gz.
It worked for a bit, and then my RB493 started booting up, and then losing power after a few seconds and rebooting.
My 493 wasn't new - it was just out of the box of our old devices, so I figured there was probably something wrong with it, but this would explain it.

I later tried openwrt-mr-mips-rootfs-31411-basic.tar.gz, and that seemed to be working fine. I don't think it has died once today.
 
talz
newbie
Posts: 31
Joined: Wed Mar 15, 2017 9:01 pm

Re: Metarouter images

Thu Nov 01, 2018 12:27 am

This may already be covered at some point in the previous 8 pages of this thread, but this has been my experience over the past 24 hours trying to get Python running in Metarouter on RB493AH:

Working Image: http://openwrt.wk.cz/trunk/mr-mips/open ... sic.tar.gz
RouterOS Version: RouterOS v6.40.9

Had no problems copying the image to my 493, going to MetaRouter, importing it, and starting it up.
I created a dynamic interface for it under Metarouter --> Interfaces, and added vif1 to my LAN bridge on the 493.
This let OpenWRT grab an IP using its DHCP client, which was already running.
It did NOT configure a DNS server automatically however - not sure why, so I added "nameserver 8.8.8.8" to /etc/resolv.conf.
I don't know if I just missed something, or if it's some sort of bug - I didn't really look into it too hard.

At this point, I had internet, which let me download and install python 2.7, and its requirements:
wget http://openwrt.wk.cz/trunk/mr-mips/packages/libpthread_0.9.33-104_mr-mips.ipk
wget http://openwrt.wk.cz/trunk/mr-mips/packages/zlib_1.2.5-1_mr-mips.ipk
wget http://openwrt.wk.cz/trunk/mr-mips/packages/libffi_3.0.10-1_mr-mips.ipk
wget http://openwrt.wk.cz/trunk/mr-mips/packages/python-mini_2.7.3rc2-2_mr-mips.ipk
wget http://openwrt.wk.cz/trunk/mr-mips/packages/python_2.7.3rc2-2_mr-mips.ipk

opkg install *.ipk

rm -v *.ipk

This should give you working python2.7.
To talk to the host mikrotik using Mikrotik API, you have a few choices:

  1. https://github.com/rtician/routeros
  2. https://github.com/socialwifi/RouterOS-api

Option 1 is a project that doesn't seem to have any SSL support (can't use the Mikrotik API SSL protocol), so it should work out of the box.
Option 2 is slightly harder to get to work.

In both cases, the problem you'll likely run into is SSL. OpenWRT keeps things lean, and doesn't include SSL support out of the box.
As far as I can tell, normally, you can install SSL using opkg without much effort. Unfortunately, http://openwrt.wk.cz/trunk/mr-mips/packages/, which is a repository of pre-built packages that will work on the MIPS CPU the RB493AH has, does not appear to have the SSL package. This means:
  • You can't use wget to download anything that starts with https (SSL encrypted web pages)
  • You need to modify RouterOS-api to disable SSL support, or it won't run

To get around the fact that you can't download anything from HTTPS, I just downloaded stuff on a different computer, and used SCP to copy it over to OpenWRT.
Note: OpenWRT's tar also didn't seem to like extracting some of the packages I was downloading, so if you have a .tar.gz file you need to extract, you might need to extract it on a different machine and scp it as an extracted folder.

To get around RouterOS_api having built-in SSL support, which causes "import routeros_api" to fail (complains about importing of _ssl), you need to disable ssl. Find and modify api_socket.py in that project, and do 2 things:
  • Comment out "import ssl"
  • In get_socket(), right before this line
    • if ssl_context is None and use_ssl:
    add this:
    • if ssl_context or use_ssl: raise Exception("SSL not supported on OpenWRT")

It's probably enough to just comment out the import line, but I added a bit of extra code in case I ever forget, and try to use api_ssl.
At this point, as long as your current working directory has the routeros_api folder in it, you should be able to import routeros_api and use it.
If you want to install routeros_api system-wide, you can either move the entire routeros_api dir anywhere that's in python's sys.path (I haven't tried this, but it'll probably work), or use Python's SetupTools.

To use SetupTools, which is actually required in order to install a bunch of packages from PyPi, you can do this:
  • Download the setup tools zip file from https://pypi.org/project/setuptools/#files on any other machine
  • Extract it
  • SCP the extracted folder to OpenWRT
  • cd into that folder on openwrt
  • Run "python setup.py install"
  • Delete the setup tools folder to save space - it's now installed system-wide

At that point, you can go back to the RouterOS_API directory, and run "python setup.py install" on that, which will install it system-wide.
If it complains about failing to import "six", you can download that from pypi and install it with "python setup.py install" just like everything else.

Having setuptools installed will let you download and install many of the packages found on pypi's website.
It seems like most packages work, as long as they don't have C binaries that need to be compiled first - OpenWRT doesn't have a gcc compiler pre-installed.

You can even download and install pip from pypi, and it seems to work fine, except for the fact that the pypi repos are ssl-protected, and with OpenWRT not having SSL support, pip fails to fetch anything.

SSL isn't totally essential for what I'm trying to do, but my 493 should have plenty of hard drive space for it (about 70MB free - I would think it would fit), so it would be nice to have. Unfortunately, as far as I can tell, the only way to get it working is to use the toolchain to cross-compile ssl binaries on a different system, and move them to OpenWRT, unless someone out there is nice enough to do this and put them online. I haven't tried this yet - maybe I will at some point.

Essentially, what this lets you do is install any packages from github or pypi that are pure python. If you need to do mikrotik discovery using MNDP, or talk to a mikrotik using mac telnet, have a look at https://github.com/pjoe/py-mactelnet. Its MNDP script is pure python, and works great. It's mac-telnet script uses netifaces, which is a C module, making it not work out of the box, but as far as I can tell, the only thing netifaces does is make it easier for the mac-telnet script to grab the MAC and IP of the interfaces on OpenWRT, which can be done without netifaces, so it probably wouldn't take much effort to remove the dependency on netifaces.

If this is interesting to anyone, but they're having trouble following my rushed explanation, let me know, and I'll try to clarify.
 
nicolino
just joined
Posts: 11
Joined: Tue Dec 15, 2015 12:49 am

Re: Metarouter images

Thu Nov 01, 2018 1:48 am

Interesting, Talz... very!

I've been mostly playing around with the API via PHP annd externally only, but I like the idea of having my custom app "inside" the Routeros either to use python instead of embedded scripting or to develope some custom feature.

I follow you on the missing SSL libs, you can always start from scratch and build your own OpenWRT patching as instructed in the official metarouter documentation or using some of the modified patching scripts available on this thread for newer kernels. With that, you can get whatever openwrt packages you want pre-installed, all of them, or just build your own repo and be so nice to put it on the internet available for all the dums like me not being able to build a system on my own! :P (true story)
 
td32
Frequent Visitor
Frequent Visitor
Posts: 85
Joined: Fri Nov 18, 2016 5:55 am

Re: Metarouter images

Thu Nov 01, 2018 1:51 am

i think you can get the ssl packages directly from the openwrt website, available with each release
example
https://archive.openwrt.org/chaos_calmer/15.05/ar71xx/mikrotik/packages/
 
nicolino
just joined
Posts: 11
Joined: Tue Dec 15, 2015 12:49 am

Re: Metarouter images

Thu Nov 01, 2018 3:29 am

i think you can get the ssl packages directly from the openwrt website, available with each release
example
https://archive.openwrt.org/chaos_calmer/15.05/ar71xx/mikrotik/packages/

But would those work for the patched kernel? Also, how would you manage dependencies? Sorry about my ignorance, I'm most likely asking silly questions...
 
talz
newbie
Posts: 31
Joined: Wed Mar 15, 2017 9:01 pm

Re: Metarouter images

Thu Nov 01, 2018 6:06 pm

i think you can get the ssl packages directly from the openwrt website, available with each release
example
https://archive.openwrt.org/chaos_calmer/15.05/ar71xx/mikrotik/packages/

The release we are working with is Attitude Adjustment (12.09), so I guess the repo for that would be:

https://archive.openwrt.org/attitude_ad ... 09/ar71xx/

I don't see any SSL packages in that repo.
There are packages with the word "ssl" in the name, but those are just SSL modules for specific software, which I assume would all depend on a system ssl package that needs to be installed, which I can't find.

Edit: I think I found it. openssl-util_1.0.1e-1_ar71xx.ipk. I'm gonna give it a try.
Edit 2: opkg says "Packages for openssl-util found, but incompatible with the architectures configured"

What's the relation between MIPS, and AR71xx?
We use a lot of devices like 493s, 751s, 750s, 912s, and 52HPn grooves, all of which are MIPSBE.
If we need to use gcc to compile binaries, do they need to be AR71xx? MIPS? MIPSBE?

Almost all software I write is for regular x86_64, so I don't usually have to deal with different CPU architectures.

It looks like the RB493AH has an AR7161 CPU, which I guess falls within AR71xx.
What's an architecture? A CPU can have more than one architecture? It sounds like it, since the repo is for AR71xx, but it is complaining that the architecture doesn't match.
 
td32
Frequent Visitor
Frequent Visitor
Posts: 85
Joined: Fri Nov 18, 2016 5:55 am

Re: Metarouter images

Thu Nov 01, 2018 9:15 pm

what about this
http://openwrt.wk.cz/trunk/mr-mips/packages/openssl-util_1.0.1-1_mr-mips.ipk
 
talz
newbie
Posts: 31
Joined: Wed Mar 15, 2017 9:01 pm

Re: Metarouter images

Thu Nov 01, 2018 10:29 pm

Bloody safari!

I did a search in my safari browser on that page for ssl. Turns out it only showed me words that started with ssl! Anything separated by a - or a _ was considered a new word, so it found some ssl packages, but not the main openssl package!

I totally missed it.

Trying it now. It installs fine with opkg, assuming you grab its dependencies as well:
opkg install libopenssl_1.0.1-1_mr-mips.ipk openssl-util_1.0.1-1_mr-mips.ipk zlib_1.2.5-1_mr-mips.ipk

Initially, wget still couldn't download https stuff, but that's probably because by default, that openwrt image comes with wget-nossl.
Installing the regular wget from that same repo fixed the issue, and wget works fine with https now.

Unfortunately, it doesn't appear that this fixes Python's inability to use ssl. Doing "import ssl" complains about a missing _ssl module. My iMac has a _ssl.so file that lets it import "_ssl", but I can't copy it over since that's compiled for a different architecture. Maybe one of the other packages has this. I'll look around some more.
 
moham96
just joined
Posts: 23
Joined: Thu Dec 21, 2017 3:08 pm

Re: Metarouter images

Mon Mar 18, 2019 8:03 pm

Hi,
why doesn't mikrotik push their changes to mainline linux and official openwrt instead of releasing a patch for each version ? I hope Mikrotik engineers can provide us with an answer.
this will ensure that the metarouter will always be supported,and maintained by linux kernel experts, all bugs will be ironed and fixed upstream.
sending patches to mainline linux is a bit of a long process but it's well worth it.

Regards
 
User avatar
flaviojunior
Trainer
Trainer
Posts: 19
Joined: Thu Nov 17, 2016 6:27 pm
Location: Brazil
Contact:

Re: Metarouter images

Wed Mar 20, 2019 3:12 pm

Any news about update MetaRouter on RouterOS?
It's a very good feature that we can you to use Zabbix, PRTG........... and another thousands features all in one.
I used QoS Reflector on PRTG, it's a script on python running on a linux that reflect UDP packages from PRTG and with it he calculate the Quality of the Link.
But to install Python on a OpenWRT I can run the image on a 750 router because of the size, the only router today that could do it is 2011. Now we are using small PCs to use the QoS Reflector on our clients, but I want to use again RouterOS MetaRouter for it.
Points:
Make all routers ARM, MMIPS and Tile work with MetaRouter (All hEX, 3011, 4011, 1100AHx4, CCRs)
And put the Image on a external drive (USB, SDCard...)

Maybe:
Create a way to clone the running image
Replication on diferent routers to make HA

Will be a new product of mikrotik, Virtualization HA.
Mikrotik Certified Trainer, Network Specialist.
Number 1 consultant Brazil, Rio de Janeiro
MTCNA, MTCRE, MTCWE, MTCTCE, MTCUME, MTCIPv6E, MTCINE, MTCSE
  • 1
  • 4
  • 5
  • 6
  • 7
  • 8

Who is online

Users browsing this forum: No registered users and 3 guests