<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Vlan on Zero-Entry</title>
    <link>https://zero-entry.co.za/tags/vlan/</link>
    <description>Recent content in Vlan on Zero-Entry</description>
    <generator>Hugo -- 0.147.7</generator>
    <language>en-us</language>
    <lastBuildDate>Fri, 24 Apr 2026 14:26:40 +0400</lastBuildDate>
    <atom:link href="https://zero-entry.co.za/tags/vlan/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Inside My OPNsense Config</title>
      <link>https://zero-entry.co.za/posts/inside-my-opnsense-config/</link>
      <pubDate>Fri, 24 Apr 2026 12:00:00 +0200</pubDate>
      <guid>https://zero-entry.co.za/posts/inside-my-opnsense-config/</guid>
      <description>A walkthrough of the OPNsense box sitting at my internet edge — VLANs, DNS hijacking, DoH/DoT/DoQ blocking, CrowdSec bouncing, NetFlow, and the boring hardening that actually matters.</description>
      <content:encoded><![CDATA[<p>I&rsquo;ve written about the home lab at a high level already. The firewall got glossed over in a paragraph and that&rsquo;s never quite sat right with me, because OPNsense is doing most of the work that stops the home lab from becoming somebody else&rsquo;s problem.</p>
<p>This post walks through the config as it currently runs. Not a tutorial. Not a clean-slate build guide. Just what&rsquo;s actually on the box, what each piece is doing, and which of the &ldquo;this looks clever&rdquo; choices turned out to be worth it.</p>
<h2 id="what-opnsense-replaced">What OPNsense replaced</h2>
<p>The previous edge was a consumer router running vendor firmware. It worked. It also had opinions about DNS, UPnP, and what &ldquo;internal&rdquo; meant that didn&rsquo;t line up with mine. The moment I wanted per-VLAN firewall rules and per-host DNS overrides, I&rsquo;d hit a wall.</p>
<p>OPNsense runs on a small x86 box with two NICs. One is WAN, one is a trunk into the switch carrying tagged VLANs. The whole thing idles under 15% CPU with everything I&rsquo;ve thrown at it.</p>
<h2 id="interfaces">Interfaces</h2>
<p>Three interfaces that matter, plus the ones that don&rsquo;t.</p>
<ul>
<li><strong>WAN</strong> — the public side. <code>spoofmac</code> is set, <code>blockpriv</code> and <code>blockbogons</code> are both on. Anything showing up from RFC1918 or reserved space on the WAN gets dropped before it hits a single rule. This is a default, but it&rsquo;s a default I&rsquo;ve seen disabled &ldquo;temporarily&rdquo; on other people&rsquo;s firewalls more times than I&rsquo;d like.</li>
<li><strong>LAN (192.168.1.0/24)</strong> — the trusted network. Hosts, servers, my workstation, the things I wouldn&rsquo;t want on a segment with a cheap IP camera.</li>
<li><strong>VLAN20_IOT (192.168.20.0/24)</strong> — everything that speaks a protocol I didn&rsquo;t write and can&rsquo;t audit. Cameras, smart switches, the TP-Link stuff, a Ring doorbell, an Apple TV. Anything that phones home on a schedule.</li>
<li><strong>VLAN30_GUEST (192.168.30.0/24)</strong> — guest Wi-Fi. Scoped tight and deliberately boring.</li>
</ul>
<p>The WireGuard interface exists as a stub. The actual WireGuard endpoint runs on Boreas (the Raspberry Pi I wrote about previously) and terminates on LAN. Port 51820/udp is port-forwarded through OPNsense to it. The virtual interface here is reserved for a future on-box tunnel I haven&rsquo;t needed yet.</p>
<h2 id="inbound-whats-actually-exposed">Inbound: what&rsquo;s actually exposed</h2>
<p>A small, deliberate list. If something isn&rsquo;t on this list, the outside internet can&rsquo;t see it.</p>
<ul>
<li><strong>32400/tcp</strong> → Alecto (Plex). Plex&rsquo;s own account server handles connection brokering; this is the fallback direct path.</li>
<li><strong>25/tcp, 993/tcp</strong> → Alecto (SMTP inbound, IMAP-over-TLS). Yes, a residential SMTP listener is a lightning rod. I accept the noise in exchange for owning my own mail flow.</li>
<li><strong>9001/tcp+udp</strong> → the Tor middle relay host. Advertised to the Tor directory as the relay&rsquo;s ORPort.</li>
<li><strong>443/tcp, 51820/udp</strong> → Boreas. 443 is Nginx Proxy Manager fronting Overseerr for friends and family behind Cloudflare. 51820/udp is the WireGuard handshake port for remote access.</li>
</ul>
<p>Port 80 exists as a disabled rule. I leave disabled-but-documented rules in the config on purpose; they&rsquo;re a paper trail for &ldquo;this used to be exposed, here&rsquo;s why it isn&rsquo;t anymore.&rdquo; Deleting them loses that context.</p>
<p>Nothing else is forwarded. No UPnP. No NAT-PMP. If a device wants to be reachable from outside, I add the rule by hand.</p>
<h2 id="vlan-policy">VLAN policy</h2>
<p>The LAN rule is broad: trusted hosts can reach anything. The two VLANs get narrower treatment.</p>
<p><strong>IoT VLAN (VLAN20)</strong></p>
<ul>
<li>Can reach the router for DNS (53) and NTP (123). Nothing else on LAN.</li>
<li>Can reach WAN on 80/443. That&rsquo;s it.</li>
<li>Blocked from every other internal subnet.</li>
</ul>
<p><strong>Guest VLAN (VLAN30)</strong></p>
<ul>
<li>Can reach WAN on 80/443. Nothing else.</li>
<li>Blocked from LAN, IoT, and the router&rsquo;s management ports.</li>
<li>Uses its own DHCP scope (192.168.30.50–200) with the router itself as DNS.</li>
</ul>
<p>Guest users regularly ask why their work VPN client doesn&rsquo;t connect. That&rsquo;s not a bug. Guest is guest; if somebody needs a real tunnel, they&rsquo;re not on guest.</p>
<h2 id="dns-is-the-interesting-part">DNS is the interesting part</h2>
<p>I run <strong>Dnsmasq</strong> (not Unbound) across all three interfaces. Domain is <code>home.lan</code>. Upstream is Cloudflare 1.1.1.1 and 1.0.0.1. DNSSEC is off, which I&rsquo;ll come back to. Authoritative DHCP is on, so DHCP leases produce DNS records for every host automatically.</p>
<p>The interesting part isn&rsquo;t the resolver. It&rsquo;s the firewall rules around it.</p>
<h3 id="forcing-iot-through-the-router">Forcing IoT through the router</h3>
<p>Most cheap smart devices ship hardcoded with Google DNS (8.8.8.8) or similar. They don&rsquo;t care what DHCP tells them; they use whatever the vendor baked in.</p>
<p>So there&rsquo;s a NAT redirect on the IoT VLAN that rewrites any outbound connection to <code>*:53</code> and sends it back to 192.168.1.1:53. The device thinks it&rsquo;s talking to Google. It&rsquo;s actually talking to OPNsense. From the device&rsquo;s point of view, nothing changes. From my point of view, every DNS lookup for every IoT device is now logged locally and subject to the same filters as everything else.</p>
<p>The alias that drives this (<code>TP_LINK</code>) started as one device and grew organically. It now covers the usual IoT suspects including the NVR.</p>
<h3 id="killing-the-dns-escape-hatches">Killing the DNS escape hatches</h3>
<p>DNS hijacking works until a device decides it would rather use DNS-over-HTTPS or DNS-over-TLS to bypass your resolver entirely. Modern OSes will happily do this without asking.</p>
<p>Three rules cover the escape routes:</p>
<ul>
<li><strong>block-dns-tls-853</strong> — drops TCP/853 outbound (DoT).</li>
<li><strong>block-doq-quic-853</strong> — drops UDP/853 outbound (DoQ).</li>
<li><strong>block-doh</strong> — drops outbound to an alias called <code>doh_providers</code>.</li>
</ul>
<p><code>doh_providers</code> is a dynamic URL table alias. It pulls from the <code>awesome-dnscrypt</code> DoH server list on a 30-minute refresh. The alias updates itself; I don&rsquo;t maintain it.</p>
<p>This isn&rsquo;t perfect. DoH hiding inside a general HTTPS flow on port 443 is indistinguishable from any other HTTPS traffic without deep inspection, and I&rsquo;m not terminating TLS at the edge. What the blocklist catches is lazy implementations that connect directly to a known public DoH provider&rsquo;s IP, which is most of them.</p>
<p>The goal isn&rsquo;t to stop a determined adversary. It&rsquo;s to stop my smart TV from quietly ignoring my DNS server because its firmware author thought that was a reasonable default.</p>
<h2 id="aliases-that-earn-their-keep">Aliases that earn their keep</h2>
<p>Most aliases are boring host groups. A few are worth calling out.</p>
<ul>
<li><strong>doh_providers</strong> — the dynamic DoH blocklist described above.</li>
<li><strong>crowdsec_blocklists / crowdsec6_blocklists</strong> — external aliases driven by CrowdSec. These hold the IPs that CrowdSec has decided are hostile. Any firewall rule referencing these aliases gets the current set of bad actors without me maintaining a blocklist manually.</li>
<li><strong>CLOUDFLARE_IPS</strong> — Cloudflare&rsquo;s edge ranges. Used to scope inbound rules so that services meant to sit behind Cloudflare only accept connections from Cloudflare&rsquo;s IP space. Anything hitting those services directly at my IP gets dropped.</li>
<li><strong>TP_LINK</strong> — the IoT forcing-function alias. Named after what started it. Now overloaded with everything in the &ldquo;must be hijacked for DNS&rdquo; bucket.</li>
<li><strong>TOR_RELAY</strong> — single-host alias pointing at the Tor machine. Useful for bundling rules even when the alias has one entry, because when the hostname inevitably moves, I change it in one place.</li>
</ul>
<h2 id="crowdsec-is-doing-the-heavy-lifting">CrowdSec is doing the heavy lifting</h2>
<p>The earlier home lab post mentioned Suricata. That&rsquo;s no longer what&rsquo;s on the box.</p>
<p>OPNsense now runs <strong>CrowdSec</strong> as the main threat-intel layer:</p>
<ul>
<li><strong>Agent enabled</strong> — parses local logs and identifies scanning, brute-force, and common exploit patterns.</li>
<li><strong>LAPI enabled</strong> — the local API that the bouncer talks to.</li>
<li><strong>Firewall bouncer enabled</strong> — actively drops traffic from IPs flagged by the agent or by the CrowdSec community feeds.</li>
<li><strong>Rules enabled</strong> — the community scenarios load and run automatically.</li>
</ul>
<p>CrowdSec is cheaper on CPU than Suricata was, and its blocklist model fits the home lab better than a full IDS pipeline. Suricata gave me floods of alerts I wasn&rsquo;t going to investigate. CrowdSec gives me &ldquo;this IP has been a problem elsewhere, dropped at the firewall.&rdquo; Less signal, but the signal it produces is directly actionable because the action already happened.</p>
<p>I lost some visibility moving away from Suricata — notably per-flow inspection rules for specific CVEs. That trade-off has been fine for this environment. If this were an enterprise edge I&rsquo;d run both.</p>
<h2 id="observability">Observability</h2>
<p>A firewall with no telemetry is a box with opinions you can&rsquo;t verify.</p>
<ul>
<li><strong>NetFlow v9</strong> is enabled on LAN and WAN, with WAN set to egress-only. Export target is a local collector at 127.0.0.1:2056 that ships flow records into the metrics stack on Alecto. Active timeout 30 min, inactive 15 sec.</li>
<li><strong>vnstat</strong> runs against the WAN interface for long-term bandwidth counters. It&rsquo;s the &ldquo;how much did I actually use this month&rdquo; graph, not a security tool.</li>
<li><strong>Zabbix agent</strong> is enabled, reporting to Alecto. CPU, memory, interface counters, states table, per-rule hits. The Zabbix server decides what to alert on; the firewall just emits data.</li>
</ul>
<p>The alerting philosophy is the same as the one in the honeypot post. The firewall is not the thing that should decide what&rsquo;s worth waking me up over. Its job is to produce honest signal. Somebody else&rsquo;s job is to filter it.</p>
<h2 id="hardening-that-isnt-glamorous">Hardening that isn&rsquo;t glamorous</h2>
<p>None of this is interesting to read. All of it matters more than the DoH blocklists.</p>
<ul>
<li><strong>Web GUI is HTTPS-only.</strong> HSTS is on. The cert is self-signed because the GUI is only reachable from LAN and I&rsquo;d rather pin the cert than introduce an ACME dependency for a single internal endpoint.</li>
<li><strong>Console menu is disabled.</strong> Physical access to the box doesn&rsquo;t immediately give you the OPNsense menu. It gives you a login prompt.</li>
<li><strong>NAT reflection is off</strong> — fewer surprises with internal traffic taking unexpected paths.</li>
<li><strong>SSH is bound to LAN only, group-restricted to <code>admins</code>.</strong> It&rsquo;s one of the few places I&rsquo;m still running password auth with root allowed. Not because I think it&rsquo;s fine, but because the exposure surface (LAN-only) makes it low-risk and a key-only migration is on the list below.</li>
<li><strong>Bogon updates</strong> run monthly. Reserved/unallocated prefixes change less often than people think, but they do change.</li>
<li><strong>Backups</strong> go to Google Drive via <code>os-gdrive-backup</code> on a schedule. The XML config is small enough that a month of daily snapshots costs nothing and saves hours if I ever have to rebuild.</li>
</ul>
<h2 id="gateway-monitoring">Gateway monitoring</h2>
<p>Single WAN, no failover. The gateway monitor pings 1.1.1.1 continuously with alert thresholds at 30% packet loss (low) and 35% (high), and 300ms latency (low). If the line is bad enough to notice, OPNsense will flag the gateway before I do.</p>
<p>No multi-WAN yet. The second ISP option in my area isn&rsquo;t worth the monthly cost for the uptime I actually need. If that changes, gateway groups are already half-configured.</p>
<h2 id="what-id-change">What I&rsquo;d change</h2>
<p>A few things are genuinely outstanding, not just aspirational.</p>
<ul>
<li><strong>Turn on DNSSEC.</strong> Dnsmasq supports it; I disabled it years ago when a misbehaving internal service was breaking on stale signatures. That reason is long gone.</li>
<li><strong>Move SSH to key-only, disable root login.</strong> The exposure is LAN-only today but the migration is trivial and overdue.</li>
<li><strong>Ship syslog off-box.</strong> Right now logs live on OPNsense and get rolled locally. A remote syslog destination (somewhere on LAN, not off-site) would survive a firewall rebuild and give me history during incident response.</li>
<li><strong>Terminate TLS on a reverse proxy for the services that sit behind Cloudflare.</strong> Right now the tunnel ends on Boreas with NPM, which is fine. Moving cert management to an ACME plugin on OPNsense for the few public services would remove a moving part.</li>
<li><strong>Split LAN.</strong> The LAN rule is still &ldquo;trusted hosts can reach everything.&rdquo; That worked when LAN was five devices. It&rsquo;s less defensible now. A management VLAN separate from a workstation VLAN is the next logical step.</li>
</ul>
<h2 id="closing">Closing</h2>
<p>The interesting parts of this config aren&rsquo;t the exotic features. They&rsquo;re the boring ones: a DNS policy that assumes devices will lie, per-VLAN egress rules that default to deny, inbound exposure that fits on a single screen, and telemetry that lets somebody else decide what&rsquo;s worth acting on.</p>
<p>OPNsense makes all of that reachable from a UI without punishing you for running CLI alongside it. That&rsquo;s a rarer combination than it sounds.</p>
<p>If you&rsquo;re standing one up from scratch and wondering where to start: segment the network, hijack DNS on the untrusted segments, block the DNS escape hatches, and wire up telemetry before you wire up rules. Everything else is refinement on top of that.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
