## ## Automatically upgrade RouterOS and Firmware ## https://github.com/massimo-filippi/mikrotik ## ## script by Maxim Krusina, maxim@mfcc.cz ## based on: http://wiki.mikrotik.com/wiki/Manual:Upgrading_RouterOS ## created: 2014-12-05 ## updated: 2015-12-09 ## tested on: RouterOS 6.33.1 / multiple HW devices, won't work on 6.27 and older (different update process & value naming) ## ########## Set variables ## Notification e-mail :local email "your@email.com" ########## Do the stuff ## Check for update /system package update set channel=current check-for-updates ## Waint on slow connections :delay 15s; ## Important note: "installed-version" was "current-version" on older Roter OSes :if ([get installed-version] != [get latest-version]) do={ ## New version of RouterOS available, let's upgrade /tool e-mail send to="$email" subject="Upgrading RouterOS on router $[/system identity get name]" body="Upgrading RouterOS on router $[/system identity get name] from $[/system package update get installed-version] to $[/system package update get latest-version] (channel:$[/system package update get channel])" :log info ("Upgrading RouterOS on router $[/system identity get name] from $[/system package update get installed-version] to $[/system package update get latest-version] (channel:$[/system package update get channel])") ## Wait for mail to be send & upgrade :delay 15s; ## "install" command is reincarnation of the "upgrade" command - doing exactly the same but under a different name install } else={ ## RouterOS latest, let's check for updated firmware :log info ("No RouterOS upgrade found, checking for HW upgrade...") /system routerboard :if ( [get current-firmware] != [get upgrade-firmware]) do={ ## New version of firmware available, let's upgrade /tool e-mail send to="$email" subject="Upgrading firmware on router $[/system identity get name]" body="Upgrading firmware on router $[/system identity get name] from $[/system routerboard get current-firmware] to $[/system routerboard get upgrade-firmware]" :log info ("Upgrading firmware on router $[/system identity get name] from $[/system routerboard get current-firmware] to $[/system routerboard get upgrade-firmware]") ## Wait for mail to be send & upgrade :delay 15s; upgrade ## Wait for upgrade, then reboot :delay 180s; /system reboot } else={ :log info ("No Router HW upgrade found") } }
Do you play online games? Of course you do. Have you experienced lag? Very likely. No matter how fast your internet connection is, if another program or person on your network competes for bandwidth, the packets will be processed at the same priority, resulting in increased latency (or worse, packet loss) for your game or other interactive applications. Whether you share an internet connection with roommates or operate a gaming house, LAN center, etc, this can quickly become a problem. Thankfully there's a cheap and relatively easy way to solve this in the form of a decent router - the Mikrotik RouterBOARD. Many people are familiar with the trouble consumer grade routers can cause. It's not a surprise that the number one go to troubleshooting technique is a simple reboot - consumer routers are designed to be low price and thus operate on cheap hardware with limited memory which can easily cause problems. From NAT table overflows to DHCP server crashes, your