OPNsense Hub Configuration for Blocking Communication between Two LANs

Abstract: Isolate two LANs in OPNsense by removing allow rules to block inter-LAN traffic while preserving internet access.

Created: 2026-09-17 by
To block communication between two separate LANs in OPNsense, you must leverage the firewall’s default deny-all policy for traffic originating from one interface and destined for another. By ensuring that no explicit allow rules exist in the firewall policies for these specific interfaces, inter-LAN traffic is automatically dropped at the packet level. This configuration effectively isolates network segments, preventing any direct data exchange between tenants or departments while maintaining their individual internet access through NAT.

Understanding OPNsense Firewall Logic

OPNsense operates on a stateful packet inspection model where rules are processed sequentially from top to bottom. The most critical concept to grasp is the "default deny" behavior. Unlike some consumer-grade routers that might allow all internal traffic by default, enterprise firewalls like OPNsense require explicit permission for traffic to flow between different zones. If you do not create a rule allowing traffic from Lan1 to Lan2, the firewall will simply ignore or drop those packets after evaluating all other rules. This logic applies regardless of whether the two LANs share the same physical switch or are connected via different VLANs, provided they are assigned to distinct interfaces or VLAN tags within OPNsense. The security boundary is defined by the interface assignment rather than physical cabling. Therefore, understanding how interfaces map to these logical zones is the first step in securing your network topology.

Verifying Interface Assignments

Before configuring rules, ensure that each LAN segment is correctly assigned to its own interface. Navigate to Diagnostics > Interfaces Settings in the web GUI. Here, you should see entries for both LAN segments. If you are using VLANs, verify that the parent interface and VLAN ID are correct. Each interface must have a unique IP subnet. For example, 192.168.10.0/24 for Tenant A and 192.168.20.0/24 for Tenant B. If both networks are on the same subnet but separated physically, you would need to implement private VLANs (PVLANs) at the switch level, which is outside the scope of the firewall configuration itself. However, if they are on different subnets, the firewall handles the isolation natively.

Configuring Firewall Rules for Isolation

The core of the solution lies in the Firewall settings. You need to inspect the rules for each LAN interface individually. Go to Firewall > Rules > LAN (or whichever name you assigned to Tenant A’s interface). Look at the existing rules. Typically, you will see an AH (Allow Any) rule at the top, which allows all traffic from this interface to anywhere, including other local interfaces. To isolate this LAN, you must modify or remove this broad allowance. For complete isolation, delete the AH rule if it exists. Instead, add specific rules that only allow what is necessary. Usually, this means allowing DHCP, DNS, and outbound HTTP/HTTPS traffic to the WAN interface. Crucially, do not add any rule that specifies the destination as the other LAN interface or its subnet. If you need to allow management traffic (like SSH or Ping) from a specific admin workstation on Tenant A to Tenant B, you must create a highly specific rule targeting that single source IP and the specific service port, rather than opening the whole subnet.

Implementing the Default Deny Policy

After removing permissive rules, ensure that the final rule on the interface list is set to Deny. In OPNsense, the last rule is often implicitly a deny, but making it explicit improves clarity and auditability. Set the action to Block, leave the protocol as * (any), and set the destination to any. This acts as a safety net. If any misconfiguration occurs, traffic will still be blocked. This approach ensures that even if new services are added to the network, they cannot communicate across the LAN boundary unless explicitly permitted by a new rule. For more detailed guidance on managing interface permissions, you may find value in reviewing OPNsense Firewall Rules Best Practices to understand how rule ordering impacts performance and security.

Testing the Configuration

Once the rules are saved and applied, verification is essential. Use a device on Tenant A’s network and attempt to ping the gateway or any host on Tenant B’s network. The request should time out. Similarly, try to access a shared resource, such as a printer or file server, located on Tenant B. These attempts should fail. Conversely, verify that devices on Tenant A can still access the internet. This confirms that the NAT rules for the WAN interface are functioning correctly and that the isolation is limited strictly to inter-LAN traffic. If connectivity issues persist, check the Status > System Logs > Firewall page. Filter by the source interface (Tenant A) and look for block entries with the destination matching Tenant B’s subnet. These logs confirm that the firewall is actively dropping the traffic as intended.

Handling Exceptions

In some scenarios, you might need to allow specific communication between LANs, such as for a centralized backup server or a shared database. In these cases, create a rule on the source LAN’s interface that targets the specific IP address of the destination server on the other LAN. Define the specific port required (e.g., TCP 3306 for MySQL). Place this rule above the general deny rule but below any restrictive rules. This granular approach maintains security while enabling necessary business functions. For complex routing scenarios involving multiple gateways, consider exploring Advanced VLAN Routing Configurations to ensure your traffic flows correctly before applying firewall restrictions.

Frequently Asked Questions

Will blocking inter-LAN traffic affect internet access?

No, blocking traffic between LAN interfaces does not impact outbound internet access. As long as your rules allow traffic from the LAN interfaces to the WAN interface for protocols like HTTP, HTTPS, and DNS, devices will continue to browse the web normally. The isolation only prevents direct communication between the internal subnets.

How do I allow one specific device to talk to another LAN?

Create a specific firewall rule on the source interface that defines the exact source IP of the device and the destination IP of the target device on the other LAN. Specify the required protocol and port. Ensure this rule is placed higher in the rule order than any blanket deny rules to take precedence.

Can I use aliases to simplify management?

Yes, creating aliases for entire subnets or groups of hosts makes rule management easier. You can define an alias for "Tenant B Subnet" and use it in destination fields. This avoids typing IP ranges repeatedly and makes it easier to update addresses if the network changes.

What happens if I accidentally create a rule allowing all traffic?

If you add an AH (Allow Any) rule at the top of either LAN interface, the isolation will be broken immediately. All traffic from that LAN will be allowed to reach the other LAN. Always review the rule order carefully and test connectivity after making changes to prevent accidental exposure.

Does this configuration work with VLANs?

Yes, this method works identically for VLANs. As long as each VLAN is assigned to a distinct virtual interface in OPNsense with its own subnet, the same firewall rule logic applies. The firewall treats VLAN interfaces just like physical interfaces when processing rules.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More