Hi Tom, Thanks for the link, Will have a look at it in morning and see how to pop it in the mikrotik and see if it plays ball
Cheers, Kevin 2E0LSR /P
Sent from Somewhere Rural with limited Cell Coverage! Try HF or VHF/UHF better chances!
<div>-------- Original message --------</div><div>From: Tom Hayward esarfl@gmail.com </div><div>Date:26/03/2015 18:10 (GMT+00:00) </div><div>To: AMPRNet working group 44net@hamradio.ucsd.edu </div><div>Subject: Re: [44net] Gateways </div><div> </div>(Please trim inclusions from previous messages) _______________________________________________ Thu, Mar 26, 2015 at 11:03 AM, Kevin kevin@sidx.org.uk wrote:
I just need to know now what needs to be setup on my router which can then send out the RIP advertisement to the Internet and announce the Subnets that Im using MikroTik hardware which is based on the same logic and routabilities as Cisco hardware
You might try my script: https://github.com/kd7lxl/python-amprapi/#updaterospy
updateros.py reads the list of gateways and routes from the AMPR API and translates that to Mikrotik commands. It simply automates the creation and destructions of IPIP interfaces and static routes. I run it against our routers via cron hourly on my desktop. It is not capable of rip44.
Tom KD7LXL _________________________________________ 44Net mailing list 44Net@hamradio.ucsd.edu http://hamradio.ucsd.edu/mailman/listinfo/44net
On Thu, Mar 26, 2015 at 11:23 AM, Kevin kevin@sidx.org.uk wrote:
(Please trim inclusions from previous messages) _______________________________________________ Hi Tom, Thanks for the link, Will have a look at it in morning and see how to pop it in the mikrotik and see if it plays ball
It runs via SSH, not something you "pop in the Mikrotik." You can run it with -n -v to see what commands it will issue without committing anything.
Tom KD7LXL
Hi Tom,
I¹m now looking at the link you sent in more detail, If I¹m honest, I didn¹t realise that MikroTik had python in its OS - python coding is not something I¹m as familiar with,
I know this may be a pain, but could you explain a little bit on how to add these files into the back end and is there anything I need to edit in the files (I know the settings.py need changing with my api details from the portal) perhaps if its not too much trouble a bit of a walkthough?
Regards,
Kevin 2E0LSR (M6EMT) / MS0SIA Consultant Wireless & Netwokring Engineer MTCNA, MTCRE, MTCINE, UCWA, UEWA, CompTIA A+
On 26/03/2015 18:26, "Tom Hayward" esarfl@gmail.com wrote:
(Please trim inclusions from previous messages) _______________________________________________ On Thu, Mar 26, 2015 at 11:23 AM, Kevin kevin@sidx.org.uk wrote:
(Please trim inclusions from previous messages) _______________________________________________ Hi Tom, Thanks for the link, Will have a look at it in morning and see how to pop it in the mikrotik and see if it plays ball
It runs via SSH, not something you "pop in the Mikrotik." You can run it with -n -v to see what commands it will issue without committing anything.
Tom KD7LXL _________________________________________ 44Net mailing list 44Net@hamradio.ucsd.edu http://hamradio.ucsd.edu/mailman/listinfo/44net
On Mar 27, 2015 1:54 AM, "Kevin" kevin@sidx.org.uk wrote:
I¹m now looking at the link you sent in more detail, If I¹m honest, I didn¹t realise that MikroTik had python in its OS - python coding is not something I¹m as familiar with,
Mikrotik does not have Python in their OS. I found no way to process data from a JSON API with Mikrotik scripting language, so this was designed to run on a separate computer with Python.
I run it on my workstation. This is the same workstation I use to configure the router manually, so it already has the required private DSA key to log in to the router. This allows me to run the script via cron without having to enter a password.
If you want a contained solution with no computers other than the router, you could install an OpenWRT MetaRouter on your Mikrotik and run the Python script in that. At this point you could also just use rip44d on OpenWRT to manage the AMPR tunnels. I have not tried this.
I know this may be a pain, but could you explain a little bit on how to add these files into the back end and is there anything I need to edit in the files (I know the settings.py need changing with my api details from the portal) perhaps if its not too much trouble a bit of a walkthough?
First, create an API key at https://portal.ampr.org/profile.php
These steps should work for Ubuntu/Debian: sudo apt-get install git-core python git clone https://github.com/kd7lxl/python-amprapi.git cd python-amprapi vi settings.py # enter your AMPR username and API key :wq ./updateros.py -v -n 192.168.1.1 # substitute your router IP
This will print the list of Mikrotik commands that are needed to add the AMPR tunnels to your router. If you run it again without -n, these commands will be sent to your router via SSH.
It may take a long time to run the first time. The script does not invoke a shell in SSH, so each command (about 1500 of them, for 500 routes) is sent independently. You can cancel and restart without any harm. It'll pick up where it left off last time.
Subsequent runs only execute a diff, so they will be very fast (unless some catastrophe causes hundreds of AMPR gateways to be removed from the portal).
Here's the actual line from my crontab that runs it on my router: 3 * * * * /home/tom/src/python-amprapi/updateros.py 44.24.221.1
Hope that helps.
Tom KD7LXL
Hello Tom et al.
On my Debian 7.7.0 I see this error:
root@deb:/opt/python-amprapi# ./updateros.py -v -n 192.168.0.102 Traceback (most recent call last): File "./updateros.py", line 20, in <module> import amprapi File "/opt/python-amprapi/amprapi.py", line 22, in <module> import requests ImportError: No module named requests root@deb:/opt/python-amprapi#
Something is missing evidently... According to portal.ampr.org API's info the endpoint sould have name "encap".
Best regards.
On Fri, Mar 27, 2015 at 9:39 AM, Tomasz SP2L SP2L@wp.pl wrote:
ImportError: No module named requests
That's an easy one, just a missed dependency:
sudo apt-get install python-requests
I'll add that to the readme.
Tom KD7LXL
Hello Tom et al.
Apparently there is something more missing:
root@deb:/opt/python-amprapi# ./updateros.py -v -n 192.168.0.102 Traceback (most recent call last): File "./updateros.py", line 180, in <module> main() File "./updateros.py", line 110, in main encap = filter(None, map(filter_encap, get_encap())) File "./updateros.py", line 41, in get_encap ampr = amprapi.AMPRAPI() File "/opt/python-amprapi/amprapi.py", line 72, in __init__ self.enforce_version() File "/opt/python-amprapi/amprapi.py", line 78, in enforce_version if not self.check_version(): File "/opt/python-amprapi/amprapi.py", line 75, in check_version return self._api_version_minor == self.get('version')['version'] File "/opt/python-amprapi/amprapi.py", line 87, in get return json.loads(r.json()) TypeError: 'unicode' object is not callable root@deb:/opt/python-amprapi#
I have unicode installed... What else?
Best regards.
On Fri, Mar 27, 2015 at 10:53 AM, Tom SP2L SP2L@wp.pl wrote:
File "/opt/python-amprapi/amprapi.py", line 87, in get return json.loads(r.json()) TypeError: 'unicode' object is not callable
The version of python-requests in Wheezy is too old and incompatible. (I'm sure you have this problem often running Debian stable.)
You can get a more up-to-date version using Python's package manager, pip, instead of the OS package manager. Something like this...
sudo apt-get remove python-requests sudo pip install requests
If you don't want pip to install it system-wide, you can use virtualenv. I'll let you Google that on your own, as it's a special case.
Tom KD7LXL
Hello Tom.
Many thanks for all info regarding Python and all suggestions as well.
Best regards.
On 27/03/15 19:15, Tom Hayward wrote:
If you don't want pip to install it system-wide, you can use virtualenv.
Hello Tom et al.
virtualenv was perfect suggestion, Hi!
Now with Python 2.7 I started to play...
Due to some errors, needed to install paramiko, pycrypto, ecdsa and bunch of dependent modules.
Then eventually amprapi.py did it's job nicely.
Best regards.
Hi,
Using metarouter is a bit tricky, since OpenWRT is not quite stable in the metarouter. And it works only on mipsbe (and single core PPC, but that's history), so no CCR or RB100AHx2.
So best try to use Toms method if it is satisfactory.
Another variant would be to add a Raspberry Pi or a Alixboard or some other small factor device (instead of the metarouter) as an encapsulator/decapsulator and inject the RIPv2 data into the router, for a fully automatic setup (a device with a single ethernet interface will suffice).
Marius, YO2LOJ
-----Original Message----- From: 44net-bounces+marius=yo2loj.ro@hamradio.ucsd.edu [mailto:44net-bounces+marius=yo2loj.ro@hamradio.ucsd.edu] On Behalf Of Tom Hayward Sent: Friday, March 27, 2015 17:58 To: AMPRNet working group Subject: Re: [44net] Gateways
...
If you want a contained solution with no computers other than the router, you could install an OpenWRT MetaRouter on your Mikrotik and run the Python script in that. At this point you could also just use rip44d on OpenWRT to manage the AMPR tunnels. I have not tried this.
...