Tag: script
18 articles
Scriptlet: Bulk VPN connections on MikroTik with connection rate limiting
During my day job we use some MikroTik CHR deployments for (among other things) VPN session termination. The CHR’s are easy to spin up, offer a wide variety of VPN types, and for low traffic sessions can support upwards of 10,000 sessions on a single device. In the event of an outage though, you would … Continue reading Scriptlet: Bulk VPN connections on MikroTik with connection rate limiting
Scriptlet: Halt MikroTik scheduled scripts if multiple instances are detected.
The following script can be run in terminal (or via any automation tool that can login to your MikroTik devices via SSH) and checks for any duplicate script ‘jobs’ and kills them. I wrote this after noticing a few of my scripts that use fetch would hang periodically and leave multiple jobs open. #kill duplicate … Continue reading Scriptlet: Halt MikroTik scheduled scripts if multiple instances are detected.
Scriptlet: Find Default Route Interface Names (and a free licence!)
Today I’m giving you the task of reviewing and improving a small script I’ve written, and one of you will win a free Level 4 RouterOS licence. Background: I had need of a script to find the interfaces associated with any default routes in order to create matching firewall entries, and it had to work … Continue reading Scriptlet: Find Default Route Interface Names (and a free licence!)
Queue Tree Mikrotik to limit total bandwidth
Hi Guys, today i’ll show you how to manage the Mikrotik Queue Tree to limit the total bandwidth (for. example you can split a 20Mbps DSL to 4Mbps per 5 users) In my example i’ll limit upload+download=20Mbps First of all we need to mark the packets to be traced in the queue: /ip firewall mangle … Continue reading Queue Tree Mikrotik to limit total bandwidth
MikroTik Scripting: Failover Routing for Asterisk PBX
Hi guys, This is my second article and I wanted to raise the difficulty level of my tutorials! We work a lot with Asterisk PBX and MikroTik and we’ve encountered a problem when we have 2 internet connection with a MikroTik using WAN failover, our Asterisk PBX would stop working when the primary connections fail; … Continue reading MikroTik Scripting: Failover Routing for Asterisk PBX
Mikrotik Script: Alert on queue tree limit exceeded
Hi guys, This is my first post here, I’m a Network Engineer who works a lot with Mikrotik devices and Server Administration and you can see more of my posts on my website. I found this blog some time ago and was invited to contribute with some of my own scripts that may help others! Today i’ll show … Continue reading Mikrotik Script: Alert on queue tree limit exceeded
The Mother of all QoS Trees – v6.0
Contained in this post is a free copy of my 2013 QoS tree (compatible with v6.0) for anyone to do what they want with, I only ask that if you republish this you include a link to this post. It is intended to work on a per-interface basis; with you specifying the WAN interface and … Continue reading The Mother of all QoS Trees – v6.0
Gmail + Google Drive + MikroTik scripting = Automated Backups Folder
I was recently looking for a simpler alternative to something like RANCID to periodically backup all our MikroTik configs. RANCID is great and all, but I didn’t really need the diff copies of each file, and I was plenty happy just knowing that I have a .backup and .rsc file for each router I manage. … Continue reading Gmail + Google Drive + MikroTik scripting = Automated Backups Folder
Check utilisation of RouterOS IP Pools
I was looking for a way to do a quick summary of the utilisation of my DHCP/PPP pools and stumbled across a helpful little script. This was originally found on the MikroTik forums and posted back in 2010 written by dssmiktik, and surprisingly enough it works perfectly on even v6.0 with no changes required.
Script Fu – Changing RADIUS server source address
Just a quick post to show an example of day to day usage of RouterOS scripting. Goal: We had to change the src-address for a bunch of radius-server listings across 40 MikroTik devices, to match a new pptp-tunnel address. What would’ve been a pain was that the address is different on each device. Solution: Create … Continue reading Script Fu – Changing RADIUS server source address
Add a data limit to trial hotspot users
This script comes from the final slide of my recent MUM presentation on RouterOS scripting It allows you to assign a data limit to trial hotspot users and: a) have them kicked offline upon reaching this limit b) create a temporary user to stop them from being able to log back in again This is … Continue reading Add a data limit to trial hotspot users
Scriplet: Grabbing PPPoE IP Address
A quick scriptlet I whipped up for a friend tonight to allow them to retrieve an IP addess from a specific PPPoE interface. Handy for updating DynDNS entries among other things. :local wanip [/ip address get [/ip address find where interface=pppoe-wan] address]; :set wanip [:pick $wanip 0 ([:len $wanip]-3) ]; #whatever you want to do … Continue reading Scriplet: Grabbing PPPoE IP Address
Improved Netwatch-style script.
There have been a number of improved netwatch scripts listed on the mikrotik wiki in the past however many of these are hard to understand, broken or both. I had a request from an associate to assist them finding a solution to fall over VPN traffic from one link to another in the event of … Continue reading Improved Netwatch-style script.
Adding automatic rate limits to user-manager accounts.
This has been mentioned and posted in a couple of places now however I’d like to post a copy here also in the event that anyone else has further suggestions on improvements for the script, or any further questions. Although I don’t use it much myself, many Mikrotik users would be familiar with the “user-manager” … Continue reading Adding automatic rate limits to user-manager accounts.
Simple RouterOS http load/bandwidth tester
Disclaimer: I am not responsible for what you choose to do with this script and/or what damage you incur. It uses features of RouterOS in ways I have to assume they were not intended so user beware. I wrote a little script today that allows very simple load/bandwidth testing. Some suggested uses: – basic testing … Continue reading Simple RouterOS http load/bandwidth tester
IPv6 and Mikrotik – Using 6to4
Please note this guide assumes some basic knowledge of IPv4 and IPv6 address space. Many of you may know of the impending doom that surrounds the IPv4 network and lack of remaining IP ranges. The question is, how many people are actually doing anything about it? Given the slow take up worldwide I thought it … Continue reading IPv6 and Mikrotik – Using 6to4
Freebies in SA (or How to download IP address lists to a Mikrotik)
In the state of Australia I currently live in, there are 2 major ISP’s – Internode and Adam Internet. Being a typical nerd and living with other typical nerds we of course have 2 ADSL connections, 1 to each of these providers which are shared out amongst the house. However each of these providers have … Continue reading Freebies in SA (or How to download IP address lists to a Mikrotik)
Mikrotik Hotspot Authentication for IPv6 dual-stacked clients
In preparation for some IPv6 testing of our hotspot systems, I’ve come up with the following temporary authentication method for dual-stacked users. Seeing as the login redirect goes via an IPv4 webserver, if enabled IPv6 traffic passes by the hotspot unhindered. This is my work on enabling the IPv6 side of things when a user … Continue reading Mikrotik Hotspot Authentication for IPv6 dual-stacked clients