Home/Application-Level Blocking
Layer-7 Guide

Block applications — not IP addresses

Blocking WhatsApp, Netflix, BitTorrent or a VPN tunnel by IP doesn't work — those services rotate IPs constantly. You need to block at Layer 7: the application itself. Here's how pfSense does it with Zenarmor, Suricata and friends.

Concept

Why IP/domain blocking isn't enough

The OSI stack has seven layers. Each layer gives you a different lens to block traffic. Most admins only use Layers 3–4 (IP + port). That's why users bypass blocks with a VPN or a new IP of the same CDN.

L3 · Net
IP / CIDR blocking
Firewall rules that match source/destination IP. Fails the moment the app uses a different CDN endpoint or the user switches to mobile data.
Effectiveness: low
L4 · Port
Port blocking
Block TCP/UDP ports (e.g. block 6881 for BitTorrent). Useless now — most apps tunnel over 443 so they look like regular HTTPS.
Effectiveness: low
L6 · SNI
DNS + SNI filtering
Sinkhole the domain in DNS, and inspect the SNI field in the TLS handshake to drop the connection. Better, but clients using DNS-over-HTTPS or ECH bypass this.
Effectiveness: medium
L7 · DPI
Deep Packet Inspection (Application)
Identify the application by its traffic fingerprint — WhatsApp's handshake, Netflix's CDN pattern, BitTorrent's DHT pings. Works even when the app changes IP, domain or port.
Effectiveness: high
Rule of thumb Use Layer-7 DPI for apps you want to block by category (social, streaming, P2P, gaming, VPN). Use DNS/SNI for specific domains. Stack both layers — users can't bypass one without tripping the other.
Tools

4 ways to do Layer-7 blocking on pfSense

From turnkey commercial (Zenarmor) to DIY free (Suricata). Pick based on how many users you have, your budget, and how granular your policy needs to be.

Zenarmor

The commercial DPI engine for pfSense. 300+ pre-categorised apps, per-user policies, real-time analytics dashboard.

  • 300+ apps identified
  • Category policies (social, streaming, games…)
  • Scheduled rules (block social 9-6)
  • Web UI with live dashboards
  • Paid tiers for >1 policy

Suricata IDS/IPS

Free (open source)

pfSense's native package. Signature-based — you enable the Emerging Threats application ruleset to get app blocking.

  • Free and open source
  • 50,000+ signatures
  • Manual rule tuning needed
  • No per-user, only per-flow
  • No category UI

SquidGuard + Squid

Free (open source)

Transparent HTTP(S) proxy with URL/app filtering. Classic Indian-school-lab choice. Best for forced-proxy environments.

  • Free, pfSense package
  • User + time-of-day policies
  • HTTPS MITM (with CA deploy)
  • Breaks apps that pin certs
  • Ageing, patchy support

pfBlockerNG + SNI

Free (open source)

Use DNSBL feeds (GeoIP, social, streaming categories) combined with SNI-match firewall rules for half-DPI blocking.

  • Free, native pfSense
  • Huge community feed lists
  • Works on DNS + SNI, not payload
  • Bypassed by DoH / ECH
  • Pairs well with Zenarmor
Recommended setup

Install & configure Zenarmor

Best turnkey option. Free tier is enough for home labs and sub-100-user offices. Paid tiers unlock more policies and advanced reporting.

1

Install the package

Add Zenarmor's package manifest via SSH, then install from the package manager.

Diagnostics › Command Prompt
2

Enable the engine

Firewall › Zenarmor

First-run wizard asks which interface to watch (LAN usually) and which mode: monitoring-only to observe traffic first, enforcing to actually block.

3

Create your first policy

A policy = who (source: LAN users or specific IPs) + what (categories to block: social, streaming, gambling, adult, P2P, VPN, proxies) + when (schedule).

4

Enable recommended categories

For workplace: P2P, Torrents, VPN & Anonymizers, Adult, Gambling, Proxy-Avoidance. Optional: Streaming, Social Media (on a schedule).

5

Verify with the live dashboard

Zenarmor → Reports shows top apps, top users, blocked attempts in real time. Watch for 30 minutes to catch false positives before going fully enforcing.

Firewall › Zenarmor › Reports
Install Zenarmor on pfSense CE via SSH
# SSH to pfSense as admin, select option 8 (Shell), then:

pkg update
fetch -o /tmp/zen.sh https://raw.githubusercontent.com/sunnyvalleynetworks/install-zenarmor/master/install.sh
chmod +x /tmp/zen.sh
/tmp/zen.sh

# The script installs the package, pulls the latest DPI signatures,
# and enables a menu entry in the WebGUI: Firewall > Zenarmor

# First-run wizard in the WebGUI walks you through:
#  1. Interface selection (choose LAN)
#  2. Mode (start with 'Monitoring' for a week)
#  3. Sign in with Sunny Valley account (free)
#  4. Pick your licence tier (Free / Business / Enterprise)
Free alternative

Suricata with ET-Open application rules

If you can't pay for Zenarmor, Suricata's Emerging Threats rulesets include dozens of application-identification rules. Less polished UX, zero cost.

1

Install Suricata package

System › Package Manager › Available › suricata
2

Enable on WAN + LAN

Services › Suricata › Interfaces › Add WAN and LAN

WAN catches inbound threats; LAN catches outbound app traffic (what we want here).

3

Enable "Emerging Threats Policy" rulesets

Under LAN interface → Categories → tick: emerging-policy.rules (contains app identification), emerging-p2p.rules (torrents), emerging-games.rules, emerging-chat.rules. Save.

4

Set blocking mode

Interface settings → Block Offenders: checked. Which IP to Block: BOTH. Kill states: yes. This converts Suricata from passive IDS to active IPS.

5

Tune false positives

Watch the Alerts tab for a few days. Right-click alerts triggered by legit traffic (e.g. Slack, Zoom) and "Suppress rule" per that source IP.

Services › Suricata › Alerts
Example Suricata rule — custom app block
# Drop TikTok native app TLS handshakes (pattern-match on SNI)
drop tls any any -> any any (msg:"KHOJI BLOCK TikTok SNI"; \
  tls_sni; content:"tiktokv.com"; nocase; endswith; \
  sid:9000001; rev:1;)

# Drop BitTorrent DHT (Distributed Hash Table) UDP pings
drop udp $HOME_NET any -> any 6881:6999 (msg:"BLOCK BitTorrent DHT"; \
  content:"d1:ad2:id20:"; offset:0; depth:12; \
  sid:9000002; rev:1;)

# Drop common VPN bypasses (NordVPN, ExpressVPN TLS patterns)
drop tls any any -> any any (msg:"BLOCK NordVPN"; \
  tls_sni; pcre:"/.*\.nordvpn\.com$/i"; \
  sid:9000003; rev:1;)
What admins block

Common application-blocking use cases

💬

Social during work hours

Block Facebook, Instagram, TikTok, X from 9am-6pm on weekdays. Allow at lunch and after hours.

schedulesocialproductivity
🎬

Streaming (bandwidth)

Block Netflix, Hotstar, YouTube, Prime on office WAN. Keep the fibre for actual work.

streamingbandwidth
🌊

P2P / BitTorrent

Block BitTorrent protocol entirely. Prevents copyright notices from the ISP, saves 10s of Mbps.

p2pcompliance
🕵

VPN bypass attempts

Users install NordVPN / Windscribe on laptops to bypass your other blocks. Kill at the network level.

vpnbypasscritical
🎮

Gaming on school networks

Block Roblox, Fortnite, Steam updates during class hours. Resume after 4pm.

gameseducationschedule
🎰

Gambling & adult

Permanent block on gambling + adult categories — standard for schools, libraries, public WiFi, banks.

gamblingadultcompliance
Critical

Prevent the 3 common bypasses

Users are creative. These three techniques defeat naive blocking setups. Stack all three defences.

1

Block DNS-over-HTTPS (DoH)

Chrome and Firefox bypass your DNS filter by sending DNS queries inside HTTPS to dns.google, cloudflare-dns.com, mozilla.cloudflare-dns.com. Block those hostnames via pfBlockerNG DNSBL and their known IPs via firewall alias.

Firewall › pfBlockerNG › DNSBL › DNSBL Groups › Add custom list with DoH resolvers
2

Block DoT (DNS-over-TLS)

Similar to DoH but on port 853. Easy fix: firewall rule LAN → any : TCP+UDP 853 = block.

3

Force all DNS through pfSense

NAT rule: redirect outbound TCP/UDP 53 to pfSense's own resolver. Users configuring 8.8.8.8 on their laptop get silently rerouted to your Unbound. Combined with #1 and #2, they have no external DNS path.

Firewall › NAT › Port Forward › Add
Interface: LAN · Protocol: TCP/UDP · Source: LAN net · Dest: any (not LAN address) · Dest Port: 53 · Redirect target IP: 127.0.0.1 · Redirect target port: 53
4

Detect commercial VPN traffic

Zenarmor's "VPN & Proxy" category covers the top 50 commercial VPN services. For Suricata, enable emerging-policy.rules which has patterns for NordVPN / ExpressVPN / ProtonVPN handshakes.

5

(Optional) Block mobile hotspot detection

Determined users will tether their phone. You can't block it at the network level — but you can enforce endpoint MDM (Intune, Jamf) that disables tethering on corporate laptops.

Layered defence or it doesn't matter A single block point is always bypassable. Stack: DNS filter (pfBlockerNG) + DPI engine (Zenarmor or Suricata) + Forced DNS (NAT redirect) + DoH/DoT block + Endpoint MDM. Each layer defeats a different bypass — together they're near-impossible to evade without physical network manipulation.
Bonus

Schedule-based policies (time-of-day)

Block social media during business hours, allow at lunch, full access after 7pm. Works in both Zenarmor (native schedules) and pfSense firewall rules (via the Schedules feature).

1

Create a schedule

Firewall › Schedules › Add

Name: WorkHours. Days: Mon-Fri. Time range: 9:00 to 18:00 (except 13:00-14:00 for lunch if you want to allow social at lunch).

2

Attach the schedule to a rule

In either a pfSense firewall rule or a Zenarmor policy, pick the schedule from the dropdown. Rule only fires during scheduled hours.

3

Example: block Instagram only 9-6

Zenarmor policy: Category = Social Networks, Action = Block, Schedule = WorkHours. Done — users get Instagram at lunch and after 6pm, nothing during deep-work hours.

Soft-block tip Instead of a hard block, show a custom "This is blocked during work hours — access resumes at 6pm" page. Zenarmor has this built in; for Suricata/pfBlockerNG use the block page templates with dynamic time text.
Want us to implement this?

Application-level blocking, deployed in a day

Zenarmor or Suricata setup + category policies + schedule-based rules + bypass prevention + monthly tuning. Handover includes admin dashboard training.

✓ Copied