<?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 - Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</title>
	<atom:link href="https://boxvirt.com/category/mikrotik/feed/" rel="self" type="application/rss+xml" />
	<link>https://boxvirt.com/category/mikrotik/</link>
	<description>Practical self-hosted infrastructure guides for Proxmox, OPNsense, and Docker.</description>
	<lastBuildDate>Sat, 02 Aug 2025 21:36:10 +0000</lastBuildDate>
	<language>ru-RU</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://boxvirt.com/wp-content/uploads/2025/07/cropped-ChatGPT-Image-12-июл.-2025-г.-19_41_55-32x32.png</url>
	<title>Архивы Mikrotik - Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</title>
	<link>https://boxvirt.com/category/mikrotik/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Firewall Logging, Backups &#038; Best Practices</title>
		<link>https://boxvirt.com/firewall-logging-backups-best-practices/</link>
					<comments>https://boxvirt.com/firewall-logging-backups-best-practices/#respond</comments>
		
		<dc:creator><![CDATA[eXtre]]></dc:creator>
		<pubDate>Sat, 02 Aug 2025 21:36:09 +0000</pubDate>
				<category><![CDATA[Mikrotik]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[MikroTik]]></category>
		<category><![CDATA[Setup]]></category>
		<guid isPermaLink="false">https://boxvirt.com/?p=131</guid>

					<description><![CDATA[<p>— Keep It Clean, Recoverable, and Easy to Maintain Why This Matters A solid firewall config can take hours to build — but minutes to lose. Whether it’s: [&#8230;]</p>
<p>Сообщение <a href="https://boxvirt.com/firewall-logging-backups-best-practices/">Firewall Logging, Backups &#038; Best Practices</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3 class="wp-block-heading">— Keep It Clean, Recoverable, and Easy to Maintain</h3>



<h2 class="wp-block-heading">Why This Matters</h2>



<p>A solid firewall config can take hours to build — but minutes to lose.</p>



<p>Whether it’s:</p>



<ul class="wp-block-list">
<li>A reboot gone wrong</li>



<li>A bad rule blocking your access</li>



<li>An upgrade that resets the config</li>



<li>Or simply forgetting what each rule does&#8230;</li>
</ul>



<p>You need a <strong>system</strong> to keep your firewall alive, readable, and resilient.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f501.png" alt="🔁" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 1. Regular Backups and Exports</h2>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4cd.png" alt="📍" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Difference Between Backup and Export:</h3>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Type</th><th>What it does</th></tr></thead><tbody><tr><td><code>backup</code></td><td>Binary file of full system config (not readable/editable)</td></tr><tr><td><code>export</code></td><td>Human-readable script you can tweak or version control</td></tr></tbody></table></figure>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4e5.png" alt="📥" class="wp-smiley" style="height: 1em; max-height: 1em;" /> How to Backup:</h3>



<pre class="wp-block-preformatted"><code>/system backup save name=firewall_config<br></code></pre>



<p>You’ll get a file like <code>firewall_config.backup</code> in <strong>Files</strong> — download it to your PC!</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4e4.png" alt="📤" class="wp-smiley" style="height: 1em; max-height: 1em;" /> How to Export Firewall Only:</h3>



<pre class="wp-block-preformatted"><code>/export file=firewall_export<br></code></pre>



<p>You’ll get <code>firewall_export.rsc</code>.<br>You can edit, version in Git, or apply on other routers.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9fc.png" alt="🧼" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 2. Use Comments Everywhere</h2>



<p>Every rule, every address list, every NAT line — <strong>must</strong> have a comment.</p>



<p>Example:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=input src-address-list=TRUSTED_IPS action=accept comment="Allow remote Winbox"<br>/ip firewall nat<br>add chain=dstnat dst-port=443 action=dst-nat to-addresses=192.168.88.100 comment="HTTPS to NAS"<br></code></pre>



<p>It’s not optional — <strong>future you will thank you</strong>.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4da.png" alt="📚" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 3. Group Rules Logically</h2>



<p>Use <strong>grouping by chain and purpose</strong>, for example:</p>



<ul class="wp-block-list">
<li>Section 1: Input chain</li>



<li>Section 2: Forward chain (LAN access)</li>



<li>Section 3: Forward chain (guest/VPN)</li>



<li>Section 4: NAT rules</li>



<li>Section 5: Special protections (DoS, brute-force)</li>



<li>Section 6: Logging and drops</li>
</ul>



<p>You can even add <strong>empty comment rules</strong> as section headers:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add comment="=== INPUT CHAIN START ==="<br></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4c8.png" alt="📈" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 4. Monitor With Logging (But Not Too Much)</h2>



<p>Logging is great — until it crashes your CPU.</p>



<p>Tips:</p>



<ul class="wp-block-list">
<li>Only log <strong>important drops</strong>, like SSH brute-force or port scans</li>



<li>Use <code>log-prefix=</code> to easily grep or filter</li>



<li>Use <strong>log limits</strong> to reduce spam:</li>
</ul>



<pre class="wp-block-preformatted"><code>add chain=input src-address-list=SSH_BRUTE action=drop log=yes log-prefix="SSH_BRUTE " log-disabled=no<br></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f512.png" alt="🔒" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 5. Lock Yourself Out? Here’s the Rescue Plan</h2>



<p>If you apply a bad rule and lose access — do one of the following:</p>



<h3 class="wp-block-heading">Option 1: MAC Winbox</h3>



<ul class="wp-block-list">
<li>Connect directly via Winbox using MAC address</li>



<li>It bypasses IP settings</li>



<li>Only works in L2</li>
</ul>



<h3 class="wp-block-heading">Option 2: Netinstall Reset</h3>



<ul class="wp-block-list">
<li>Use MikroTik’s <strong>Netinstall</strong> to reflash router</li>



<li>You&#8217;ll need physical access and boot from Netinstall server</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9e0.png" alt="🧠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 6. Pro Tips From the Field</h2>



<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Use <strong>Address Lists</strong> for everything — even internal networks<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Document <strong>every rule</strong> in a <code>.md</code> or <code>.rsc</code> file<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Export rules monthly and save in Git or cloud<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Use <strong>scheduled scripts</strong> to check config or notify you<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Disable unused services in <code>/ip service</code></p>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Final Summary</h2>



<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f3af.png" alt="🎯" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You’ve now built a fully functional, professional-grade MikroTik firewall with:</p>



<ul class="wp-block-list">
<li>Clear input/forward logic</li>



<li>Dynamic protection against attacks</li>



<li>NAT and Hairpin NAT</li>



<li>Scalable address lists</li>



<li>Clean, well-commented rules</li>



<li>Backups, logging, and recovery plans</li>
</ul>
<p>Сообщение <a href="https://boxvirt.com/firewall-logging-backups-best-practices/">Firewall Logging, Backups &#038; Best Practices</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://boxvirt.com/firewall-logging-backups-best-practices/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Understanding NAT &#038; Hairpin NAT in MikroTik</title>
		<link>https://boxvirt.com/understanding-nat-hairpin-nat-in-mikrotik/</link>
					<comments>https://boxvirt.com/understanding-nat-hairpin-nat-in-mikrotik/#respond</comments>
		
		<dc:creator><![CDATA[eXtre]]></dc:creator>
		<pubDate>Sat, 02 Aug 2025 21:33:39 +0000</pubDate>
				<category><![CDATA[Mikrotik]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Setup]]></category>
		<guid isPermaLink="false">https://boxvirt.com/?p=128</guid>

					<description><![CDATA[<p>— Make Local and External Access Work Seamlessly What is NAT? NAT (Network Address Translation) lets multiple devices on your internal network (usually private IPs like 192.168.x.x) share [&#8230;]</p>
<p>Сообщение <a href="https://boxvirt.com/understanding-nat-hairpin-nat-in-mikrotik/">Understanding NAT &#038; Hairpin NAT in MikroTik</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3 class="wp-block-heading">— Make Local and External Access Work Seamlessly</h3>



<h2 class="wp-block-heading">What is NAT?</h2>



<p><strong>NAT</strong> (Network Address Translation) lets multiple devices on your internal network (usually private IPs like <code>192.168.x.x</code>) share a single public IP to communicate with the internet.</p>



<p>MikroTik uses <strong>source NAT (src-nat)</strong> with <strong>masquerade</strong> by default to make this happen.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9ed.png" alt="🧭" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Basic Outbound NAT — Internet Access for LAN</h3>



<p>Let’s make sure devices in your LAN can access the internet.</p>



<pre class="wp-block-preformatted"><code>/ip firewall nat<br>add chain=srcnat out-interface-list=WAN action=masquerade comment="LAN to internet"<br></code></pre>



<p>This tells MikroTik:<br>“All packets leaving the WAN interface should have their source IP replaced with the router’s public IP.”</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4e5.png" alt="📥" class="wp-smiley" style="height: 1em; max-height: 1em;" /> What About Incoming Connections?</h2>



<p>Suppose you want to host something like:</p>



<ul class="wp-block-list">
<li>A website on your NAS</li>



<li>An Immich gallery on your home server</li>



<li>A game server on your PC</li>
</ul>



<p>You’ll need to <strong>port-forward</strong> incoming traffic from your public IP to the correct internal IP.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f310.png" alt="🌐" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step-by-Step: Create a Destination NAT (Port Forward)</h2>



<p>Let’s say your NAS is at <code>192.168.88.100</code> and you want to expose HTTPS (TCP port 443):</p>



<pre class="wp-block-preformatted"><code>/ip firewall nat<br>add chain=dstnat dst-address=YOUR_PUBLIC_IP protocol=tcp dst-port=443 \<br>    action=dst-nat to-addresses=192.168.88.100 to-ports=443 comment="Forward HTTPS to NAS"<br></code></pre>



<p>If you have a dynamic IP, you can use interface lists instead:</p>



<pre class="wp-block-preformatted"><code>/ip firewall nat<br>add chain=dstnat in-interface-list=WAN protocol=tcp dst-port=443 \<br>    action=dst-nat to-addresses=192.168.88.100 to-ports=443 comment="Forward HTTPS"<br></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f300.png" alt="🌀" class="wp-smiley" style="height: 1em; max-height: 1em;" /> What Is Hairpin NAT?</h2>



<p>Imagine this:</p>



<ul class="wp-block-list">
<li>Your DNS (e.g., Unbound or Pi-hole) resolves <code>nas.yourdomain.com</code> to your public IP</li>



<li>You’re inside your home network</li>



<li>You open <code>https://nas.yourdomain.com</code></li>
</ul>



<p>Now your request leaves the LAN → goes to the router’s public IP → hits the port forward… and fails <img src="https://s.w.org/images/core/emoji/16.0.1/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p>That’s because by default, <strong>MikroTik doesn’t know how to reflect this back to LAN</strong> — it’s confused because the destination is “external,” but the source is internal.</p>



<p>That’s where <strong>Hairpin NAT</strong> comes in.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f527.png" alt="🔧" class="wp-smiley" style="height: 1em; max-height: 1em;" /> How to Enable Hairpin NAT</h2>



<p>You’ll need two extra rules to make it work:</p>



<h3 class="wp-block-heading">1. Accept Internal Reflection in Firewall</h3>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=forward src-address=192.168.88.0/24 dst-address=192.168.88.100 action=accept \<br>    comment="Allow hairpin access to NAS"<br></code></pre>



<p>Adjust IPs accordingly.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">2. Add NAT Reflection Rule</h3>



<p>This rule rewrites the source address so the internal server sees it as coming from the router:</p>



<pre class="wp-block-preformatted"><code>/ip firewall nat<br>add chain=srcnat src-address=192.168.88.0/24 dst-address=192.168.88.100 \<br>    out-interface=bridge action=masquerade comment="Hairpin NAT"<br></code></pre>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Replace <code>bridge</code> with your LAN bridge or interface if different.</p>
</blockquote>



<p>Now you can access <code>https://yourdomain.com</code> <strong>inside your LAN</strong>, and it will hit the internal server without issues.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/26a0.png" alt="⚠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Troubleshooting Tips</h2>



<ul class="wp-block-list">
<li>Make sure your <strong>port forward is above</strong> the general masquerade rule in NAT</li>



<li>Check that your firewall <strong>forward chain allows</strong> the internal access</li>



<li>If using VLANs, match the correct interfaces/subnets in Hairpin NAT rule</li>



<li>Test from a real client, not the router itself</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9fe.png" alt="🧾" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Full Example: HTTPS to NAS With Hairpin</h2>



<pre class="wp-block-preformatted"><code># Port forward<br>/ip firewall nat<br>add chain=dstnat in-interface-list=WAN protocol=tcp dst-port=443 \<br>    action=dst-nat to-addresses=192.168.88.100 to-ports=443 comment="HTTPS to NAS"<br><br># Hairpin NAT<br>/ip firewall nat<br>add chain=srcnat src-address=192.168.88.0/24 dst-address=192.168.88.100 \<br>    out-interface=bridge action=masquerade comment="Hairpin NAT"<br><br># Allow forward<br>/ip firewall filter<br>add chain=forward src-address=192.168.88.0/24 dst-address=192.168.88.100 action=accept<br></code></pre>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Summary</h2>



<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You understand what NAT and port forwarding are<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You can expose internal services to the public safely<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You added Hairpin NAT to make them accessible locally<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You troubleshooted common issues like DNS and interfaces</p>
<p>Сообщение <a href="https://boxvirt.com/understanding-nat-hairpin-nat-in-mikrotik/">Understanding NAT &#038; Hairpin NAT in MikroTik</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://boxvirt.com/understanding-nat-hairpin-nat-in-mikrotik/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Firewall Protection Against Attacks</title>
		<link>https://boxvirt.com/firewall-protection-against-attacks/</link>
					<comments>https://boxvirt.com/firewall-protection-against-attacks/#respond</comments>
		
		<dc:creator><![CDATA[eXtre]]></dc:creator>
		<pubDate>Sat, 02 Aug 2025 21:31:21 +0000</pubDate>
				<category><![CDATA[Mikrotik]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[MikroTik]]></category>
		<guid isPermaLink="false">https://boxvirt.com/?p=125</guid>

					<description><![CDATA[<p>— Block, Detect, and Log Like a Pro Why MikroTik Routers Get Targeted If your router has a public IP — it will be scanned.Thousands of bots around [&#8230;]</p>
<p>Сообщение <a href="https://boxvirt.com/firewall-protection-against-attacks/">Firewall Protection Against Attacks</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3 class="wp-block-heading">— Block, Detect, and Log Like a Pro</h3>



<h2 class="wp-block-heading">Why MikroTik Routers Get Targeted</h2>



<p>If your router has a public IP — it <em>will</em> be scanned.<br>Thousands of bots around the world constantly:</p>



<ul class="wp-block-list">
<li>Look for open Winbox, SSH, Telnet, or API ports</li>



<li>Try brute-force logins</li>



<li>Launch SYN floods and DoS attacks</li>



<li>Abuse open DNS for reflection attacks</li>
</ul>



<p>Even a home router gets hit dozens of times a day.</p>



<p>So let’s build rules that:</p>



<ul class="wp-block-list">
<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f512.png" alt="🔒" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Drop malicious traffic</li>



<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f6ab.png" alt="🚫" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Rate-limit brute-force attempts</li>



<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f575.png" alt="🕵" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Detect scanners</li>



<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f514.png" alt="🔔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Log suspicious activity</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9f1.png" alt="🧱" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 1: Detect and Drop Port Scanners</h2>



<p>MikroTik has a neat feature to <strong>detect port scanning</strong> automatically.</p>



<p>Add this rule near the top of your input chain:</p>



<pre class="wp-block-preformatted">bashКопироватьРедактировать<code>/ip firewall filter
add chain=input protocol=tcp psd=21,3s,3,1 action=add-src-to-address-list \
    address-list=PORT_SCANNERS address-list-timeout=1d comment="Detect TCP port scan"
</code></pre>



<p>Explanation:</p>



<ul class="wp-block-list">
<li>Detects if 21 different TCP ports are probed in 3 seconds</li>



<li>Adds the source IP to <code>PORT_SCANNERS</code> list</li>



<li>Keeps it blocked for 1 day</li>
</ul>



<p>Now, block those scanners:</p>



<pre class="wp-block-preformatted">bashКопироватьРедактировать<code>/ip firewall filter
add chain=input src-address-list=PORT_SCANNERS action=drop comment="Drop port scanners"
</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f6ab.png" alt="🚫" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 2: Drop Bogon and Reserved IPs on WAN</h2>



<p>Bots often spoof invalid IPs — like private ranges or loopback — that should never appear on WAN.</p>



<p>Block them at the input chain (and forward, if needed):</p>



<pre class="wp-block-preformatted">bashКопироватьРедактировать<code>/ip firewall filter
add chain=input src-address=0.0.0.0/8 action=drop comment="Drop bogus src IP"
add chain=input src-address=127.0.0.0/8 action=drop comment="Drop loopback"
add chain=input src-address=10.0.0.0/8 action=drop comment="Drop private src"
add chain=input src-address=169.254.0.0/16 action=drop comment="Drop link-local"
add chain=input src-address=192.168.0.0/16 action=drop comment="Drop private src"
</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4a3.png" alt="💣" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 3: Basic DoS Protection (SYN Flood, Ping Flood)</h2>



<p>MikroTik supports <strong>connection limits and rate matching</strong>.</p>



<h3 class="wp-block-heading">Limit TCP SYN connections per IP:</h3>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=input protocol=tcp tcp-flags=syn connection-limit=30,32 \<br>    action=add-src-to-address-list address-list=SYN_FLOODERS \<br>    address-list-timeout=1d comment="SYN flood detect"<br>add chain=input src-address-list=SYN_FLOODERS action=drop comment="Drop SYN flooders"<br></code></pre>



<h3 class="wp-block-heading">Limit ICMP (Ping) Floods:</h3>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=input protocol=icmp limit=5,10 action=accept comment="Allow limited ping"<br>add chain=input protocol=icmp action=drop comment="Drop excessive ping"<br></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f511.png" alt="🔑" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 4: Brute Force Protection — SSH, Winbox, etc.</h2>



<p>We’ll use <strong>connection rate limits</strong> to detect brute force:</p>



<h3 class="wp-block-heading">SSH Brute-Force Detection:</h3>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=input protocol=tcp dst-port=22 src-address-list=!TRUSTED_IPS \<br>    connection-state=new src-address-list=!SSH_WHITELIST \<br>    action=add-src-to-address-list address-list=SSH_BRUTE address-list-timeout=1d \<br>    comment="SSH brute force detector"<br><br>add chain=input src-address-list=SSH_BRUTE action=drop comment="Drop SSH brute IPs"<br></code></pre>



<p>You can repeat this for Winbox (port 8291), Telnet, or other services.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4cb.png" alt="📋" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 5: Log Suspicious Behavior (Optional but Useful)</h2>



<p>You can log any drop or suspicious action:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=input src-address-list=SSH_BRUTE action=drop log=yes log-prefix="SSH BRUTE: "<br></code></pre>



<p>Just remember: <strong>log carefully</strong>. If you&#8217;re under a flood, logging every packet can overload your router.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/26a0.png" alt="⚠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Tip: Use Connection Limits for Other Abuse Scenarios</h2>



<p>If you suspect spamming, malware, or excessive usage — you can add <strong>connection limits</strong> per IP or per subnet.</p>



<p>Example:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=forward protocol=tcp dst-port=25 src-address-list=LAN_SUBNETS \<br>    connection-limit=10,32 action=drop comment="Limit SMTP spam"<br></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4c1.png" alt="📁" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Example: Full Protection Ruleset Snippet</h2>



<pre class="wp-block-preformatted"><code># Port scan detection<br>add chain=input protocol=tcp psd=21,3s,3,1 action=add-src-to-address-list \<br>    address-list=PORT_SCANNERS address-list-timeout=1d comment="Port scan detect"<br>add chain=input src-address-list=PORT_SCANNERS action=drop<br><br># Brute force protection<br>add chain=input protocol=tcp dst-port=22 connection-state=new \<br>    src-address-list=!TRUSTED_IPS action=add-src-to-address-list \<br>    address-list=SSH_BRUTE address-list-timeout=1d comment="SSH brute detect"<br>add chain=input src-address-list=SSH_BRUTE action=drop<br><br># SYN flood<br>add chain=input protocol=tcp tcp-flags=syn connection-limit=30,32 \<br>    action=add-src-to-address-list address-list=SYN_FLOODERS address-list-timeout=1d<br>add chain=input src-address-list=SYN_FLOODERS action=drop<br><br># ICMP rate limit<br>add chain=input protocol=icmp limit=5,10 action=accept<br>add chain=input protocol=icmp action=drop<br><br># Bogon drop<br>add chain=input src-address=0.0.0.0/8 action=drop<br>add chain=input src-address=10.0.0.0/8 action=drop<br>add chain=input src-address=127.0.0.0/8 action=drop<br></code></pre>



<p></p>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Summary</h2>



<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You’ve implemented rules against port scanners, brute force, SYN floods, and ping floods<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You block reserved and spoofed IPs<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You rate-limit ICMP and connection abuse<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You log and block offenders dynamically<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You’re now <strong>very hard to scan or attack</strong></p>
<p>Сообщение <a href="https://boxvirt.com/firewall-protection-against-attacks/">Firewall Protection Against Attacks</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://boxvirt.com/firewall-protection-against-attacks/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Forward Chain Firewall Rules: Controlling LAN, Guests, and the Internet</title>
		<link>https://boxvirt.com/forward-chain-firewall-rules-controlling-lan-guests-and-the-internet/</link>
					<comments>https://boxvirt.com/forward-chain-firewall-rules-controlling-lan-guests-and-the-internet/#respond</comments>
		
		<dc:creator><![CDATA[eXtre]]></dc:creator>
		<pubDate>Sat, 02 Aug 2025 21:28:24 +0000</pubDate>
				<category><![CDATA[Mikrotik]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[MikroTik]]></category>
		<guid isPermaLink="false">https://boxvirt.com/?p=122</guid>

					<description><![CDATA[<p>What Is the Forward Chain? In MikroTik’s firewall, the forward chain handles traffic that passes through the router — not destined to it. Examples: If it goes through [&#8230;]</p>
<p>Сообщение <a href="https://boxvirt.com/forward-chain-firewall-rules-controlling-lan-guests-and-the-internet/">Forward Chain Firewall Rules: Controlling LAN, Guests, and the Internet</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">What Is the Forward Chain?</h2>



<p>In MikroTik’s firewall, the <strong>forward chain</strong> handles traffic that <strong>passes through</strong> the router — not destined to it.</p>



<p>Examples:</p>



<ul class="wp-block-list">
<li>Your laptop accessing google.com</li>



<li>A guest phone trying to stream Netflix</li>



<li>A surveillance camera sending footage to the cloud</li>



<li>A VPN client accessing a NAS in your LAN</li>
</ul>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>If it goes <em>through</em> the router from one interface to another — it hits the <code>forward</code> chain.</p>
</blockquote>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9e0.png" alt="🧠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Default MikroTik Behavior</h2>



<p>By default, MikroTik allows everything in <code>forward</code> chain. That means:</p>



<ul class="wp-block-list">
<li>LAN can access WAN</li>



<li>Devices in different subnets can talk to each other</li>



<li>IoT devices can ping your servers</li>



<li>Anyone on your guest Wi-Fi can scan your home PCs</li>
</ul>



<p>Sounds bad? It is.</p>



<p><strong>We’re going to change that.</strong></p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f512.png" alt="🔒" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Our Goal</h2>



<ul class="wp-block-list">
<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Allow LAN to go to the internet</li>



<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Block internet from accessing LAN (unsolicited)</li>



<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Segment guests, IoT, and sensitive networks</li>



<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Only allow specific cross-subnet traffic</li>



<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Detect and log suspicious or brute-force attempts</li>



<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Rate-limit scans and flooding</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9f1.png" alt="🧱" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 1: Allow Established and Related Connections</h2>



<p>We always start here:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=forward connection-state=established,related action=accept comment="Allow related &amp; established"<br></code></pre>



<p>This permits returning traffic like replies to web requests.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f528.png" alt="🔨" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 2: Drop Invalid Connections</h2>



<p>Packets without context or connection tracking often indicate garbage, malware, or errors:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=forward connection-state=invalid action=drop comment="Drop invalid"<br></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f310.png" alt="🌐" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 3: Allow LAN and VPN to Internet</h2>



<p>We’ll assume you already have <code>LAN_SUBNETS</code> and <code>VPN_SUBNETS</code> address lists. You allow these to go out:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=forward src-address-list=LAN_SUBNETS out-interface-list=WAN action=accept comment="LAN to internet"<br>/ip firewall filter<br>add chain=forward src-address-list=VPN_SUBNETS out-interface-list=WAN action=accept comment="VPN to internet"<br></code></pre>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Optional: Instead of <code>out-interface-list=WAN</code>, you can use <code>dst-address-type=!local</code> or other advanced filtering.</p>
</blockquote>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f6b7.png" alt="🚷" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 4: Block Inter-Subnet Traffic (Optional)</h2>



<p>If you don’t want your guest network to access your private network, <strong>drop or restrict it</strong>.</p>



<p>Example:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=forward src-address=192.168.20.0/24 dst-address=192.168.88.0/24 action=drop comment="Block Guest to LAN"<br></code></pre>



<p>You can also use interface lists or VLANs here.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f440.png" alt="👀" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 5: Log and Drop Everything Else</h2>



<p>At the bottom of the chain, drop all other forward attempts. Optionally log them:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=forward log=yes log-prefix="Dropped FORWARD: " action=drop<br></code></pre>



<p>Or just quietly drop:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=forward action=drop comment="Drop all else"<br></code></pre>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Pro Tip: If you&#8217;re running services that should be reachable (e.g., port forwards), you&#8217;ll create <strong>exceptions before this drop rule</strong>.</p>
</blockquote>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f504.png" alt="🔄" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Optional: Allow Specific Internal Flows</h2>



<p>For example, if a VPN client needs to reach a NAS in your LAN:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=forward src-address=10.10.10.0/24 dst-address=192.168.88.100 protocol=tcp dst-port=445 action=accept comment="VPN to NAS (SMB)"<br></code></pre>



<p>Or allow ICMP (ping) between LAN and VPN:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=forward src-address-list=VPN_SUBNETS dst-address-list=LAN_SUBNETS protocol=icmp action=accept comment="VPN ping LAN"<br></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Forward Chain Example (Clean &amp; Secure)</h2>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=forward connection-state=established,related action=accept comment="Allow known connections"<br>add chain=forward connection-state=invalid action=drop comment="Drop invalid"<br><br>add chain=forward src-address-list=LAN_SUBNETS out-interface-list=WAN action=accept comment="LAN internet"<br>add chain=forward src-address-list=VPN_SUBNETS out-interface-list=WAN action=accept comment="VPN internet"<br><br>add chain=forward src-address=192.168.20.0/24 dst-address=192.168.88.0/24 action=drop comment="Guest to LAN — blocked"<br><br>add chain=forward action=drop comment="Drop everything else"<br></code></pre>



<h2 class="wp-block-heading"></h2>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Summary</h2>



<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You&#8217;ve secured the forward chain<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You allowed legitimate traffic to pass<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Blocked inter-subnet traffic where needed<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Dropped unknown or invalid connections<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Laid the groundwork for firewall segmentation</p>
<p>Сообщение <a href="https://boxvirt.com/forward-chain-firewall-rules-controlling-lan-guests-and-the-internet/">Forward Chain Firewall Rules: Controlling LAN, Guests, and the Internet</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://boxvirt.com/forward-chain-firewall-rules-controlling-lan-guests-and-the-internet/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Protecting Router Access: Lock Down the Input Chain Like a Pro</title>
		<link>https://boxvirt.com/protecting-router-access-lock-down-the-input-chain-like-a-pro/</link>
					<comments>https://boxvirt.com/protecting-router-access-lock-down-the-input-chain-like-a-pro/#respond</comments>
		
		<dc:creator><![CDATA[eXtre]]></dc:creator>
		<pubDate>Sat, 02 Aug 2025 21:22:10 +0000</pubDate>
				<category><![CDATA[Mikrotik]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[MikroTik]]></category>
		<guid isPermaLink="false">https://boxvirt.com/?p=119</guid>

					<description><![CDATA[<p>Why This Is Critical The input chain governs access to your router itself — the Winbox interface, SSH terminal, web admin panel (WebFig), DNS, and more. If this [&#8230;]</p>
<p>Сообщение <a href="https://boxvirt.com/protecting-router-access-lock-down-the-input-chain-like-a-pro/">Protecting Router Access: Lock Down the Input Chain Like a Pro</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Why This Is Critical</h2>



<p>The <strong>input chain</strong> governs <strong>access to your router itself</strong> — the Winbox interface, SSH terminal, web admin panel (WebFig), DNS, and more. If this chain is open, you&#8217;re essentially leaving your MikroTik <strong>naked on the internet</strong>.</p>



<p>And bots <em>will</em> try to log in. Constantly.</p>



<p>Even if they fail, just the traffic volume can cause performance issues, log flooding, and trigger ISP abuse reports.</p>



<p>So, our goal is clear: <strong>Block everything by default</strong>, then <strong>allow only trusted IPs</strong> to access administrative services.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f527.png" alt="🔧" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step-by-Step Strategy</h2>



<ol class="wp-block-list">
<li><strong>Allow established and related connections</strong></li>



<li><strong>Allow access from trusted IPs / LAN</strong></li>



<li><strong>Block new WAN connections</strong></li>



<li><strong>Log attempts from unknown sources (optional)</strong></li>



<li><strong>Disable unused services like FTP, Telnet</strong></li>



<li><strong>Secure access with strong passwords and timeouts</strong></li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f510.png" alt="🔐" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 1: Allow Safe Traffic</h2>



<p>First, as discussed in earlier sections, allow already-established connections and those related to them (like ICMP replies):</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=input connection-state=established,related action=accept comment="Allow established &amp; related"<br></code></pre>



<p>This ensures existing connections, like your current Winbox session, won’t get cut off.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f465.png" alt="👥" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 2: Allow Access from Trusted Sources</h2>



<p>Here, we’ll permit only specific IPs and subnets — defined earlier in our <code>TRUSTED_IPS</code> and <code>LAN_SUBNETS</code> address lists.</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=input src-address-list=TRUSTED_IPS action=accept comment="Allow admin access from trusted IPs"<br>/ip firewall filter<br>add chain=input src-address-list=LAN_SUBNETS action=accept comment="Allow access from LAN"<br></code></pre>



<p>You can also target specific ports:</p>



<pre class="wp-block-preformatted"><code>add chain=input src-address-list=TRUSTED_IPS protocol=tcp dst-port=8291,22 action=accept comment="Allow Winbox &amp; SSH"<br></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 3: Drop Everything Else</h2>



<p>Now it’s time to block <em>everything not explicitly allowed</em>. And we’ll do this <strong>carefully</strong>, placing this rule <em>after</em> all previous accepts:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=input connection-state=new action=drop comment="Drop all new inbound connections"<br></code></pre>



<p>This rule will reject any new connection attempt to the router itself — unless it came from a trusted address.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f514.png" alt="🔔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 4: Optional Logging (for Curiosity or Forensics)</h2>



<p>Want to see who’s knocking on your WAN interface? You can log their attempts like this:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=input connection-state=new log=yes log-prefix="Blocked INPUT: " action=drop<br></code></pre>



<p>But be careful — under attack, logs can grow rapidly. Use it temporarily or with rate limits.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f6e0.png" alt="🛠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 5: Disable Unused MikroTik Services</h2>



<p>By default, RouterOS enables things like:</p>



<ul class="wp-block-list">
<li>Telnet (TCP 23)</li>



<li>FTP (TCP 21)</li>



<li>WebFig (TCP 80, 443)</li>



<li>Winbox (TCP 8291)</li>



<li>SSH (TCP 22)</li>



<li>API ports (8728, 8729)</li>
</ul>



<p>If you’re not using a service — disable it:</p>



<pre class="wp-block-preformatted"><code>/ip service disable telnet<br>/ip service disable ftp<br>/ip service disable www<br>/ip service disable www-ssl<br></code></pre>



<p>You can also restrict services to certain interfaces or address lists:</p>



<pre class="wp-block-preformatted"><code>/ip service set winbox address=192.168.88.0/24<br></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f512.png" alt="🔒" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 6: Secure Credentials and Access Settings</h2>



<p>Even with firewall rules, don’t forget:</p>



<ul class="wp-block-list">
<li>Use strong passwords for all user accounts</li>



<li>Don’t use the default <code>admin</code> user — disable or rename it</li>



<li>Set <code>System → Users → Group → Policies</code> carefully</li>



<li>Set Winbox inactivity timeouts under <code>Tools → Settings</code></li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Summary</h2>



<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You’ve locked down direct access to the router<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Only <strong>trusted IPs or LAN</strong> can manage the router<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Everything else is blocked or logged<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You’ve disabled services you don’t use<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Your firewall input chain is clean, simple, and secure</p>
<p>Сообщение <a href="https://boxvirt.com/protecting-router-access-lock-down-the-input-chain-like-a-pro/">Protecting Router Access: Lock Down the Input Chain Like a Pro</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://boxvirt.com/protecting-router-access-lock-down-the-input-chain-like-a-pro/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Address Lists for Humans (and Hackers) MikroTik</title>
		<link>https://boxvirt.com/address-lists-for-humans-and-hackers-mikrotik/</link>
					<comments>https://boxvirt.com/address-lists-for-humans-and-hackers-mikrotik/#respond</comments>
		
		<dc:creator><![CDATA[eXtre]]></dc:creator>
		<pubDate>Sat, 02 Aug 2025 21:17:21 +0000</pubDate>
				<category><![CDATA[Mikrotik]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[MikroTik]]></category>
		<category><![CDATA[Setup]]></category>
		<guid isPermaLink="false">https://boxvirt.com/?p=116</guid>

					<description><![CDATA[<p>Grouping IPs the Smart Way in Your MikroTik Firewall Let’s face it — if you’ve ever tried managing a firewall with individual IP rules, you know it gets [&#8230;]</p>
<p>Сообщение <a href="https://boxvirt.com/address-lists-for-humans-and-hackers-mikrotik/">Address Lists for Humans (and Hackers) MikroTik</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3 class="wp-block-heading">Grouping IPs the Smart Way in Your MikroTik Firewall</h3>



<p>Let’s face it — if you’ve ever tried managing a firewall with individual IP rules, you know it gets messy fast. One rule for your laptop, another for your phone, a separate one for your work VPN, and maybe one more for your buddy’s IP that you forgot to label properly. Before you know it, your rule set looks like a crime scene.</p>



<p><strong>Address Lists</strong> fix that.</p>



<p>They let you group IPs into logical categories and reference them in your rules. Once you start using them, you’ll wonder how you ever lived without them.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4cc.png" alt="📌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> What Is an Address List?</h2>



<p>In MikroTik, an address list is simply a <strong>named group of IP addresses or subnets</strong>. You can reference them in:</p>



<ul class="wp-block-list">
<li>Firewall filter rules</li>



<li>NAT rules</li>



<li>Mangle rules</li>



<li>And even scripts</li>
</ul>



<p>Instead of writing 5 different rules for 5 IPs — you can write <strong>one</strong> rule and maintain the list separately. This keeps your rules clean, readable, and easy to update.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f3af.png" alt="🎯" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Why Use Address Lists?</h2>



<p>Here’s what you get when you build your rules around address lists:</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Benefit</th><th><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Why it matters</th></tr></thead><tbody><tr><td><strong>Clarity</strong></td><td>You’ll immediately know what the rule is protecting</td></tr><tr><td><strong>Simplicity</strong></td><td>Fewer firewall rules overall</td></tr><tr><td><strong>Scalability</strong></td><td>Easily add/remove IPs without editing rule logic</td></tr><tr><td><strong>Automation</strong></td><td>Use scripts or dynamic rules to update lists</td></tr><tr><td><strong>Security</strong></td><td>Group risky IPs together for blocking or limiting</td></tr></tbody></table></figure>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f3d7.png" alt="🏗" class="wp-smiley" style="height: 1em; max-height: 1em;" /> The Essential Lists You Should Create</h2>



<p>Here’s a professional starter kit of address lists you can (and should) build:</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Address List</th><th>Purpose</th></tr></thead><tbody><tr><td><code>LAN_SUBNETS</code></td><td>All your internal subnets (192.168.x.x, etc.)</td></tr><tr><td><code>TRUSTED_IPS</code></td><td>Remote IPs allowed access to Winbox, SSH, etc.</td></tr><tr><td><code>BLOCKED_IPS</code></td><td>Attackers, port scanners, brute-force attempts</td></tr><tr><td><code>VPN_SUBNETS</code></td><td>Subnets used by connected VPN clients</td></tr><tr><td><code>DMZ_SERVICES</code></td><td>IPs of exposed public services (if any)</td></tr></tbody></table></figure>



<p>You’ll use these lists throughout your firewall — from access control to detection.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9ea.png" alt="🧪" class="wp-smiley" style="height: 1em; max-height: 1em;" /> How to Add IPs to Address Lists</h2>



<p>Here are real-world examples of building useful address lists.</p>



<h3 class="wp-block-heading">Add your main LAN subnet:</h3>



<pre class="wp-block-preformatted"><code>/ip firewall address-list add list=LAN_SUBNETS address=192.168.88.0/24 comment="Main LAN"<br></code></pre>



<h3 class="wp-block-heading">Add your work IP for remote access:</h3>



<pre class="wp-block-preformatted"><code>/ip firewall address-list add list=TRUSTED_IPS address=203.0.113.5 comment="Work VPN Admin"<br></code></pre>



<h3 class="wp-block-heading">Add a known attacker to blocklist:</h3>



<pre class="wp-block-preformatted"><code>/ip firewall address-list add list=BLOCKED_IPS address=185.23.88.44 comment="SSH Brute Force"<br></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f6e0.png" alt="🛠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> How to Use Lists in Firewall Rules</h2>



<p>Let’s say you want to allow only your LAN to access the router. You could write:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter add chain=input src-address=192.168.88.0/24 action=accept<br></code></pre>



<p>But that’s hardcoded. What if you have more than one subnet?</p>



<p>Instead, write:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter add chain=input src-address-list=LAN_SUBNETS action=accept comment="Allow LAN access"<br></code></pre>



<p>Now if you add another subnet to <code>LAN_SUBNETS</code>, the rule automatically applies — no editing needed.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/23f1.png" alt="⏱" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Bonus: Temporary Blocks with Timeout</h2>



<p>You can even add entries to a list that <strong>expire automatically</strong> — great for banning bots or brute-force IPs for a limited time:</p>



<pre class="wp-block-preformatted"><code>/ip firewall address-list add list=BLOCKED_IPS address=192.0.2.66 timeout=1d comment="Temp ban"<br></code></pre>



<p>The IP will be automatically removed from the list after one day.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f501.png" alt="🔁" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Dynamic Updates &amp; Detection</h2>



<p>Once you’ve built address lists, you can:</p>



<ul class="wp-block-list">
<li>Dynamically add IPs to lists based on behavior (via firewall rules or scripting)</li>



<li>Use Netwatch or scripts to pull blocklists from external sources</li>



<li>Trigger alerts when new IPs are added</li>
</ul>



<p>It’s flexible, it’s powerful — and it scales with your network.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4cb.png" alt="📋" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Example — A Well-Structured List Setup</h2>



<pre class="wp-block-preformatted"><code>/ip firewall address-list<br>add list=LAN_SUBNETS address=192.168.88.0/24 comment="Main LAN"<br>add list=LAN_SUBNETS address=192.168.50.0/24 comment="Server Subnet"<br><br>add list=TRUSTED_IPS address=203.0.113.5 comment="Work VPN Admin"<br>add list=TRUSTED_IPS address=192.0.2.77 comment="My Laptop"<br><br>add list=BLOCKED_IPS address=185.22.11.19 comment="Repeated Scanner"<br></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9e0.png" alt="🧠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Advanced Use Cases</h2>



<ul class="wp-block-list">
<li><strong>Firewall detection logic:</strong> If someone hits a protected port → auto-add to <code>BLOCKED_IPS</code></li>



<li><strong>Geographic filtering:</strong> Create lists for country-specific IP ranges</li>



<li><strong>Scheduled lockdowns:</strong> Block/allow lists based on time (via script or scheduler)</li>



<li><strong>External threat feeds:</strong> Import addresses from abuse.ch, spamhaus, etc.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Recap</h2>



<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You now understand what address lists are<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You know how to build and use them effectively<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You’re ready to write cleaner, more flexible rules<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> You’ve added tools for blocking, detecting, and managing access like a pro</p>
<p>Сообщение <a href="https://boxvirt.com/address-lists-for-humans-and-hackers-mikrotik/">Address Lists for Humans (and Hackers) MikroTik</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://boxvirt.com/address-lists-for-humans-and-hackers-mikrotik/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Initial Setup: Clean the Slate and Prepare for Real Protection</title>
		<link>https://boxvirt.com/initial-setup-clean-the-slate-and-prepare-for-real-protection/</link>
					<comments>https://boxvirt.com/initial-setup-clean-the-slate-and-prepare-for-real-protection/#respond</comments>
		
		<dc:creator><![CDATA[eXtre]]></dc:creator>
		<pubDate>Sat, 02 Aug 2025 21:13:14 +0000</pubDate>
				<category><![CDATA[Mikrotik]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[MikroTik]]></category>
		<guid isPermaLink="false">https://boxvirt.com/?p=111</guid>

					<description><![CDATA[<p>Let’s be honest — most MikroTik routers out there are running with some half-baked default config and leftover rules that nobody fully understands. We’re not going to build [&#8230;]</p>
<p>Сообщение <a href="https://boxvirt.com/initial-setup-clean-the-slate-and-prepare-for-real-protection/">Initial Setup: Clean the Slate and Prepare for Real Protection</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Let’s be honest — most MikroTik routers out there are running with some half-baked default config and leftover rules that nobody fully understands. We’re not going to build on a mystery box.<br>We’re going to <strong>start clean</strong>, <strong>understand everything</strong>, and configure the firewall like a professional from day one.</p>
</blockquote>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9fc.png" alt="🧼" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 1: Wipe Out the Default Config (Optional but Recommended)</h2>



<p>When you first unbox and boot a MikroTik router, it usually comes with a default setup — which may include:</p>



<ul class="wp-block-list">
<li>DHCP server</li>



<li>NAT masquerade rule</li>



<li>Basic firewall rules (sometimes)</li>



<li>Bridge interfaces</li>



<li>Winbox open to all</li>
</ul>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f6d1.png" alt="🛑" class="wp-smiley" style="height: 1em; max-height: 1em;" /> The problem?</h3>



<p>You don&#8217;t know what it’s doing — and that’s a security risk.<br>If you&#8217;re serious about building your own firewall rules from scratch, it&#8217;s better to <strong>clear the default config</strong> and start fresh.</p>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/26a0.png" alt="⚠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Warning:</h3>



<p>Resetting your router will remove all current config — including access. Be sure you&#8217;re physically connected or know what you&#8217;re doing.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f504.png" alt="🔄" class="wp-smiley" style="height: 1em; max-height: 1em;" /> How to Reset the Config (Without Default Rules):</h3>



<p>From <strong>Winbox</strong> or <strong>Terminal</strong>, run:</p>



<pre class="wp-block-preformatted"><code>/system reset-configuration no-defaults=yes skip-backup=yes<br></code></pre>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>This will reboot the router and leave it with a bare system — no IPs, no NAT, no DHCP, no firewall.<br>You’ll need to <strong>connect via MAC address</strong> in Winbox afterward to start configuring.</p>
</blockquote>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9f1.png" alt="🧱" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 2: Reconnect via MAC Address (Winbox Only)</h2>



<p>After reset, the router won’t have an IP address — so you can’t reach it by IP.</p>



<p>Open <strong>Winbox</strong>, click on <strong>Neighbors</strong>, and connect using the <strong>MAC address</strong>.</p>



<p>This is a unique MikroTik feature — no DHCP needed. Once you&#8217;re back in, you can start configuring IP addresses manually.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9ee.png" alt="🧮" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 3: Add a Basic Management IP (for Access)</h2>



<p>Let’s assign a static IP to the LAN interface so you can work more comfortably.</p>



<pre class="wp-block-preformatted"><code>/ip address add address=192.168.88.1/24 interface=ether2<br></code></pre>



<p>Replace <code>ether2</code> with your LAN port. Now set your PC IP to something like <code>192.168.88.10</code> and reconnect via this IP in Winbox or browser (WebFig).</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f50d.png" alt="🔍" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 4: View Existing Firewall Rules (If Any)</h2>



<p>If you chose not to reset your router, or you&#8217;re working with an existing config, take a moment to see what rules are already in place:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter print<br></code></pre>



<p>You’ll see a list of rules — each with a number, chain, action, and optional comments.</p>



<p><strong>Delete everything you don’t fully understand or want to replace.</strong></p>



<p>To remove all firewall filter rules:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter remove [find]<br></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4be.png" alt="💾" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 5: Save a Clean Backup (Optional but Smart)</h2>



<p>Now that we’ve wiped the junk and set a minimal base IP, let’s save this clean state so you can revert back easily.</p>



<p>From Terminal:</p>



<pre class="wp-block-preformatted"><code>/system backup save name=clean_base_config<br></code></pre>



<p>Or in Winbox → <strong>Files → Backup → Save</strong>.</p>



<p>Download the backup to your PC, just in case.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4d8.png" alt="📘" class="wp-smiley" style="height: 1em; max-height: 1em;" /> What You Have Now</h2>



<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Clean MikroTik config<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Static IP for local access<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Empty firewall — ready to build securely<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> No random services exposed<br><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Full control</p>



<p>You’re now in charge of every packet that enters or leaves your router.</p>
<p>Сообщение <a href="https://boxvirt.com/initial-setup-clean-the-slate-and-prepare-for-real-protection/">Initial Setup: Clean the Slate and Prepare for Real Protection</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://boxvirt.com/initial-setup-clean-the-slate-and-prepare-for-real-protection/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How MikroTik Firewall Works (and Why You Need to Understand It)</title>
		<link>https://boxvirt.com/how-mikrotik-firewall-works-and-why-you-need-to-understand-it/</link>
					<comments>https://boxvirt.com/how-mikrotik-firewall-works-and-why-you-need-to-understand-it/#respond</comments>
		
		<dc:creator><![CDATA[eXtre]]></dc:creator>
		<pubDate>Sat, 02 Aug 2025 21:07:50 +0000</pubDate>
				<category><![CDATA[Mikrotik]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[MikroTik]]></category>
		<guid isPermaLink="false">https://boxvirt.com/?p=108</guid>

					<description><![CDATA[<p>If you&#8217;re coming from consumer-grade routers, you might be used to &#171;firewall&#187; meaning just a checkbox labeled &#171;Enable Security.&#187; MikroTik is a whole different world. In MikroTik, you [&#8230;]</p>
<p>Сообщение <a href="https://boxvirt.com/how-mikrotik-firewall-works-and-why-you-need-to-understand-it/">How MikroTik Firewall Works (and Why You Need to Understand It)</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>If you&#8217;re coming from consumer-grade routers, you might be used to &#171;firewall&#187; meaning just a checkbox labeled <em>&#171;Enable Security.&#187;</em> MikroTik is a whole different world.</p>



<p>In MikroTik, <strong>you build your firewall rules manually, from scratch</strong>. This gives you incredible power — and just as much responsibility.</p>



<p>Let’s break down what actually happens to a packet as it passes through the router.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9f1.png" alt="🧱" class="wp-smiley" style="height: 1em; max-height: 1em;" /> The Three Chains: input, forward, output</h2>



<p>MikroTik&#8217;s firewall is built on <strong>three main chains</strong>, each with a very specific job.</p>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f535.png" alt="🔵" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 1. <strong>Input chain</strong> — protects the router itself</h3>



<p>This chain handles packets <strong>destined for the router</strong>. For example:</p>



<ul class="wp-block-list">
<li>You&#8217;re logging in via Winbox or SSH</li>



<li>You’re pinging the router</li>



<li>You’re accessing WebFig or the DNS server on the router</li>
</ul>



<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9e0.png" alt="🧠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Pro Tip:</strong> If you don’t protect the <code>input</code> chain, your MikroTik is exposed to the world.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f537.png" alt="🔷" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 2. <strong>Forward chain</strong> — controls traffic passing <em>through</em> the router</h3>



<p>This is where you manage <strong>LAN <img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2194.png" alt="↔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> WAN</strong> traffic, VPN clients, and even guest networks. If a packet goes <strong>through</strong> the router (from one interface to another), it hits the <code>forward</code> chain.</p>



<p>Examples:</p>



<ul class="wp-block-list">
<li>A computer on LAN opens a website</li>



<li>A mobile device connects to VPN and accesses the internet</li>



<li>A camera on VLAN 20 streams video to a remote server</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f7e0.png" alt="🟠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 3. <strong>Output chain</strong> — traffic <em>from</em> the router</h3>



<p>This is <strong>not often used</strong> in most setups, but still important. It&#8217;s for traffic the router itself initiates:</p>



<ul class="wp-block-list">
<li>DNS queries (if using MikroTik as DNS client)</li>



<li>NTP sync</li>



<li>RouterOS package updates</li>
</ul>



<p>We’ll mostly focus on <code>input</code> and <code>forward</code>, but it&#8217;s good to know this chain exists.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9ed.png" alt="🧭" class="wp-smiley" style="height: 1em; max-height: 1em;" /> What Determines Which Chain Gets Hit?</h2>



<p>Let’s say a packet arrives from the internet:</p>



<ul class="wp-block-list">
<li>If it&#8217;s meant for <strong>your public IP</strong> (e.g., someone scanning port 8291) → <strong>input</strong></li>



<li>If it’s meant for a <strong>device on your LAN</strong> → <strong>forward</strong></li>



<li>If it&#8217;s coming <strong>from the router itself</strong> → <strong>output</strong></li>
</ul>



<p>Every packet hits <strong>only one</strong> of these chains.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f504.png" alt="🔄" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Connection States: new, established, related, invalid</h2>



<p>This is one of the <strong>most important things to understand</strong> if you want to write smart firewall rules.</p>



<p>When MikroTik receives a packet, it checks its <strong>connection tracking table</strong> and assigns it a state:</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f516.png" alt="🔖" class="wp-smiley" style="height: 1em; max-height: 1em;" /> State</th><th><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4cb.png" alt="📋" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Meaning</th></tr></thead><tbody><tr><td><strong>new</strong></td><td>The first packet of a connection (like a TCP SYN or first UDP packet)</td></tr><tr><td><strong>established</strong></td><td>Part of an already approved connection (like reply packets)</td></tr><tr><td><strong>related</strong></td><td>Connection triggered by another one (e.g., FTP data channel, ICMP error)</td></tr><tr><td><strong>invalid</strong></td><td>Corrupted, expired, or unknown connection — usually garbage</td></tr></tbody></table></figure>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f510.png" alt="🔐" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Best Practice:</h3>



<p>Always <strong>allow</strong> <code>established</code> and <code>related</code> connections. Drop <code>invalid</code>. Then handle <code>new</code> traffic with real rules.</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=input connection-state=established,related action=accept<br>add chain=input connection-state=invalid action=drop<br></code></pre>



<p>You’ll repeat the same for <code>forward</code> chain too.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9e9.png" alt="🧩" class="wp-smiley" style="height: 1em; max-height: 1em;" /> What Happens First? Firewall Rule Processing Order</h2>



<p>MikroTik firewall goes down the list <strong>top to bottom</strong>, and stops at the <strong>first matching rule</strong>.</p>



<p>That means <strong>rule order matters.</strong> If your first rule says &#171;accept everything,&#187; nothing else will be checked. If a later rule says &#171;drop all,&#187; but the earlier one accepted the traffic — too late.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4cc.png" alt="📌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Tip: Always put specific <strong>accept</strong> rules <em>before</em> broad <strong>drop</strong> rules.</p>
</blockquote>



<p>Example order:</p>



<pre class="wp-block-preformatted"><code>1. accept established, related<br>2. allow DNS from LAN<br>3. allow VPN traffic<br>4. drop invalid<br>5. drop everything from WAN<br></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9e0.png" alt="🧠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Thought Experiment: Which Chain?</h2>



<p>Let’s play a quick round to see how well you understand the chains. Which chain handles these?</p>



<ol class="wp-block-list">
<li>You connect to MikroTik via Winbox from the internet → <code>input</code></li>



<li>Your laptop browses Google via NAT → <code>forward</code></li>



<li>MikroTik checks for a RouterOS update → <code>output</code></li>



<li>Remote VPN client accesses NAS on your LAN → <code>forward</code></li>



<li>You ping MikroTik from LAN → <code>input</code></li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f50e.png" alt="🔎" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Logging — Know What’s Hitting the Firewall</h2>



<p>Logging helps understand what rules are matching (and what isn’t).</p>



<p>You can log a rule like this:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter<br>add chain=input action=drop log=yes log-prefix="DROP-WAN: "<br></code></pre>



<p>Log prefix helps quickly identify in logs. Use it sparingly — <strong>too much logging can crash your router</strong> under attack.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"></h2>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Summary of Key Concepts</h2>



<ul class="wp-block-list">
<li>MikroTik has <strong>3 firewall chains</strong> — input, forward, output</li>



<li>Every packet hits <strong>only one</strong> chain</li>



<li>You should <strong>protect input</strong> to lock down the router</li>



<li>Use <strong>connection states</strong> to simplify rule logic</li>



<li><strong>Rule order matters</strong> — first match wins</li>



<li>Keep logs clean and informative</li>
</ul>
<p>Сообщение <a href="https://boxvirt.com/how-mikrotik-firewall-works-and-why-you-need-to-understand-it/">How MikroTik Firewall Works (and Why You Need to Understand It)</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://boxvirt.com/how-mikrotik-firewall-works-and-why-you-need-to-understand-it/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Set Up WireGuard VPN on MikroTik — Real-World Guide (2025)</title>
		<link>https://boxvirt.com/how-to-set-up-wireguard-vpn-on-mikrotik-real-world-guide-2025/</link>
					<comments>https://boxvirt.com/how-to-set-up-wireguard-vpn-on-mikrotik-real-world-guide-2025/#respond</comments>
		
		<dc:creator><![CDATA[eXtre]]></dc:creator>
		<pubDate>Sat, 02 Aug 2025 20:51:56 +0000</pubDate>
				<category><![CDATA[Mikrotik]]></category>
		<category><![CDATA[MikroTik]]></category>
		<category><![CDATA[RouterOS]]></category>
		<category><![CDATA[VPN]]></category>
		<category><![CDATA[Winbox]]></category>
		<category><![CDATA[WireGuard]]></category>
		<guid isPermaLink="false">https://boxvirt.com/?p=105</guid>

					<description><![CDATA[<p>Want to connect to your home network from anywhere? Or route all your MikroTik traffic through a VPS with a static IP? Then WireGuard is your best friend. [&#8230;]</p>
<p>Сообщение <a href="https://boxvirt.com/how-to-set-up-wireguard-vpn-on-mikrotik-real-world-guide-2025/">How to Set Up WireGuard VPN on MikroTik — Real-World Guide (2025)</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Want to connect to your home network from anywhere? Or route all your MikroTik traffic through a VPS with a static IP? Then <strong>WireGuard</strong> is your best friend. Here&#8217;s how I personally set it up — step-by-step, no fluff, no jargon.</p>
</blockquote>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f539.png" alt="🔹" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Why WireGuard?</h2>



<p>WireGuard is a modern VPN protocol. It’s fast, lightweight, and refreshingly simple — no certificates, no massive config files. Just a few keys, IPs, and you&#8217;re good to go. If you&#8217;re on RouterOS 7+, you&#8217;re ready.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9f0.png" alt="🧰" class="wp-smiley" style="height: 1em; max-height: 1em;" /> What You’ll Need</h2>



<ul class="wp-block-list">
<li>A MikroTik router running <strong>RouterOS 7.1+</strong></li>



<li>Access to <strong>Winbox</strong> or the <strong>terminal</strong></li>



<li>A basic idea of who’s the server and who’s the client</li>



<li>A few minutes (and maybe a coffee <img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2615.png" alt="☕" class="wp-smiley" style="height: 1em; max-height: 1em;" />)</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f50c.png" alt="🔌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 1: Create the WireGuard Interface</h2>



<ol class="wp-block-list">
<li>Open <strong>Winbox → Interfaces → WireGuard</strong></li>



<li>Click the <code>+</code> and name your interface something like <code>wg0</code></li>



<li>Choose a <strong>port</strong>, like <code>13231</code></li>



<li>Generate a keypair using the terminal:</li>
</ol>



<pre class="wp-block-preformatted"><code>/interface wireguard key print<br></code></pre>



<p>Save both <strong>Private</strong> and <strong>Public</strong> keys somewhere safe.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f91d.png" alt="🤝" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 2: Add the Peer (the other side)</h2>



<ol class="wp-block-list">
<li>Go to <strong>WireGuard → Peers</strong></li>



<li>Add a new peer:
<ul class="wp-block-list">
<li><strong>Public Key</strong> from the other side (your client or VPS)</li>



<li><strong>Allowed Address</strong>: e.g., <code>192.168.100.2/32</code></li>



<li><strong>Endpoint</strong>: optional if you’re not the client</li>



<li><strong>Persistent Keepalive</strong>: <code>25s</code> if the peer is behind NAT</li>
</ul>
</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9fe.png" alt="🧾" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 3: Assign an IP Address to wg0</h2>



<p>Go to <strong>IP → Addresses</strong>, click <code>+</code>:</p>



<ul class="wp-block-list">
<li>Address: <code>192.168.100.1/24</code></li>



<li>Interface: <code>wg0</code></li>
</ul>



<p>That’s the MikroTik&#8217;s IP inside the VPN tunnel. Your client might be <code>192.168.100.2</code>.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f6e3.png" alt="🛣" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 4: Add a Route (If Needed)</h2>



<p>If you&#8217;re connecting two networks (site-to-site), you&#8217;ll need to add a static route:</p>



<pre class="wp-block-preformatted"><code>/ip route add dst-address=192.168.200.0/24 gateway=192.168.100.2<br></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f525.png" alt="🔥" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 5: Add Firewall Rules</h2>



<p>Let’s make sure traffic is allowed:</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter add chain=input protocol=udp dst-port=13231 action=accept<br>/ip firewall filter add chain=forward src-address=192.168.100.0/24 action=accept<br></code></pre>



<p>Optional: lock down your WAN completely (for extra paranoia):</p>



<pre class="wp-block-preformatted"><code>/ip firewall filter add chain=input in-interface=ether1 connection-state=new action=drop<br></code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f5a5.png" alt="🖥" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 6: Client Configuration (Linux Example)</h2>



<pre class="wp-block-preformatted"><code>[Interface]<br>PrivateKey = &lt;your-client-private-key><br>Address = 192.168.100.2/24<br><br>[Peer]<br>PublicKey = &lt;mikrotik-public-key><br>Endpoint = your.domain.com:13231<br>AllowedIPs = 0.0.0.0/0<br>PersistentKeepalive = 25<br></code></pre>



<p>It’s the same on Windows — just paste it into the WireGuard GUI.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9ea.png" alt="🧪" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 7: Test It</h2>



<ul class="wp-block-list">
<li>Ping <code>192.168.100.1</code> from the client</li>



<li>In <strong>Winbox</strong>, check <strong>Interface → WireGuard</strong> — you should see traffic</li>



<li>Still not working? Read below <img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2b07.png" alt="⬇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9ef.png" alt="🧯" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Common Issues (and Fixes)</h2>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Problem</th><th>Fix</th></tr></thead><tbody><tr><td>Nothing connects</td><td>Double-check the public/private keys</td></tr><tr><td>One-way ping</td><td>You&#8217;re missing a route</td></tr><tr><td>Tunnel doesn&#8217;t come up</td><td>Check firewall or port forwarding (especially if MikroTik is behind NAT)</td></tr></tbody></table></figure>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Summary</h2>



<p>So far, you’ve:</p>



<ul class="wp-block-list">
<li>Set up a working WireGuard VPN on MikroTik</li>



<li>Secured communication between two points</li>



<li>Opened the door to advanced use cases — static IP via VPS, remote access, multi-site routing</li>
</ul>
<p>Сообщение <a href="https://boxvirt.com/how-to-set-up-wireguard-vpn-on-mikrotik-real-world-guide-2025/">How to Set Up WireGuard VPN on MikroTik — Real-World Guide (2025)</a> появились сначала на <a href="https://boxvirt.com">Boxvirt - Proxmox &amp; OPNsense Infrastructure Guides</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://boxvirt.com/how-to-set-up-wireguard-vpn-on-mikrotik-real-world-guide-2025/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
