<?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>Farlock.org</title>
	<atom:link href="https://www.farlock.org/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.farlock.org</link>
	<description>What you want to hack today?</description>
	<lastBuildDate>Fri, 04 Mar 2022 16:59:59 +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>Uptime Contest</title>
		<link>https://www.farlock.org/linux/uptime-contest/</link>
					<comments>https://www.farlock.org/linux/uptime-contest/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 04 Mar 2022 16:51:31 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[uptime]]></category>
		<guid isPermaLink="false">https://www.farlock.org/?p=297</guid>

					<description><![CDATA[ <p>1424 days</p> <p>&#160;</p>]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-full"><img decoding="async" width="793" height="132" class="wp-image-303" src="https://www.farlock.org/wp-content/uploads/2022/03/Screenshot-2022-03-04-175232.png" alt="" srcset="https://www.farlock.org/wp-content/uploads/2022/03/Screenshot-2022-03-04-175232.png 793w, https://www.farlock.org/wp-content/uploads/2022/03/Screenshot-2022-03-04-175232-300x50.png 300w, https://www.farlock.org/wp-content/uploads/2022/03/Screenshot-2022-03-04-175232-768x128.png 768w, https://www.farlock.org/wp-content/uploads/2022/03/Screenshot-2022-03-04-175232-150x25.png 150w, https://www.farlock.org/wp-content/uploads/2022/03/Screenshot-2022-03-04-175232-400x67.png 400w" sizes="(max-width: 793px) 100vw, 793px" /></figure>



<p>1424 days</p>

<p>&nbsp;</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.farlock.org/linux/uptime-contest/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Automatically clone zone from a bind master</title>
		<link>https://www.farlock.org/linux/automatically-clone-zone-from-a-bind-master/</link>
					<comments>https://www.farlock.org/linux/automatically-clone-zone-from-a-bind-master/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 28 Apr 2017 13:46:40 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[bind replica]]></category>
		<category><![CDATA[master]]></category>
		<category><![CDATA[slave]]></category>
		<guid isPermaLink="false">http://www.farlock.org/?p=289</guid>

					<description><![CDATA[<p>My situation, ns1 and ns2, master and slave. On ns1 I&#8217;ve installed smbind to simply manage my zones.</p> <p>Now I want that ns2 will be automatically updated with the new zones from ns1 but, unfortunately, I wasn&#8217;t able to find anything ready on internet.</p> <p>At the end I wrote a simple script that simply connect [...]]]></description>
										<content:encoded><![CDATA[<p>My situation, ns1 and ns2, master and slave. On ns1 I&#8217;ve installed smbind to simply manage my zones.</p>
<p>Now I want that ns2 will be automatically updated with the new zones from ns1 but, unfortunately, I wasn&#8217;t able to find anything ready on internet.</p>
<p>At the end I wrote a simple script that simply connect to the first machine via ssh, take the bind file with zones, and, if anything changed, adapt it for the slave server, copy in the bind directory and reload bind.</p>
<p>Obviously it needs to be adapted to your needs, I run it every hour.</p>
<blockquote><p>#!/bin/bash</p>
<p>VERSION=&#8221;0.1&#8243;</p>
<p># bind_auto_slave<br />
# Author:  info@farlock.org<br />
#<br />
# Description: copy bind file from master server, edit it and reload bind on slave<br />
#<br />
# ChangeLog: 0.1 &#8211; 28/04/17 &#8211; First Release</p>
<p>MASTER_SERVER=&#8221;ns1.xxx.com&#8221;<br />
MASTER_SERVER_PORT=&#8221;22&#8243;<br />
MASTER_SERVER_USER=&#8221;root&#8221;<br />
MASTER_FILE=&#8221;/etc/smbind/smbind.conf&#8221;</p>
<p>SLAVE_FILE=&#8221;/etc/bind/ns1.conf&#8221;<br />
SED_ARGUMENT=&#8221;s/master;/slave;\n\t\t\tmasters { servers_name; };/&#8221; # Argument that must be passed to sed</p>
<p>#SED_ARGUMENT=&#8221;s/master;/slave;/&#8221;</p>
<p># First of all download file from master<br />
TMP_FILE=$(mktemp)<br />
chmod g+r,o+r $TMP_FILE<br />
scp -q -P $MASTER_SERVER_PORT $MASTER_SERVER:$MASTER_FILE $TMP_FILE<br />
if [ $? -ne 0 ] ; then<br />
echo &#8220;Error downloading file from $MASTER_SERVER&#8221;<br />
exit 11<br />
fi</p>
<p># Execute sed on it<br />
#echo sed $SED_ARGUMENT $TMP_FILE<br />
sed -i &#8220;$SED_ARGUMENT&#8221; $TMP_FILE<br />
if [ $? -ne 0 ] ; then<br />
echo &#8220;Error executing sed on file $TMP_FILE&#8221;<br />
exit 12<br />
fi</p>
<p># Check differences<br />
diff -q $TMP_FILE $SLAVE_FILE &gt; /dev/null<br />
if [ $? -ne 0 ] ; then # files differ<br />
mv $TMP_FILE $SLAVE_FILE<br />
service bind9 reload<br />
if [ $? -ne 0 ] ; then<br />
echo &#8220;Error reloading bind9 on slave server&#8221;<br />
exit 13<br />
fi<br />
else<br />
rm $TMP_FILE<br />
fi</p>
<p>exit 0</p></blockquote>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.farlock.org/linux/automatically-clone-zone-from-a-bind-master/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Renew a Certification Authority that is going to expiry</title>
		<link>https://www.farlock.org/linux/renew-a-certification-authority-that-is-going-to-expiry/</link>
					<comments>https://www.farlock.org/linux/renew-a-certification-authority-that-is-going-to-expiry/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 28 Oct 2016 10:02:12 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CA]]></category>
		<category><![CDATA[CA renew]]></category>
		<category><![CDATA[certification authority]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[openvpn certificate renew]]></category>
		<guid isPermaLink="false">http://www.farlock.org/?p=284</guid>

					<description><![CDATA[<p>Esempio classico: il certificato di openvpn dopo 10 anni scade, il certificato originale era stato creato con easy-rsa</p> <p>È possibile rinnovare il certificato della Certification Authority e del server in scadenza e far si che i client continuino a collegarsi. Nel caso di alcuni software (vedi openvpn), il client dispone anche di copia del certificato [...]]]></description>
										<content:encoded><![CDATA[<p><em><strong>Esempio classico: il certificato di openvpn dopo 10 anni scade, il certificato originale era stato creato con easy-rsa</strong></em></p>
<p>È possibile rinnovare il certificato della Certification Authority e del server in scadenza e far si che i client <strong>continuino a collegarsi.</strong><br />
Nel caso di alcuni software (vedi openvpn), il client dispone anche di copia del certificato server, purtroppo in questo caso andrà comunque inviata la nuova accoppiata (CA + server) al client.<br />
Potremmo comunque installare sul server i nuovi certificati prima della scadenza e rinnovare man mano tutti i clienti senza che nessuno di essi smetta di funzionare.<br />
Passaggi, in questo caso il vecchio certificato era stato prodotto con easy-rsa:</p>
<blockquote><p>cd /etc/openvpn/extern-rsa</p></blockquote>
<p># carichiamo le variabili di easy-rsa (attenzione ai punti):</p>
<blockquote><p>. ./vars</p></blockquote>
<p># Se non abbiamo la csr originale possiamo ricrearla partendo dal certificato e dalla chiave:</p>
<blockquote><p>openssl x509 -x509toreq -in keys/ca.crt -signkey keys/ca.key -out keys/ca_2016.csr</p></blockquote>
<p># Ricreiamo un nuovo certificato CA con una nuova data di scadenza, estensioni per la CA e seriale 00 (attenzione: se il certificato CA non ha questo seriale openssl lo rifiuta, mentre i sistemi microsoft lo accettano <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>
<blockquote><p>openssl ca -config /etc/openvpn/extern-rsa/openssl.cnf -out keys/ca_2016.crt -set_serial 0000 -extensions v3_ca -days 7200 -keyfile keys/ca.key -selfsign -infiles keys/ca_2016.csr</p></blockquote>
<p># Ricrieamo ora il certificato per il server, presupponendo che abbiamo ancora il csr, altrimenti possiamo ricrearli con il passaggio sopra.</p>
<blockquote><p>openssl ca -config /etc/openvpn/extern-rsa/openssl.cnf -out keys/extern_2016.crt -extensions server -days 7200 -infiles keys/extern.csr</p></blockquote>
<p><em>Per verificare che tutto sia ok possiamo controllare un certificato già generato e ancora valido con la vecchia CA:</em></p>
<blockquote><p>openssl verify -CAfile keys/ca.crt -verbose keys/test.crt</p></blockquote>
<p>e in seguito con la nuova:</p>
<blockquote><p>openssl verify -CAfile keys/ca_2016.crt -verbose keys/test.crt</p></blockquote>
<p>In entrambi i casi il risultato sarà OK.</p>
<p>Possiamo anche controllare il nuovo certificato server con la vecchia CA e viceversa:</p>
<blockquote><p>openssl verify -CAfile keys/ca.crt -verbose keys/extern_2016.crt<br />
openssl verify -CAfile keys/ca_2016.crt -verbose keys/extern.crt</p></blockquote>
<p>Il risultato sarà sempre OK, se cosi non fosse c&#8217;è stato qualche problema nei passaggi precedenti (attenzione al serial ad esempio)</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.farlock.org/linux/renew-a-certification-authority-that-is-going-to-expiry/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<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.\?.\?.\?.\?.\?.\?.\?.\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?.\?.\<br />
\?.\?.\?.\?\ED|\EE.\?.\?.\?.\?.\?.\?.\?.\?\EE|\EF.\?.\?.\?.\?.\?.\?.\?.\?\<br />
\EF|\F0.\?.\?.\?.\?.\?.\?.\?.\?\F0|\F1.\?.\?.\?.\?.\?.\?.\?.\?\F1|\F2.\?.\<br />
\?.\?.\?.\?.\?.\?.\?\F2|\F3.\?.\?.\?.\?.\?.\?.\?.\?\F3|\F4.\?.\?.\?.\?.\?.\<br />
\?.\?.\?\F4|\F5.\?.\?.\?.\?.\?.\?.\?.\?\F5|\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>Raspberry Web Analog Data Logger</title>
		<link>https://www.farlock.org/raspberry-pi/raspberry-web-analog-data-logger/</link>
					<comments>https://www.farlock.org/raspberry-pi/raspberry-web-analog-data-logger/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 27 Apr 2015 16:06:19 +0000</pubDate>
				<category><![CDATA[ADC]]></category>
		<category><![CDATA[Raspberry PI]]></category>
		<category><![CDATA[adc]]></category>
		<category><![CDATA[analog input]]></category>
		<category><![CDATA[Custard PI 3]]></category>
		<category><![CDATA[data logger]]></category>
		<category><![CDATA[MCP3008]]></category>
		<category><![CDATA[MCP3208]]></category>
		<category><![CDATA[raspberry pi]]></category>
		<guid isPermaLink="false">http://www.farlock.org/?p=229</guid>

					<description><![CDATA[<p>On this post I&#8217;ll explain you how to grab analog data from an 8-channel, 12 bit ADC. The ADC used is the Custard-PI 3 http://www.sf-innovations.co.uk/custard-pi-3.html . You can buy it directly from them on that page.</p> <p>I use it to log value from different type of sensors. As you know ADC for raspberry can read [...]]]></description>
										<content:encoded><![CDATA[<p>On this post I&#8217;ll explain you how to grab analog data from an 8-channel, 12 bit ADC. The ADC used is the Custard-PI 3 <a href="http://www.sf-innovations.co.uk/custard-pi-3.html" target="_blank">http://www.sf-innovations.co.uk/custard-pi-3.html</a> . You can buy it directly from them on that page.</p>
<p>I use it to log value from different type of sensors. As you know ADC for raspberry can read only voltage from 0 to 2.5V (or higher with partitor) but lot of industrial sensors are based on 4-20mA range.</p>
<p><a href="http://www.farlock.org/wp-content/uploads/2015/04/graph.png"><img loading="lazy" decoding="async" class=" size-medium wp-image-238 aligncenter" src="http://www.farlock.org/wp-content/uploads/2015/04/graph-300x190.png" alt="graph" width="300" height="190" srcset="https://www.farlock.org/wp-content/uploads/2015/04/graph-300x190.png 300w, https://www.farlock.org/wp-content/uploads/2015/04/graph-1024x649.png 1024w, https://www.farlock.org/wp-content/uploads/2015/04/graph-150x95.png 150w, https://www.farlock.org/wp-content/uploads/2015/04/graph-400x253.png 400w, https://www.farlock.org/wp-content/uploads/2015/04/graph.png 1283w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>With this scripts you will be able to obtain a CSV and graph of the real value with only some easy configuration. You just need to know what&#8217;s the range of your sensor (ex: 0-100°C), what&#8217;s the range of output value of the sensor (ex: 4-20 mA), what does ADC read when the output value is at minimum and at the maximum. To obtain this last values we need only a simple more step.</p>
<p><a href="http://www.farlock.org/wp-content/uploads/2015/04/home.png"><img loading="lazy" decoding="async" class=" size-medium wp-image-239 aligncenter" src="http://www.farlock.org/wp-content/uploads/2015/04/home-282x300.png" alt="home" width="282" height="300" srcset="https://www.farlock.org/wp-content/uploads/2015/04/home-282x300.png 282w, https://www.farlock.org/wp-content/uploads/2015/04/home-141x150.png 141w, https://www.farlock.org/wp-content/uploads/2015/04/home-400x425.png 400w, https://www.farlock.org/wp-content/uploads/2015/04/home.png 708w" sizes="auto, (max-width: 282px) 100vw, 282px" /></a></p>
<p>The setup is very easy, you just need to connect the board to raspberry, power it on, copy the software on it and everything is done. Let&#8217;s go step by step:</p>
<ol>
<li>Connect the board to raspberry and power it on.</li>
<li>Connect to PI with ssh, update it and install apache with php:<br />
# <span style="color: #000080;">sudo apt-get update &amp;&amp; apt-get upgrade</span># <span style="color: #000080;">sudo apt-get install libapache2-mod-php5</span></li>
<li>Download the tarball and extract it on root ( / ) directory.<br />
<blockquote><p><span style="color: #000080;"> cd /tmp</span><br />
<span style="color: #000080;">wget http://www.farlock.org/wp-content/uploads/2015/04/adc_grabber.tar </span><br />
<span style="color: #000080;">cd / </span><br />
<span style="color: #000080;">tar xvf /tmp/adc_grabber.tar</span></p></blockquote>
</li>
<li>It will extract two files in /etc/init.d and /etc/default ; these are needed for startup at boot.<br />
It will extract the cpi3adc.py file in /usr/local/bin and the directory cpi3adc in /usr/local/lib (this contains two included file). Every web page is extracted on /var/www/adc</li>
<li>We need four more steps manually:<br />
<blockquote><p>Edit sudoers file with command:<br />
# <span style="color: #000080;">sudo visudo</span><br />
and add this line at the end:<br />
<span style="color: #800080;">www-data ALL=(ALL) NOPASSWD: ALL</span><br />
add user www-data to group pi with this:<br />
# <span style="color: #000080;">sudo adduser www-data pi</span><br />
Enable startup of the logger on boot:<br />
# <span style="color: #000080;">sudo update-rc.d cpi3adc defaults</span><br />
And finally edit /etc/apache2/sites-enabled/000-default, find the paragraph starting with:<br />
<span style="color: #800080;">&lt;Directory /var/www&gt;</span><br />
and add these lines inside it:<br />
<span style="color: #800080;">Options +ExecCGI</span><br />
<span style="color: #800080;">AddHandler cgi-script .cgi .pl</span><br />
<span style="color: #800080;">RedirectMatch ^/$ /adc/</span></p></blockquote>
</li>
<li>Via web browser connect to your raspberry (you need to know the ip address, ex: 192.168.1.110):<br />
http://192.168.1.100/adc</li>
<li>On this page you can set up global parameters or different ones for each channel (in case you have different sensors).<br />
In my example I have a thermometer with range 0° &#8211; 100°C and output of 4 &#8211; 20 mA.<br />
I have connected it to channel 1 with 100 ohm resistor, look at this image to have an idea:<img loading="lazy" decoding="async" class="alignnone" src="http://www.industrologic.com/4-20ma.gif" alt="" width="328" height="200" /><br />
The problem now is that the resistor is not usually perfect and we need to make some adjustment.</li>
<li>I disconnect my sensor and i connect to analog input a current generator, I set it with 4mA and i click on &#8220;Leggi Valori Attuali&#8221;, this is the result:<br />
<blockquote><p>CANALE &#8211; Volt Ingresso &#8211; Valore Ingresso Puro &#8211; Ingresso  mA &#8211; Valore Calcolato °C<br />
<strong>CH 1</strong> &#8211; Voltage 0.40 &#8211; <strong>Value 655</strong> &#8211; In 4.00 mA &#8211; 0.00 °C<br />
CH 2 &#8211; Voltage 0.08 &#8211; Value 131 &#8211; In 0.80 mA &#8211; -20.05 °C<br />
CH 3 &#8211; Voltage 0.05 &#8211; Value 81 &#8211; In 0.50 mA &#8211; -21.96 °C<br />
CH 4 &#8211; Voltage 0.03 &#8211; Value 43 &#8211; In 0.26 mA &#8211; -23.41 °C<br />
CH 5 &#8211; Voltage 0.01 &#8211; Value 21 &#8211; In 0.13 mV &#8211; -12.13 V<br />
CH 6 &#8211; Voltage 0.01 &#8211; Value 15 &#8211; In 0.09 mA &#8211; -24.48 °C<br />
CH 7 &#8211; Voltage 0.01 &#8211; Value 11 &#8211; In 0.07 mA &#8211; -24.64 °C<br />
CH 8 &#8211; Voltage 0.00 &#8211; Value 7 &#8211; In 0.04 mA &#8211; -24.79 °C</p></blockquote>
<p>Our interest is for the second line (channel 1) and the second field (value), this is the value that ADC reads with an input of 4mA and our resistor.<br />
Now the same thing setting the generator to 20mA, change the generator and press F5 to reload the page, this is the output:</p>
<blockquote><p>CANALE &#8211; Volt Ingresso &#8211; Valore Ingresso Puro &#8211; Ingresso  mA &#8211; Valore Calcolato °C<br />
CH 1 &#8211; Voltage 2.00 &#8211; Value 3269 &#8211; In 20.0 mA &#8211; 100.00 °C</p></blockquote>
<p>The second value is 3269, this is the ADC reading with 20mA.</li>
<li>Now on the homepage you can set the value needed. And you need how to obtain the value for the third column (ADC).</li>
<li>When everything is done you can press &#8220;Salva Valori&#8221;, and then you can start the logger with &#8220;Avvia&#8221;.</li>
<li>If you want to start automatically the logger at boot check &#8220;Avvia automaticamente&#8221; and press &#8220;Salva Valori&#8221;.</li>
<li>The logger grab the data every seconds setted in &#8220;Intervallo in secondi per letture&#8221;, and calculate the average every &#8220;Nr di valori per media&#8221; setted.</li>
<li>You can see the graph in realtime clicking on &#8220;Visualizza Grafico&#8221;, and download CSV clicking on &#8220;Download CSV&#8221;.</li>
</ol>
<p>Download scripts: <a href="http://www.farlock.org/wp-content/uploads/2015/04/adc_grabber.tar">adc_grabber</a></p>
<p>Thanks to:<br />
http://www.sf-innovations.co.uk/custard-pi-3.html</p>
<blockquote class="wp-embedded-content" data-secret="kRj8ER7I0J"><p><a href="https://chrisbaume.wordpress.com/2013/02/10/beer-monitoring/">Beer monitoring with my Raspberry&nbsp;Pi</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  title="&#8220;Beer monitoring with my Raspberry&nbsp;Pi&#8221; &#8212; Chris Baume" src="https://chrisbaume.wordpress.com/2013/02/10/beer-monitoring/embed/#?secret=KKytVQ3cv6#?secret=kRj8ER7I0J" data-secret="kRj8ER7I0J" width="600" height="338" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe><br />
http://dygraphs.com/</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.farlock.org/raspberry-pi/raspberry-web-analog-data-logger/feed/</wfw:commentRss>
			<slash:comments>2</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>
		<item>
		<title>SheevaPlug Debian booting from internal Flash</title>
		<link>https://www.farlock.org/sheevaplug/sheevaplug-debian-booting-from-internal-flash/</link>
					<comments>https://www.farlock.org/sheevaplug/sheevaplug-debian-booting-from-internal-flash/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 26 Jun 2012 16:18:51 +0000</pubDate>
				<category><![CDATA[SheevaPlug]]></category>
		<category><![CDATA[environments]]></category>
		<category><![CDATA[nand flash]]></category>
		<category><![CDATA[u-boot]]></category>
		<guid isPermaLink="false">http://www.farlock.org/?p=191</guid>

					<description><![CDATA[<p>If you previosuly installed Debian on your internal flash and for some reasons your u-boot environment f**k you can simply restore it with this:</p> <p>setenv mtdpartitions mtdparts=nand_mtd:0xa0000@0x0(u-boot),0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs)</p> <p>setenv bootargs_root ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs</p> <p>setenv bootargs_console console=ttyS0,115200</p> <p>setenv bootcmd_nand &#8216;nand read.e 0x00800000 0x00100000 0x00400000&#8217;</p> <p>setenv bootcmd &#8216;setenv bootargs $(bootargs_console) $(mtdpartitions) $(bootargs_root); run bootcmd_nand; bootm 0x00800000&#8217;</p> <p>saveenv</p> <p>This [...]]]></description>
										<content:encoded><![CDATA[<p>If you previosuly installed Debian on your internal flash and for some reasons your u-boot environment f**k you can simply restore it with this:</p>
<blockquote><p>setenv mtdpartitions mtdparts=nand_mtd:0xa0000@0x0(u-boot),0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs)</p>
<p>setenv bootargs_root ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs</p>
<p>setenv bootargs_console console=ttyS0,115200</p>
<p>setenv bootcmd_nand &#8216;nand read.e 0x00800000 0x00100000 0x00400000&#8217;</p>
<p>setenv bootcmd &#8216;setenv bootargs $(bootargs_console) $(mtdpartitions) $(bootargs_root); run bootcmd_nand; bootm 0x00800000&#8217;</p>
<p>saveenv</p></blockquote>
<p>This saved me, hope that can help you <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>
]]></content:encoded>
					
					<wfw:commentRss>https://www.farlock.org/sheevaplug/sheevaplug-debian-booting-from-internal-flash/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
