<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mikrotik &#8211; Farlock.org</title>
	<atom:link href="https://www.farlock.org/category/mikrotik/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.farlock.org</link>
	<description>What you want to hack today?</description>
	<lastBuildDate>Fri, 21 Oct 2016 09:59:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
	<item>
		<title>Backup and restore Mikrotik MetaRouter Openwrt Image</title>
		<link>https://www.farlock.org/openwrt-generic/backup-and-restore-mikrotik-metarouter-openwrt-image/</link>
					<comments>https://www.farlock.org/openwrt-generic/backup-and-restore-mikrotik-metarouter-openwrt-image/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 21 Oct 2016 09:59:05 +0000</pubDate>
				<category><![CDATA[Mikrotik]]></category>
		<category><![CDATA[OpenWrt Generic]]></category>
		<guid isPermaLink="false">http://www.farlock.org/?p=282</guid>

					<description><![CDATA[On original metarouter: cd / echo &#8220; ./tmp/* ./proc/* ./sys/*&#8221; &#62; /tmp/exclude.list tar zcvf /tmp/newimage.tgz -X /tmp/exclude.list . On original Mikrotik: /metarouter export Start the new metarouter with the SAME original image when it is booted, login to it and copy the /tmp/newimage.tgz from the original one: scp original_metarouter:/tmp/newimage.tgz /tmp and restore it: cd / [...]]]></description>
										<content:encoded><![CDATA[<div>On original metarouter:</div>
<blockquote>
<div>cd /</div>
<div>echo &#8220;</div>
<div>./tmp/*</div>
<div>./proc/*</div>
<div>./sys/*&#8221; &gt; /tmp/exclude.list</div>
<div>tar zcvf /tmp/newimage.tgz -X /tmp/exclude.list  .</div>
</blockquote>
<div></div>
<div>On original Mikrotik:</div>
<blockquote>
<div>/metarouter export</div>
</blockquote>
<div></div>
<div>Start the new metarouter with the SAME original image</div>
<div>when it is booted, login to it and copy the /tmp/newimage.tgz from the original one:</div>
<blockquote>
<div>scp original_metarouter:/tmp/newimage.tgz /tmp</div>
</blockquote>
<div></div>
<div>and restore it:</div>
<blockquote>
<div>cd /</div>
<div>tar xzvf /tmp/newimage.tgz</div>
</blockquote>
<div></div>
<div>On mikrotik host import the virtual interface configuration previously exported.</div>
<div></div>
<div>Reboot the metarouter</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.farlock.org/openwrt-generic/backup-and-restore-mikrotik-metarouter-openwrt-image/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mikrotik &#8211; Load Balancer and Failover (and traffic prioritization)</title>
		<link>https://www.farlock.org/mikrotik/mikrotik-load-balancer-and-failover-and-traffic-prioritization/</link>
					<comments>https://www.farlock.org/mikrotik/mikrotik-load-balancer-and-failover-and-traffic-prioritization/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 21 Oct 2016 09:45:58 +0000</pubDate>
				<category><![CDATA[Mikrotik]]></category>
		<guid isPermaLink="false">http://www.farlock.org/?p=253</guid>

					<description><![CDATA[<p>Searching far and wide on the web looking for a solution to my problem (have a mikrotik router that do load balance and failover), I came to the conclusion that a complete solution doesn&#8217;t exist.</p> <p>So I started taking all the scripts and docs found and putting them together&#8230;. The result is a working system [...]]]></description>
										<content:encoded><![CDATA[<p>Searching far and wide on the web looking for a solution to my problem (have a mikrotik router that do load balance and failover), I came to the conclusion that a complete solution doesn&#8217;t exist.</p>
<p>So I started taking all the scripts and docs found and putting them together&#8230;. The result is a working system that actually I use on some location&#8230;. Obviously is not  perfect, it needs improvement and better documentation <img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>I share it, so anyone can use it and refine it, please send it back to me or in the mikrotik wiki!</p>
<p>The code is divided in two parts:</p>
<ul>
<li>A script run every X minutes that check wan connections</li>
<li>Command that you need to write in terminal of your firewall to make it working</li>
</ul>
<p><strong>Let&#8217;s start from the script, please read it carefully!</strong></p>
<p>Open winbox and go to System-&gt;Scripts, create a new one and name it &#8220;Failover&#8221;, copy this content inside it.</p>
<blockquote style="border: 1px solid black; overflow: auto; height: 200px;"><p># &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- header &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
# Script improved to check two different hosts and act with PCC Load Balancer<br />
# (Original Script by Tomas Kirnak)<br />
# If you edit this script, please share it with the community!<br />
# Author: Denis Barbazza (denis . barbazza [at] gmail . com)<br />
# VERSION=2.3<br />
# <a href="http://www.farlock.org/mikrotik/mikrotik-load-balancer-and-failover-and-traffic-prioritization/">http://www.farlock.org/mikrotik/mikrotik-load-balancer-and-failover-and-traffic-prioritization/</a><br />
# ChangeLog<br />
# 2.3 &#8211; 21/10/16 &#8211; Bugfix, when main ISP comes back we close alle the connection on ISP2, not clean but necessary because of some connections not tracked (udp, needs more testing)<br />
# we leave this feature commented out, needs testing.<br />
# we close also connections from outside to lan, sometimes internal initated connection takes this mark, needs testing<br />
# 2.2 &#8211; 11/05/16 &#8211; If one connection hangs, drop connection on it (udp and tcp), when main connection<br />
# fails or comes back we reset also connections without mark (these because of the default route weight)<br />
# 2.1 &#8211; 17/03/16 &#8211; Improved ping check based on script made by Gregory Sloop (gregs @ sloop.net)<br />
# 2.0 &#8211; 01/03/16 &#8211; now we manage also the rule used with PCC load balancer<br />
# 1.5 &#8211; 01/12/15 &#8211; Check two different hosts, just to be sure<br />
# 1.0.7 &#8211; Original Script by Tomas Kirnak (t.kirnak @ atris.sk)</p>
<p># The script in case of a faulting link increase the default route<br />
# and disable the marking rule based on PCC that it found on mangle/prerouting chain<br />
#<br />
# Use ips for ping target, the script may not work with fqdn<br />
#<br />
# if you want you can disable every marking rule, and not only PCC, simply editing the four line that search for rule to be disabled:<br />
# :foreach i in=[/ip firewall mangle find chain=prerouting &amp;&amp; new-connection-mark=$ConnMarkISP1 &amp;&amp; (per-connection-classifier).&#8221;&#8221; != &#8220;&#8221;] do=\<br />
# and remove the part of PCC value:<br />
# :foreach i in=[/ip firewall mangle find chain=prerouting &amp;&amp; new-connection-mark=$ConnMarkISP1 ] do=\<br />
# REMEMBER: you must edit the rule in 4 places (enable/disable ISP1 and enable/diable ISP2)<br />
#<br />
# Search in script rule starting with &#8220;### OPTIONAL&#8221;, here you can enable or disable some features,<br />
# based on your needs.<br />
#<br />
# For more information and details about<br />
# this script please visit the wiki page at<br />
# <a href="http://wiki.mikrotik.com/wiki/Failover_Scripting" target="_blank">http://wiki.mikrotik.com/wiki/Failover_Scripting</a><br />
# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- header &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p># &#8212;&#8212;&#8212;&#8212;- start editing here &#8212;&#8212;&#8212;&#8212;-<br />
# Edit the variables below to suit your needs</p>
<p># Please fill the WAN interface names<br />
:local InterfaceISP1 ISP_1<br />
:local InterfaceISP2 ISP_2</p>
<p># Please fill the gateway IPs (or interface names in case of PPP)<br />
:local GatewayISP1 10.39.1.14<br />
:local GatewayISP2 172.31.29.1</p>
<p># Routing mark of each interface<br />
:local RoutingMarkISP1 ISP1_Route<br />
:local RoutingMarkISP2 ISP2_Route</p>
<p># Connection mark of each interface<br />
:local ConnMarkISP1 to_ISP1<br />
:local ConnMarkISP2 to_ISP2</p>
<p># Connection mark of each interface, from outside to local network<br />
:local ConnMarkISP1_LAN from_ISP1_to_LAN<br />
:local ConnMarkISP2_LAN from_ISP2_to_LAN</p>
<p># Please fill the ping check host &#8211; currently: resolver1.opendns.com<br />
:local PingTarget1 208.67.222.222<br />
# Second ping check host &#8211; currently google secondary DNS<br />
:local PingTarget2 8.8.4.4</p>
<p># This can be used to make sure that the RTT is above this threshold. Ping replies that take longer than<br />
# this to return will be counted as no reply. Adapt it to your lines<br />
:local PingInterval 500ms;<br />
# How many pings to send for our test<br />
:local PingCount 5;<br />
# Size of the pick packets [Don&#8217;t make them too large.]<br />
:local PingSize 28;<br />
# How many pings minimum must we get back to consider the pipe &#8220;up&#8221; &#8211; fewer than this &#8211; consider it down.<br />
# This is for the single check! So we send PingCount packet and we must receive at least PingReturnThreshold<br />
# to consider the line up<br />
:local PingReturnThreshold 2;</p>
<p># Please fill how many times the check can fail before fail-over happens,<br />
# In may case I run the script once every 10 minute, so one is enough<br />
# Or you can run it once a minute so increase it<br />
:local FailTreshold 3</p>
<p># Define the distance increase of a route when it fails<br />
:local DistanceIncrease 20</p>
<p># Editing the script after this point may break it<br />
# &#8212;&#8212;&#8212;&#8212;&#8211; stop editing here &#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p># Declare the global variables<br />
:global PingFailCountISP1<br />
:global PingFailCountISP2</p>
<p># This inicializes the PingFailCount variables, in case this is the 1st time the script has ran<br />
:if ([:typeof $PingFailCountISP1] = &#8220;nothing&#8221;) do={:set PingFailCountISP1 0}<br />
:if ([:typeof $PingFailCountISP2] = &#8220;nothing&#8221;) do={:set PingFailCountISP2 0}</p>
<p># These variables will be used to keep results of individual ping attempts<br />
:local PingResult1<br />
:local PingResult2</p>
<p># Check ISP1<br />
# :set PingResult1 [ping $PingTarget1 count=1 interface=$InterfaceISP1 routing-table=$RoutingMarkISP1]<br />
:set PingResult1 [/ping $PingTarget1 interface=$InterfaceISP1 routing-table=$RoutingMarkISP1 interval=$PingInterval count=$PingCount size=$PingSize];<br />
#:put $PingResult1<br />
# :set PingResult2 [ping $PingTarget2 count=1 interface=$InterfaceISP1 routing-table=$RoutingMarkISP1]<br />
:set PingResult2 [/ping $PingTarget2 interface=$InterfaceISP1 routing-table=$RoutingMarkISP1 interval=$PingInterval count=$PingCount size=$PingSize];<br />
#:put $PingResult2<br />
# If both fails we consider router down<br />
:if (($PingResult1 &lt; $PingReturnThreshold) &amp;&amp; ($PingResult2 &lt; $PingReturnThreshold)) do={<br />
:if ($PingFailCountISP1 &lt; ($FailTreshold+2)) do={<br />
:set PingFailCountISP1 ($PingFailCountISP1 + 1)</p>
<p>:if ($PingFailCountISP1 = $FailTreshold) do={<br />
:log warning &#8220;ISP1 has a problem en route to $PingTarget1 or $PingTarget2 &#8211; increasing distance of routes.&#8221;<br />
:foreach i in=[/ip route find gateway=$GatewayISP1 &amp;&amp; static &amp;&amp; !routing-mark] do=\<br />
# {:log info &#8220;Increase distance route $i&#8221;}<br />
{/ip route set $i distance=([/ip route get $i distance] + $DistanceIncrease)}<br />
# Disable PCC rules<br />
:foreach i in=[/ip firewall mangle find chain=prerouting &amp;&amp; new-connection-mark=$ConnMarkISP1 &amp;&amp; (per-connection-classifier).&#8221;&#8221; != &#8220;&#8221;] do=\<br />
{/ip firewall mangle disable $i }<br />
### OPTIONAL &#8211; Disable all rule, not the only ones regarding PCC<br />
# :foreach i in=[/ip firewall mangle find chain=prerouting &amp;&amp; new-connection-mark=$ConnMarkISP1 ] do=\<br />
# {/ip firewall mangle disable $i }</p>
<p>:log warning &#8220;Route distance increase finished.&#8221;<br />
# close ISP1 connection<br />
foreach i in=[/ip firewall connection find connection-mark=$ConnMarkISP1] do= {/ip firewall connection remove $i }<br />
foreach i in=[/ip firewall connection find connection-mark=$ConnMarkISP1_LAN] do= {/ip firewall connection remove $i }<br />
# close connection without mark<br />
foreach i in=[/ip firewall connection find (connection-mark).&#8221;&#8221; = &#8220;&#8221; ] do= {/ip firewall connection remove $i }<br />
:log warning &#8220;Closed connection $ConnMarkISP1 , $ConnMarkISP1_LAN and without mark&#8221;<br />
}<br />
}<br />
}<br />
# If almost one is ok we consider the line up<br />
:if (($PingResult1 &gt; $PingReturnThreshold) || ($PingResult2 &gt; $PingReturnThreshold)) do={<br />
:if ($PingFailCountISP1 &gt; 0) do={<br />
:set PingFailCountISP1 ($PingFailCountISP1 &#8211; 1)</p>
<p>:if ($PingFailCountISP1 = ($FailTreshold -1)) do={<br />
:log warning &#8220;ISP1 can reach $PingTarget1 or $PingTarget2 again &#8211; bringing back original distance of routes.&#8221;<br />
:foreach i in=[/ip route find gateway=$GatewayISP1 &amp;&amp; static &amp;&amp; !routing-mark] do=\<br />
# {:log info &#8220;Decrease distance route $i&#8221;}<br />
{/ip route set $i distance=([/ip route get $i distance] &#8211; $DistanceIncrease)}<br />
# Reenable PCC rules<br />
:foreach i in=[/ip firewall mangle find chain=prerouting &amp;&amp; new-connection-mark=$ConnMarkISP1 &amp;&amp; (per-connection-classifier).&#8221;&#8221; != &#8220;&#8221;] do=\<br />
{/ip firewall mangle enable $i }<br />
### OPTIONAL &#8211; Enable all rule, not the only ones regarding PCC<br />
# :foreach i in=[/ip firewall mangle find chain=prerouting &amp;&amp; new-connection-mark=$ConnMarkISP1 ] do=\<br />
# {/ip firewall mangle enable $i }</p>
<p>:log warning &#8220;Route distance decrease finished.&#8221;<br />
# close connection without mark<br />
foreach i in=[/ip firewall connection find (connection-mark).&#8221;&#8221; = &#8220;&#8221; ] do= {/ip firewall connection remove $i }<br />
### OPTIONAL &#8211; If you want you can close all the connection on the line 2 to force reconnection on line 1<br />
# foreach i in=[/ip firewall connection find connection-mark=$ConnMarkISP2] do= {/ip firewall connection remove $i }<br />
# foreach i in=[/ip firewall connection find connection-mark=$ConnMarkISP2_LAN] do= {/ip firewall connection remove $i }</p>
<p>:log warning &#8220;Closed connection without mark&#8221;<br />
}<br />
}<br />
}</p>
<p># Check ISP2<br />
# :set PingResult1 [ping $PingTarget1 count=1 interface=$InterfaceISP2 routing-table=$RoutingMarkISP2]<br />
:set PingResult1 [/ping $PingTarget1 interface=$InterfaceISP2 routing-table=$RoutingMarkISP2 interval=$PingInterval count=$PingCount size=$PingSize];<br />
#:put $PingResult1<br />
# :set PingResult2 [ping $PingTarget2 count=1 interface=$InterfaceISP2 routing-table=$RoutingMarkISP1]<br />
:set PingResult2 [/ping $PingTarget2 interface=$InterfaceISP2 routing-table=$RoutingMarkISP2 interval=$PingInterval count=$PingCount size=$PingSize];<br />
#:put $PingResult2</p>
<p>:if (($PingResult1 &lt; $PingReturnThreshold) &amp;&amp; ($PingResult2 &lt; $PingReturnThreshold)) do={<br />
:if ($PingFailCountISP2 &lt; ($FailTreshold+2)) do={<br />
:set PingFailCountISP2 ($PingFailCountISP2 + 1)</p>
<p>:if ($PingFailCountISP2 = $FailTreshold) do={<br />
:log warning &#8220;ISP2 has a problem en route to $PingTarget1 and $PingTarget2 &#8211; increasing distance of routes.&#8221;<br />
:foreach i in=[/ip route find gateway=$GatewayISP2 &amp;&amp; static &amp;&amp; !routing-mark] do=\<br />
# {:log info &#8220;Increase distance route $i&#8221;}<br />
{/ip route set $i distance=([/ip route get $i distance] + $DistanceIncrease)}<br />
# Disable PCC rules<br />
:foreach i in=[/ip firewall mangle find chain=prerouting &amp;&amp; new-connection-mark=$ConnMarkISP2 &amp;&amp; (per-connection-classifier).&#8221;&#8221; != &#8220;&#8221;] do=\<br />
{/ip firewall mangle disable $i }<br />
### OPTIONAL &#8211; Disable all rule, not the only ones regarding PCC<br />
# :foreach i in=[/ip firewall mangle find chain=prerouting &amp;&amp; new-connection-mark=$ConnMarkISP2 ] do=\<br />
# {/ip firewall mangle disable $i }</p>
<p>:log warning &#8220;Route distance increase finished.&#8221;<br />
# close ISP2 connection<br />
foreach i in=[/ip firewall connection find connection-mark=$ConnMarkISP2] do= {/ip firewall connection remove $i }<br />
foreach i in=[/ip firewall connection find connection-mark=$ConnMarkISP2_LAN] do= {/ip firewall connection remove $i }<br />
:log warning &#8220;Closed connection $ConnMarkISP2 and $ConnMarkISP2_LAN&#8221;<br />
### OPTIONAL &#8211; Close connection without mark to force reopen, should not be necessary<br />
# foreach i in=[/ip firewall connection find (connection-mark).&#8221;&#8221; = &#8220;&#8221; ] do= {/ip firewall connection remove $i }<br />
}<br />
}<br />
}<br />
:if (($PingResult1 &gt; $PingReturnThreshold) || ($PingResult2 &gt; $PingReturnThreshold)) do={<br />
:if ($PingFailCountISP2 &gt; 0) do={<br />
:set PingFailCountISP2 ($PingFailCountISP2 &#8211; 1)</p>
<p>:if ($PingFailCountISP2 = ($FailTreshold -1)) do={<br />
:log warning &#8220;ISP2 can reach $PingTarget1 or $PingTarget2 again &#8211; bringing back original distance of routes.&#8221;<br />
:foreach i in=[/ip route find gateway=$GatewayISP2 &amp;&amp; static &amp;&amp; !routing-mark] do=\<br />
# {:log info &#8220;Decrease distance route $i&#8221;}<br />
{/ip route set $i distance=([/ip route get $i distance] &#8211; $DistanceIncrease)}<br />
# Reenable PCC rules<br />
:foreach i in=[/ip firewall mangle find chain=prerouting &amp;&amp; new-connection-mark=$ConnMarkISP2 &amp;&amp; (per-connection-classifier).&#8221;&#8221; != &#8220;&#8221;] do=\<br />
{/ip firewall mangle enable $i }<br />
### OPTIONAL &#8211; Disable all rule, not the only ones regarding PCC<br />
# :foreach i in=[/ip firewall mangle find chain=prerouting &amp;&amp; new-connection-mark=$ConnMarkISP2 ] do=\<br />
# {/ip firewall mangle enable $i }</p>
<p>:log warning &#8220;Route distance decrease finished.&#8221;<br />
}<br />
}<br />
}</p></blockquote>
<p>Now we will start with all the commands for our <strong>Load Balance &#8211; Failover, read it carefully! Edit IPs based on your setup! </strong>copy text to notepad, edit it and paste commands <strong>line by line</strong> on terminal.</p>
<blockquote style="border: 1px solid black; overflow: auto; height: 200px;"><p># &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- header &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
# Author: Denis Barbazza (denis . barbazza [at] gmail . com)<br />
# VERSION=2.3<br />
# <a href="http://www.farlock.org/mikrotik/mikrotik-load-balancer-and-failover-and-traffic-prioritization/">http://www.farlock.org/mikrotik/mikrotik-load-balancer-and-failover-and-traffic-prioritization/</a><br />
# Set of rules to setup a load balancer and failover with mikrotik routeros<br />
#<br />
# Inspired by:<br />
# http://mum.mikrotik.com/presentations/US12/steve.pdf<br />
# https://aacable.wordpress.com/2011/07/27/mikrotik-dual-wan-load-balancing-using-pcc-method-complete-script-by-zaib/<br />
# http://wiki.mikrotik.com/wiki/Failover_Scripting<br />
# http://wiki.mikrotik.com/wiki/Advanced_Routing_Failover_without_Scripting<br />
# http://mum.mikrotik.com/presentations/US12/tomas.pdf<br />
#<br />
# Search in script rule starting with &#8220;### OPTIONAL&#8221;, here you can enable or disable some features,<br />
# based on your needs.<br />
#<br />
# For more information and details about<br />
# this script please visit the wiki page at<br />
# http://wiki.mikrotik.com/wiki/Failover_Scripting<br />
# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- header &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p># setup our interfaces and addresses, adapt it to your interfaces<br />
/interface ethernet<br />
set 2 name=LAN comment=eth3<br />
set 0 name=ISP_1 comment=eth1<br />
set 1 name=ISP_2 comment=eth2<br />
/ip address<br />
add address=192.168.88.1/24 interface=LAN<br />
add address=1.1.1.32/24 interface=ISP_1<br />
add address=2.2.2.32/24 interface=ISP_2<br />
# Regole di nat per ciascuna interfaccia verso gli ISP<br />
/ip firewall nat<br />
add action=masquerade chain=srcnat out-interface=ISP_1 comment=&#8221;NAT packet going through ISPs&#8221;<br />
add action=masquerade chain=srcnat out-interface=ISP_2</p>
<p># Regole di routing con pesi diversi verso ciascun ISP<br />
/ip route<br />
add gateway=1.1.1.1 distance=10 check-gateway=ping comment=&#8221;Route to ISPs&#8221;<br />
add gateway=2.2.2.2 distance=20 check-gateway=ping</p>
<p>add gateway=1.1.1.1 routing-mark=ISP1_Route distance=10 comment=&#8221;Route for marked connection&#8221;<br />
add gateway=2.2.2.2 routing-mark=ISP2_Route distance=10</p>
<p># Not mark packet sent to direct connected network (physical and VPN)<br />
/ip firewall address-list<br />
add address=1.1.1.1/24 list=Connected comment=&#8221;List of direct connected network&#8221; # ISP_1<br />
add address=2.2.2.2/24 list=Connected # ISP_2<br />
add address=192.168.w.0/24 list=Connected # VPN<br />
add address=192.168.88.0/24 list=Connected # LAN<br />
add address=192.168.88.0/24 list=LAN</p>
<p>/ip firewall mangle<br />
add chain=prerouting src-address-list=Connected dst-address-list=Connected action=accept comment=&#8221;Not mark packet directed to direct connected network&#8221;</p>
<p>### OPTIONAL<br />
#############<br />
# ATTENTION!<br />
# Eventually remember to filter the traffic allowed from LAN to other networks!<br />
#############</p>
<p># Mark packet coming through ISP interfaces and put them in the correct routing tables<br />
/ip firewall mangle<br />
add chain=input connection-mark=no-mark in-interface=ISP_1 action=mark-connection new-connection-mark=from_ISP1 comment=&#8221;Mark packet coming through ISP interfaces&#8221;<br />
add chain=input connection-mark=no-mark in-interface=ISP_2 action=mark-connection new-connection-mark=from_ISP2<br />
add chain=output connection-mark=from_ISP1 action=mark-routing new-routing-mark=ISP1_Route comment=&#8221;Put the outbound reply connection in the correct routing table&#8221;<br />
add chain=output connection-mark=from_ISP2 action=mark-routing new-routing-mark=ISP2_Route</p>
<p># Now we should take care also of the connection from outside to LAN<br />
/ip firewall mangle<br />
add chain=forward connection-mark=no-mark in-interface=ISP_1 action=mark-connection new-connection-mark=from_ISP1_to_LAN comment=&#8221;Mark packet coming through ISP interfaces directed to LAN&#8221;<br />
add chain=forward connection-mark=no-mark in-interface=ISP_2 action=mark-connection new-connection-mark=from_ISP2_to_LAN<br />
add chain=prerouting connection-mark=from_ISP1_to_LAN src-address-list=LAN action=mark-routing new-routing-mark=ISP1_Route comment=&#8221;Put the reply connection from LAN in the correct routing table&#8221;<br />
add chain=prerouting connection-mark=from_ISP2_to_LAN src-address-list=LAN action=mark-routing new-routing-mark=ISP2_Route<br />
# Now you can add the script for Failover under menù System-&gt;Scripts, name it &#8220;Failover&#8221;<br />
# and then we add a schedule that launch it every 2 minutes, we set the date and unix epoch, just in<br />
# case the clock isn&#8217;t set<br />
/system scheduler add name=&#8221;Check_connectivity&#8221; interval=2m on-event=Failover start-date=jan/1/1970 start-time=0:0:0</p></blockquote>
<p>You can choose load balancing based on PCC (<a href="http://wiki.mikrotik.com/wiki/Manual:PCC" target="_blank">http://wiki.mikrotik.com/wiki/Manual:PCC</a>) or Traffic Monitor (<a href="http://mum.mikrotik.com/presentations/US12/tomas.pdf" target="_blank">http://mum.mikrotik.com/presentations/US12/tomas.pdf</a>).</p>
<p>If you prefer <strong>PCC</strong>:</p>
<blockquote style="border: 1px solid black; overflow: auto; height: 200px;"><p>#########################################################################################<br />
# PCC<br />
# With PCC you must take care of bandwidth and number of WAN available, example:<br />
# &#8211; Two equal WAN: we need two PCC mangle rule, one with :2/1 mark for ISP1 and the other with :2/0 mark for ISP2<br />
# &#8211; Three equal WAN: three rule, :3/0 mark for ISP1 &#8211; :3/1 mark for ISP2 &#8211; :3/2 mark for ISP3<br />
# &#8211; Two disequal wan, first twice bandwidth of the seconf: three rule, :3/0 mark for ISP1 &#8211; :3/1 mark for ISP1 &#8211; :3/2 mark for ISP2<br />
# As you can see we need to balance the traffic with PCC rule, more powerful WANs need more rules <img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>/ip firewall mangle<br />
add chain=prerouting action=mark-connection connection-mark=no-mark connection-state=new dst-address-type=!local \<br />
src-address-list=LAN new-connection-mark=to_ISP1 passthrough=yes per-connection-classifier=both-addresses:2/0 comment=&#8221;Doing PCC Balancing here&#8221;<br />
add chain=prerouting action=mark-connection connection-mark=no-mark connection-state=new dst-address-type=!local \<br />
src-address-list=LAN new-connection-mark=to_ISP2 passthrough=yes per-connection-classifier=both-addresses:2/1</p>
<p># If we want to balance also traffice generated from the mikrotik itself, actually nothing can be do <img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> it&#8217;s in the TODO list&#8230;</p>
<p># Now choose the right route based on connection mark<br />
/ip firewall mangle<br />
add chain=prerouting action=mark-routing connection-mark=to_ISP1 src-address-list=LAN new-routing-mark=ISP1_Route comment=&#8221;Mark balanced connection to the right routing table&#8221;<br />
add chain=prerouting action=mark-routing connection-mark=to_ISP2 src-address-list=LAN new-routing-mark=ISP2_Route</p>
<p>### OPTIONAL<br />
# If we use hotspot and we need balancing<br />
# /ip firewall nat add action=accept chain=pre-hotspot disabled=no dst-address-type=!local hotspot=auth comment=&#8221;Rule for Hotspot and PCC&#8221;<br />
# Questa regola va testata&#8230;.<br />
# Invece modificando le regole di PCC aggiungendo hotspot=auth tutto funziona correttamente:<br />
#/ip firewall mangle<br />
#add action=mark-connection chain=prerouting comment=&#8221;Doing PCC Balancing here&#8221; connection-mark=no-mark connection-state=new dst-address-type=\<br />
# !local hotspot=auth new-connection-mark=to_ISP1 per-connection-classifier=dst-address:2/0 src-address-list=LAN<br />
#add action=mark-connection chain=prerouting connection-mark=no-mark connection-state=new dst-address-type=!local hotspot=auth \<br />
# new-connection-mark=to_ISP2 per-connection-classifier=dst-address:2/1 src-address-list=LAN</p>
<p>#########################################################################################</p></blockquote>
<p>Or if you prefer <strong>Traffic Monitor</strong>:</p>
<blockquote style="border: 1px solid black; overflow: auto; height: 200px;"><p>#########################################################################################<br />
# Automated based on bandwidth, switched by Traffic Monitor (thanks to Tomas Kirnak &#8211; t.kirnak @ atris.sk)<br />
# Now start marking connection and routing<br />
/ip firewall mangle<br />
add chain=prerouting connection-mark=no-mark src-address-list=LAN dst-address-list=!Connected dst-address-type=!local \<br />
action=mark-connection new-connection-mark=from_LAN_to_WAN comment=&#8221;Mark connection for Load Balancing&#8221;<br />
add chain=prerouting connection-mark=from_LAN_to_WAN src-address-list=LAN action=mark-routing new-routing-mark=ISP1_Route comment=&#8221;Load-Balancing here&#8221;</p>
<p># Now we MUST assure that a connection routed to ISP will always stay there<br />
/ip firewall mangle<br />
add chain=prerouting connection-mark=from_LAN_to_WAN routing-mark=ISP1_Route action=mark-connection new-connection-mark=Sticky_ISP1 comment=&#8221;Mark connections as sticky&#8221;<br />
add chain=prerouting connection-mark=from_LAN_to_WAN routing-mark=ISP2_Route action=mark-connection new-connection-mark=Sticky_ISP2<br />
add chain=prerouting connection-mark=Sticky_ISP1 src-address-list=LAN action=mark-routing new-routing-mark=ISP1_Route comment=&#8221;sticky connections will always go out through same ISP&#8221;<br />
add chain=prerouting connection-mark=Sticky_ISP2 src-address-list=LAN action=mark-routing new-routing-mark=ISP2_Route</p>
<p># Setup Traffic Monitor<br />
/tool traffic-monitor<br />
add interface=ISP_1 name=LB_ISP1_above trigger=above on-event=&#8221;:log debug \&#8221;Load-Balance Debug: ISP\<br />
1 overloaded, switching to ISP2\&#8221;;\r\<br />
\n/ip firewall mangle set [find comment=\&#8221;Load-Balancing here\&#8221;] new-routing-mark=ISP2_Route&#8221; \<br />
threshold=5242880 traffic=received comment=&#8221;When ISP1 reaches 5mbit/s switch to ISP2&#8243;<br />
add interface=ISP_1 name=LB_ISP1_below trigger=below on-event=&#8221;:log debug \&#8221;Load-Balance Debug: ISP\<br />
1 back to normal\&#8221;;\r\<br />
\n/ip firewall mangle set [find comment=\&#8221;Load-Balancing here\&#8221;] new-routing-mark=ISP1_Route&#8221; \<br />
threshold=5242880 traffic=received comment=&#8221;And on less traffic go back again to ISP1&#8243;<br />
##############################################################################################</p></blockquote>
<p>Choose one of the two <img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>And, the end, if you want icing on cake we can prioritize traffic based on its type and contents:</p>
<blockquote style="border: 1px solid black; overflow: auto; height: 200px;"><p>###################################################################################<br />
# Traffic Prioritization &#8211; thanks to Rick Frey &#8211; support @ rickfreyconsulting.com<br />
# some modification to original script to work correctly with HTTPS traffic<br />
# To act with layer 7 traffic check original script on <a href="http://rickfreyconsulting.com" target="_blank">http://rickfreyconsulting.com</a></p>
<p>/ip firewall mangle<br />
add chain=output comment=&#8221;Section Break &#8211; Input prioritize rules&#8221; disabled=yes<br />
add action=change-dscp chain=input comment=&#8221;DSCP &#8211; 7 &#8211; Winbox Port 8291 (Local Management)&#8221; dst-port=8291 new-dscp=7 protocol=tcp<br />
############################################################################################################################<br />
#### This section sets priorities for tunneling methods used by the hosts on your LAN. ####<br />
############################################################################################################################</p>
<p>/ip firewall mangle<br />
add chain=output comment=&#8221;Section Break &#8211; VPN&#8221; disabled=yes<br />
add action=change-dscp chain=forward comment=&#8221;DSCP &#8211; 5 &#8211; PPTP Port 1723 (LAN Traffic)&#8221; new-dscp=5 port=1723 protocol=tcp<br />
add action=change-dscp chain=forward comment=&#8221;DSCP &#8211; 5 &#8211; GRE Protocol (LAN Traffic)&#8221; new-dscp=5 protocol=gre<br />
add action=change-dscp chain=forward comment=&#8221;DSCP &#8211; 5 &#8211; L2TP UDP Port 500 (LAN Traffic)&#8221; new-dscp=5 port=500 protocol=udp<br />
add action=change-dscp chain=forward comment=&#8221;DSCP &#8211; 5 &#8211; L2TP UDP Port 1701 (LAN Traffic)&#8221; new-dscp=5 port=1701 protocol=udp<br />
add action=change-dscp chain=forward comment=&#8221;DSCP &#8211; 5 &#8211; L2TP UDP Port 4500 (LAN Traffic)&#8221; new-dscp=5 port=4500 protocol=udp<br />
add action=change-dscp chain=forward comment=&#8221;DSCP &#8211; 5 &#8211; OVPN TCP Port 1194 (LAN Traffic)&#8221; new-dscp=5 port=1194 protocol=tcp<br />
############################################################################################################################<br />
#### This section sets priorities for VOIP Traffic ####<br />
############################################################################################################################</p>
<p>add chain=output comment=&#8221;Section Break &#8211; Voip&#8221; disabled=yes<br />
add action=change-dscp chain=postrouting comment=&#8221;DSCP &#8211; 7 &#8211; VOIP&#8221; disabled=no new-dscp=7 passthrough=yes port=1167,1719,1720,8010 protocol=udp<br />
add action=change-dscp chain=postrouting comment=&#8221;DSCP &#8211; 7 &#8211; VOIP&#8221; disabled=no new-dscp=7 passthrough=yes port=1719,1720,8008,8009 protocol=tcp<br />
add action=change-dscp chain=postrouting comment=&#8221;DSCP &#8211; 7 &#8211; SIP&#8221; disabled=no new-dscp=7 passthrough=yes port=5060,5061 protocol=tcp<br />
add action=change-dscp chain=postrouting comment=&#8221;DSCP &#8211; 7 &#8211; SIP&#8221; disabled=no new-dscp=7 passthrough=yes port=5060,5061 protocol=udp<br />
add action=change-dscp chain=postrouting comment=&#8221;DSCP &#8211; 7 &#8211; SIP 5004&#8243; disabled=no new-dscp=7 passthrough=yes port=5004 protocol=udp<br />
add action=set-priority chain=postrouting comment=&#8221;Priority &#8211; 7 &#8211; Ventrilo VOIP&#8221; new-priority=7 port=3784 protocol=tcp<br />
add action=set-priority chain=postrouting comment=&#8221;Priority &#8211; 7 &#8211; Ventrilo VOIP&#8221; new-priority=7 port=3784,3785 protocol=udp<br />
add action=set-priority chain=postrouting comment=&#8221;Priority &#8211; 7 &#8211; Windows Live Messenger Voice&#8221; new-priority=7 port=6901 protocol=tcp<br />
add action=set-priority chain=postrouting comment=&#8221;Priority &#8211; 7 &#8211; Windows Live Messenger Voice&#8221; new-priority=7 port=6901 protocol=udp<br />
############################################################################################################################<br />
#### This section sets priorities for normal LAN Traffic ####<br />
############################################################################################################################</p>
<p>add chain=output comment=&#8221;Section Break &#8211; Normal traffic&#8221; disabled=yes<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 6 &#8211; SSH&#8221; disabled=no new-priority=6 passthrough=yes port=22 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 6 &#8211; Telnet&#8221; disabled=no new-priority=6 passthrough=yes port=23 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 6 &#8211; ICMP&#8221; disabled=no new-priority=6 passthrough=yes protocol=icmp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 6 &#8211; TCP DNS Requests&#8221; disabled=no new-priority=6 passthrough=yes port=53 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 6 &#8211; UDP DNS &amp; mDNS Requests&#8221; disabled=no new-priority=6 passthrough=yes port=53,5353 protocol=udp</p>
<p>add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 3 &#8211; HTTP Requests&#8221; connection-bytes=0-2000000 disabled=no dst-port=80 new-priority=3 passthrough=yes protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 3 &#8211; HTTPS Requests&#8221; connection-bytes=0-2000000 disabled=no dst-port=443 new-priority=3 passthrough=yes protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 4 &#8211; ICQ&#8221; disabled=no new-priority=5 passthrough=yes port=5190 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 4 &#8211; Yahoo IM&#8221; disabled=no new-priority=5 passthrough=yes port=5050 protocol=tcp</p>
<p>add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 4 &#8211; AOL, IRC&#8221; disabled=no new-priority=4 passthrough=yes port=531,5190,6660-6669,6679,6697 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 4 &#8211; AOL, IRC&#8221; disabled=no new-priority=4 passthrough=yes port=531 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 4 &#8211; Time&#8221; disabled=no new-priority=4 passthrough=yes port=37 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 4 &#8211; Time&#8221; disabled=no new-priority=4 passthrough=yes port=37,123 protocol=udp</p>
<p>add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; SFTP&#8221; disabled=no dst-port=22 new-priority=0 packet-size=1400-1500 passthrough=yes protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; FTP&#8221; disabled=no dst-port=20,21 new-priority=0 packet-size=1400-1500 passthrough=yes protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; HTTP Downloads&#8221; connection-bytes=2000000-0 disabled=no new-priority=0 passthrough=yes port=80 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; HTTPS Downloads&#8221; connection-bytes=2000000-0 disabled=no new-priority=0 passthrough=yes port=443 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Mail Services&#8221; disabled=no port=110,995,143,993,25,57,109,465,587 new-priority=0 passthrough=yes protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; SNMP&#8221; disabled=no new-priority=0 passthrough=yes port=161,162 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; SNMP&#8221; disabled=no new-priority=0 passthrough=yes port=162 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; IMAP, IMAPS&#8221; disabled=no new-priority=0 passthrough=yes port=220,993 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; IMAP&#8221; disabled=no new-priority=0 passthrough=yes port=220 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Doom FPS&#8221; disabled=no new-priority=0 passthrough=yes port=666 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; America&#8217;s Army MMO&#8221; disabled=no new-priority=0 passthrough=yes port=1716 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Civilization MMO&#8221; disabled=no new-priority=0 passthrough=yes port=2056 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Halo: Combat Evolved MMO&#8221; disabled=no new-priority=0 passthrough=yes port=2302 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Dark Ages&#8221; disabled=no port=2610 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Xbox Live&#8221; disabled=no new-priority=0 passthrough=yes port=3074 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Xbox Live&#8221; disabled=no new-priority=0 passthrough=yes port=3074 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Blizzard Games Online&#8221; disabled=no new-priority=0 passthrough=yes port=3723,6112 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Blizzard Games Online&#8221; disabled=no new-priority=0 passthrough=yes port=3723 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; WoW MMO&#8221; disabled=no new-priority=0 passthrough=yes port=3724 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; WoW MMO&#8221; disabled=no new-priority=0 passthrough=yes port=3724 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Club Penguin Disney Online&#8221; disabled=no new-priority=0 passthrough=yes port=3724,6112,6113,9875 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Diablo II&#8221; disabled=no new-priority=0 passthrough=yes port=4000 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Diablo II&#8221; disabled=no new-priority=0 passthrough=yes port=4000 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Microsoft Ants MMO&#8221; disabled=no new-priority=0 passthrough=yes port=4001 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Google Desktop&#8221; disabled=no new-priority=0 passthrough=yes port=4664 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; BZFlag&#8221; disabled=no new-priority=0 passthrough=yes port=5154 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; BZFlag&#8221; disabled=no new-priority=0 passthrough=yes port=5154 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Freeciv MMO&#8221; disabled=no new-priority=0 passthrough=yes port=5556 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Freeciv MMO&#8221; disabled=no new-priority=0 passthrough=yes port=5556 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Windows Live Messenger File Transfer&#8221; disabled=no new-priority=0 passthrough=yes port=6891-6900 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Enemy Territory: Quake Wars&#8221; disabled=no new-priority=0 passthrough=yes port=7133 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Teamspeak&#8221; disabled=no new-priority=0 passthrough=yes port=8767-8768 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Teamspeak&#8221; disabled=no new-priority=0 passthrough=yes port=9987 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Earthland Relams 2&#8243; disabled=no new-priority=0 passthrough=yes port=8888-8889 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Sony Playstation&#8221; disabled=no new-priority=0 passthrough=yes port=9293 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Battlefield 1942 MMO&#8221; disabled=no new-priority=0 passthrough=yes port=14567 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Battlefield Vietnam&#8221; disabled=no new-priority=0 passthrough=yes port=15567 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Battlefield 2&#8243; disabled=no new-priority=0 passthrough=yes port=16567 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Quake&#8221; disabled=no new-priority=0 passthrough=yes port=26000 protocol=tcp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Quake&#8221; disabled=no new-priority=0 passthrough=yes port=26000,27901,27960 protocol=udp<br />
add action=set-priority chain=prerouting comment=&#8221;Priority &#8211; 0 &#8211; Call of Duty&#8221; disabled=no new-priority=0 passthrough=yes port=28960 protocol=udp<br />
add chain=output comment=&#8221;Section Break&#8221; disabled=yes</p>
<p>#########################################<br />
#### VOIP ####<br />
#########################################</p>
<p>/ip firewall layer7-protocol<br />
add name=sip regexp=\<br />
&#8220;^(invite|register|cancel) sip[\t-\r -~]*sip/[0-2]\\.[0-9]&#8221;<br />
add name=h323 regexp=\<br />
&#8220;^\03..\?\08&#8230;\?.\?.\?.\?.\?.\?.\?.\?.\?.\?.\?.\?.\?.\?.\?\05&#8243;<br />
add name=skypeout regexp=&#8221;^(\01.\?.\?.\?.\?.\?.\?.\?.\?\01|\02.\?.\?.\?.\?.\?.\<br />
\?.\?.\?\02|\03.\?.\?.\?.\?.\?.\?.\?.\?\03|\04.\?.\?.\?.\?.\?.\?.\?.\?\04|\<br />
\05.\?.\?.\?.\?.\?.\?.\?.\?\05|\06.\?.\?.\?.\?.\?.\?.\?.\?\06|\07.\?.\?.\?\<br />
.\?.\?.\?.\?.\?\07|\08.\?.\?.\?.\?.\?.\?.\?.\?\08|\t.\?.\?.\?.\?.\?.\?.\?.\<br />
\?\t|\<br />
\n.\?.\?.\?.\?.\?.\?.\?.\?\<br />
\n|\0B.\?.\?.\?.\?.\?.\?.\?.\?\0B|\0C.\?.\?.\?.\?.\?.\?.\?.\?\0C|\r.\?.\?.\<br />
\?.\?.\?.\?.\?.\?\r|\0E.\?.\?.\?.\?.\?.\?.\?.\?\0E|\0F.\?.\?.\?.\?.\?.\?.\<br />
\?.\?\0F|\10.\?.\?.\?.\?.\?.\?.\?.\?\10|\11.\?.\?.\?.\?.\?.\?.\?.\?\11|\12\<br />
.\?.\?.\?.\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|\F6.\?.\?.\?.\?.\?.\?.\?.\?\F6|\<br />
\F7.\?.\?.\?.\?.\?.\?.\?.\?\F7|\F8.\?.\?.\?.\?.\?.\?.\?.\?\F8|\F9.\?.\?.\?\<br />
.\?.\?.\?.\?.\?\F9|\FA.\?.\?.\?.\?.\?.\?.\?.\?\FA|\FB.\?.\?.\?.\?.\?.\?.\?\<br />
.\?\FB|\FC.\?.\?.\?.\?.\?.\?.\?.\?\FC|\FD.\?.\?.\?.\?.\?.\?.\?.\?\FD|\FE.\<br />
\?.\?.\?.\?.\?.\?.\?.\?\FE|\FF.\?.\?.\?.\?.\?.\?.\?.\?\FF)&#8221;<br />
add name=skypetoskype regexp=&#8221;^..\02&#8230;&#8230;&#8230;&#8230;.&#8221;<br />
add name=teamspeak regexp=&#8221;^\F4\BE\03.*teamspeak&#8221;<br />
add name=ventrilo regexp=&#8221;^..\?v\\\$\CF&#8221;<br />
add name=stun regexp=&#8221;^[\01\02]&#8230;&#8230;&#8230;&#8230;&#8230;.\?\$&#8221;</p>
<p>/ip firewall mangle<br />
add action=set-priority chain=forward comment=&#8221;Priority &#8211; 5 &#8211; VOIP &#8211; h323&#8243; layer7-protocol=h323 new-priority=5<br />
add action=set-priority chain=forward comment=&#8221;Priority &#8211; 5 &#8211; VOIP &#8211; SIP&#8221; layer7-protocol=sip new-priority=5<br />
add action=set-priority chain=forward comment=&#8221;Priority &#8211; 5 &#8211; VOIP &#8211; Skypeout&#8221; layer7-protocol=skypeout new-priority=5<br />
add action=set-priority chain=forward comment=&#8221;Priority &#8211; 5 &#8211; VOIP &#8211; skypetoskype&#8221; layer7-protocol=skypetoskype new-priority=5<br />
add action=set-priority chain=forward comment=&#8221;Priority &#8211; 5 &#8211; VOIP &#8211; STUN&#8221; layer7-protocol=stun new-priority=5<br />
add action=set-priority chain=forward comment=&#8221;Priority &#8211; 5 &#8211; VOIP &#8211; Teamspeak&#8221; layer7-protocol=teamspeak new-priority=5<br />
add action=set-priority chain=forward comment=&#8221;Priority &#8211; 5 &#8211; VOIP &#8211; Ventrilo&#8221; layer7-protocol=ventrilo new-priority=5</p></blockquote>
<p>That&#8217;s all!</p>
<p>Try it and share your impression, bugs, everything!</p>
<p>For reference you can download script and commands in text file:</p>
<ol>
<li>Failover Script -&gt; <a href="http://www.farlock.org/wp-content/uploads/2016/10/Failover-2_3.txt">failover-2_3</a></li>
<li>Commands for config -&gt; <a href="http://www.farlock.org/wp-content/uploads/2016/10/Load-Balance-Failover-RouterOS-2_3.txt">load-balance-failover-routeros-2_3</a></li>
</ol>
]]></content:encoded>
					
					<wfw:commentRss>https://www.farlock.org/mikrotik/mikrotik-load-balancer-and-failover-and-traffic-prioritization/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Check-MK Mikrotik Plugin for Voltage &#8211; Temperature &#8211; Memory</title>
		<link>https://www.farlock.org/mikrotik/check-mk-mikrotik-voltage-temperature-memory/</link>
					<comments>https://www.farlock.org/mikrotik/check-mk-mikrotik-voltage-temperature-memory/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 07 Jan 2016 07:04:40 +0000</pubDate>
				<category><![CDATA[Check-mk]]></category>
		<category><![CDATA[Mikrotik]]></category>
		<category><![CDATA[Nagios]]></category>
		<category><![CDATA[check-mk]]></category>
		<category><![CDATA[check-mk plugin]]></category>
		<category><![CDATA[checkmk]]></category>
		<category><![CDATA[mikrotik temperature]]></category>
		<category><![CDATA[mikrotik votlage]]></category>
		<category><![CDATA[mirkotik memory]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[routeros]]></category>
		<guid isPermaLink="false">http://www.farlock.org/?p=246</guid>

					<description><![CDATA[I just finished to write my first SNMP check for check_mk 🙂 These checks are for query mikrotik routerboard device and check status of voltage (power supply), temperature and memory. For memory I simly edit the hr_mem check, I don&#8217;t know why but mikrotik use hrOtherDisk instead of hrRamDisk for internal ram. I&#8217;ve also add [...]]]></description>
										<content:encoded><![CDATA[<div>I just finished to write my first SNMP <span class="il">check</span> for check_mk <img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></div>
<div>These checks are for query mikrotik routerboard device and <span class="il">check</span> status of voltage (power supply), temperature and memory.</div>
<div>For memory I simly edit the hr_mem <span class="il">check</span>, I don&#8217;t know why but mikrotik use hrOtherDisk instead of hrRamDisk for internal ram.</div>
<div>I&#8217;ve also add itcm_parameters.py, it should be copied in /usr/share/check_mk/web/<wbr />plugins/wato to add the possibility to edit ruleset with web interface.</div>
<div></div>
<div>I&#8217;m not expert at all of python and check_mk scripts, so I hope that this would be helpful for someone and someone else can <span class="il">check</span> and improve it <img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></div>
<div></div>
<div><a href="http://www.farlock.org/mikrotik/check-mk-mikrotik-voltage-temperature-memory/attachment/check_mk_mikrotik/" rel="attachment wp-att-249">check_mk_mikrotik</a></div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.farlock.org/mikrotik/check-mk-mikrotik-voltage-temperature-memory/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Tunnel IPIP between RouterOs and Linux</title>
		<link>https://www.farlock.org/linux/tunnel-ipip-between-routeros-and-linux/</link>
					<comments>https://www.farlock.org/linux/tunnel-ipip-between-routeros-and-linux/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 27 Mar 2014 12:52:37 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mikrotik]]></category>
		<guid isPermaLink="false">http://www.farlock.org/?p=209</guid>

					<description><![CDATA[<p>This is a small tutorial on how to establish an IPIP tunnel between a Linux Debian server and a Mikrotik RouterOs.</p> <p>Linux Machine:</p> ip tunnel add tun0 mode ipip remote &#60;remote_ip_address&#62; local &#60;local_ip_address&#62; ip link set tun0 up ip addr add 192.168.200.1/24 dev tun0 <p>Mikrotik RouterBoard:</p> /interface ipip add local-address=&#60;local_address&#62; remote-address=&#60;remote_address&#62; /ip address add address=192.168.200.2/24 [...]]]></description>
										<content:encoded><![CDATA[<p>This is a small tutorial on how to establish an IPIP tunnel between a Linux Debian server and a Mikrotik RouterOs.</p>
<p>Linux Machine:</p>
<blockquote>
<pre>ip tunnel add tun0 mode ipip remote &lt;remote_ip_address&gt; local &lt;local_ip_address&gt;
ip link set tun0 up
ip addr add 192.168.200.1/24 dev tun0</pre>
</blockquote>
<p>Mikrotik RouterBoard:</p>
<blockquote>
<pre>/interface ipip add local-address=&lt;local_address&gt; remote-address=&lt;remote_address&gt;
/ip address add address=192.168.200.2/24 interface=ipip1</pre>
</blockquote>
<p>Check that there are no rules blocking protocol 4 and 94 input and output.</p>
<p>Try to ping the other end of the tunnel:</p>
<p># ping 192.168.200.2<br />
PING 192.168.200.2 (192.168.200.2) 56(84) bytes of data.<br />
64 bytes from 192.168.200.2: icmp_req=1 ttl=64 time=84.1 ms</p>
<p><strong>It works!</strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.farlock.org/linux/tunnel-ipip-between-routeros-and-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>OpenVPN Linux Server &#8211; Router OS Client</title>
		<link>https://www.farlock.org/linux/openvpn-linux-server-router-os-client/</link>
					<comments>https://www.farlock.org/linux/openvpn-linux-server-router-os-client/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 10 Jul 2012 14:36:08 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mikrotik]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[openvpn]]></category>
		<category><![CDATA[routeros]]></category>
		<guid isPermaLink="false">http://www.farlock.org/?p=195</guid>

					<description><![CDATA[<p>Launch this commands:</p> <p>CATOP=./personalCA</p> <p>CAKEY=./cakey.pem</p> <p>CAREQ=./careq.pem</p> <p>CACERT=./cacert.pem</p> <p>cd /etc/ssl</p> <p>mkdir $CATOP</p> <p>mkdir $CATOP/certs</p> <p>mkdir $CATOP/crl</p> <p>mkdir $CATOP/newcerts</p> <p>mkdir $CATOP/private</p> <p>echo &#8220;00&#8221; &#62; $CATOP/serial</p> <p>echo &#8220;00&#8221; &#62; $CATOP/crlnumber</p> <p>touch $CATOP/index.txt</p> <p>export OPENSSL_CONF=/etc/ssl/essetigiCA.cnf</p> <p>copy /etc/ssl/openssl.cnf to personalCA.cnf and edit OrganizationName, Country, State, ecc fields.</p> <p>Then execute:</p> <p>openssl req -new -keyout $CATOP/private/$CAKEY -out $CATOP/$CAREQ</p> <p>write a complex passhprase [...]]]></description>
										<content:encoded><![CDATA[<p>Launch this commands:</p>
<blockquote><p>CATOP=./personalCA</p>
<p>CAKEY=./cakey.pem</p>
<p>CAREQ=./careq.pem</p>
<p>CACERT=./cacert.pem</p>
<p>cd /etc/ssl</p>
<p>mkdir $CATOP</p>
<p>mkdir $CATOP/certs</p>
<p>mkdir $CATOP/crl</p>
<p>mkdir $CATOP/newcerts</p>
<p>mkdir $CATOP/private</p>
<p>echo &#8220;00&#8221; &gt; $CATOP/serial</p>
<p>echo &#8220;00&#8221; &gt; $CATOP/crlnumber</p>
<p>touch $CATOP/index.txt</p>
<p>export OPENSSL_CONF=/etc/ssl/essetigiCA.cnf</p></blockquote>
<p>copy /etc/ssl/openssl.cnf to personalCA.cnf and edit OrganizationName, Country, State, ecc fields.</p>
<p>Then execute:</p>
<blockquote><p>openssl req -new -keyout $CATOP/private/$CAKEY -out $CATOP/$CAREQ</p></blockquote>
<p>write a complex passhprase and remember it! Without it the CA is completely useless. It asks also for information about the CA.</p>
<p>Now we create our CA, it asks for the passphrase:</p>
<blockquote><p>openssl ca -out $CATOP/$CACERT $CADAYS -extensions v3_ca -days 36500 -keyfile $CATOP/private/$CAKEY -selfsign -infiles $CATOP/$CAREQ</p></blockquote>
<p>Server certificate:</p>
<blockquote><p>openssl req -new -nodes -keyout $CATOP/private/server_key.pem -out $CATOP/certs/server_req.pem</p>
<p>openssl ca -out $CATOP/certs/server_cert.pem -days 13000 -extensions server_cert -infiles $CATOP/certs/server_req.pem</p></blockquote>
<p>client certificate:</p>
<blockquote><p>openssl req -new -nodes -keyout $CATOP/private/client01_key.pem -out $CATOP/certs/client01_req.pem</p>
<div>openssl ca -out $CATOP/certs/client01_cert.pem -days 10000  -infiles $CATOP/certs/client01_req.pem</div>
</blockquote>
<p>That&#8217;s all.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.farlock.org/linux/openvpn-linux-server-router-os-client/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
