Mikrotik Router Programming – How .CONNECT dominated the ISP market

Jun 17th, 2013 | by Tope Olutola

I first came across Mikrotik out of pain and necessity. I was a young field engineer working to deploy internet access to remote areas of Nigeria. Those days, there was no fiber or reliable internet service; infact if you could browse successfully at a cybercafe, it was a miracle. Then, I had just returned to the country and was excited to build an ISP network to get internet to homes and offices.

I initially brought in some Cisco and Proxim radios. Those radios and routers as revered as they are in the other climes, failed often in Nigeria.  Most of the time, the outdoor radios failed within 3 months of deployment. What was causing this? Heat? Moisture? Poor configurations? No one knew.

Then one day I was told about a new and rugged router system called Mikrotik. I actually initially rejected the idea because it wasn’t as popular as the other ones. Soon I picked up the book and started reading. I read the manual from beginning to the end and then read some more. From there I encouraged my engineers to deploy a pilot to act as a learning tool.

Being a programmer, I quickly enjoyed the fact that I could write scripts which Mikrotik will consume and execute on. Wao, what a world of opportunities it opened. I quickly realized I could deploy many Mikrotik Routers to multiple locations and then control from one central location. During that time, we had remote offices where we transmitted and clients subscribed. Each remote office had a business manager as well as an engineer. Clients had to pay at the office after which an engineer had to then set the router to give time.

However this was a major challenge. Why? Remember, in Nigeria, corruption is very rife. Allowing an engineer or manager to manually input or create time for the clients often was an avenue for errors and fraud. I needed a solution fast. Figuring out how to track money and automatically create time on the local routers was a challenge. I didn’t want anyone, not even the engineers to directly manipulate the routers.

Solution:

Using ColdFusion, I was able to create a system to load client information and financial information. This then translated to a FTP protocol which then transmitted to the router IP addresses. Once the FTP file is received by the router, it then processes the file with instructions to update client time on the router. This solved our organization’s problem completely reducing fraud by as much as 90%.

Let me share with you some of the scripts and explain what it does:

mikrotikscipt 2

 

The above code does the following:

1: Gets the router ip from a database. Imagine a telecommunications company with multiple radios and repeaters. Saving router info (IP, MAC etc) to a database is the best.

2. Dynamically write the script and set it into a local variable.

This script

  <cfset mikidx =’/ip hotspot user reset #getcname.mikid#; /ip hotspot user set #getcname.mikid# limit-uptime=#ceiling(timelimit)#;/ip hotspot user enable #getcname.mikid#;/ip hotspot ip-binding enable [find mac-address=”#ucase(getplan.emac)#”];’>

first resets the user information, then updates the time to browse while ensuring the user is also allowed to browse on the router.

3. The CFFTP (ColdFusion File Transfer Protocol) now sends the dynamically written script to the router ip . Simply powerful!!!

4. This leads us to the information that is saved on the router  shown below.

mikrotikscipt

 

 

5. This data on the router is saved on the router just the same way you save info on your phone. This leads us to the next step

6. Finding the file and then executing it. To find the file, you look for it by the name of the saved file name. The easiest thing here is to ensure the saved name is always the same so a “Job” can be created to automate the process.

And thats it. Once you have a programming skill, you can easily communicate with any router or machine via the FTP protocol.
This simple tool, allowed ETN.CONNECT to not only quickly conquer the ISP market in the region but also remain a dominant force today.

ETN.CONNECT can help your organization design and deploy a unified communications solution with highest level of simplicity and ease of use.

Contact a relationship officer today .