Unifi Zone Based Firewall: Migrating Legacy Rules
In this article
Yes, you can migrate legacy UniFi firewall rules to the zone-based firewall, but there is no automatic conversion tool—you must manually recreate each rule in the new zone-based interface, and the process requires understanding how the legacy WAN_IN, LAN_IN, and LOCAL rule sets map to the new zone pairs.
Background: Why UniFi Changed to Zone-Based Firewalling
For years, UniFi gateways (USG, UDM, UDM Pro) used a simple rule table with predefined directions: WAN_IN (traffic from WAN to LAN), LAN_IN (traffic between LAN networks), and LOCAL (traffic destined to the gateway itself). This worked for basic setups but became confusing when users had multiple VLANs and needed different policies per network pair.
The zone-based firewall (introduced in UniFi Network 7.x for UDM and later for other platforms) replaces this with a zone model. A zone is a group of networks (e.g., “LAN” zone contains your main network and IoT VLAN). You create rules that specify a source zone, a destination zone, and optional source/destination addresses or ports. This is more flexible because you can apply different rules between any two zones without cluttering a single table.
How the New Zone-Based Model Works
In the UniFi Network application, when you navigate to Settings > Firewall & Security, you now see two tabs: Traffic Rules and Zone-Based. The zone-based tab shows a matrix of your zones (e.g., LAN, WAN, Guest, VPN). Each cell represents traffic from one zone to another. Clicking a cell lets you add rules specific to that path.
Each rule has:
- Source zone and destination zone (e.g., from LAN to WAN)
- Source/destination type: IP address, network, port, or MAC (for source only)
- Action: Accept, Drop, or Reject
- State: Enabled or disabled
There is also a “Pre” and “Post” phase for each zone pair. Pre rules run before the implicit “established/related” allow, post rules run after. For most migrations, you will use the default “Post” phase.
Mapping Legacy Rules to Zone Pairs
To migrate, you need to translate each legacy rule into a zone-based rule. The mapping is not one-to-one because legacy rules had a single direction (e.g., WAN_IN) that could involve multiple zones. Here is the practical mapping:
- WAN_IN rules (traffic from WAN to LAN) become rules with source zone WAN and destination zone LAN (or the specific zone that contains the destination network).
- LAN_IN rules (traffic between LAN networks) become rules between the specific zones that contain those networks. For example, a rule allowing traffic from the “Main” network to the “IoT” network becomes a rule from zone LAN to zone IoT (if you have separate zones) or from LAN to LAN if both are in the same zone.
- LOCAL rules (traffic to the gateway) become rules with destination zone Local (or “Gateway” in some versions).
If you had a legacy rule that applied to “All” source networks, you may need to duplicate it for each source zone you care about, or use the “Any” zone option if available.
Step-by-Step Migration Process
Here is a practical approach to migrating without breaking your network:
- Back up your current UniFi configuration (Settings > System > Backup). This is essential in case you need to roll back.
- List all existing legacy rules from the old interface (if still visible) or from your documentation. Note the rule order, because order matters.
- Create zones that match your network groupings. For example, if you have a “Main” network, an “IoT” VLAN, and a “Guest” network, create zones accordingly. You can also use the default zones (LAN, WAN, Guest, VPN) and assign networks to them.
- Recreate each rule in the zone-based interface using the mapping above. Start with the most specific rules first (e.g., allow specific ports), then add broader rules.
- Test each rule after enabling it. Use a device on the affected network to verify that the intended traffic works and unintended traffic is blocked.
- Disable or delete the legacy rules only after you are confident the new rules work. You can keep them disabled for a while as a fallback.
Common Pitfalls and Misconceptions
One common mistake is assuming that the zone-based firewall automatically inherits the implicit rules from the legacy system. It does not. For example, in the legacy system, LAN_IN had an implicit “allow established” rule. In the zone-based system, there is an implicit “established/related” allow for all zone pairs, but you must ensure your rules do not accidentally block that.
Another pitfall is that the zone-based firewall does not support all legacy rule options. For instance, legacy rules could specify a “source MAC address” for the entire rule, but zone-based rules only allow MAC as a source type, not as a global rule property. Also, some legacy rules used “IPsec” as a source/destination; in zone-based, you may need to use the VPN zone instead.
Misconception: “Zone-based firewall is only for UDM Pro.” In reality, it is available on all UniFi gateways that run UniFi Network 7.2 or later, including UDM, UDM Pro, UDM SE, and the Cloud Key Gen2 with a UniFi gateway. However, the exact UI may vary slightly by version.
Comparing Legacy vs. Zone-Based: Which Is Better?
For simple setups (one LAN, one WAN, no VLANs), the legacy firewall is easier to understand and manage. The zone-based model adds a conceptual overhead that may not be necessary. However, for multi-VLAN environments, zone-based is far superior because it lets you define policies per network pair without the confusion of a single long list.
Performance-wise, there is no significant difference; both use the same underlying packet filtering. The main difference is in configuration flexibility and clarity.
Cost and Licensing Considerations
There is no additional cost for the zone-based firewall; it is included in the UniFi Network application. However, migrating to a newer UniFi OS version may require hardware that supports it. For example, the original USG (not the UDM series) does not receive UniFi Network 7.x updates, so it cannot use the zone-based firewall. If you are on a USG, you would need to upgrade to a UDM or UDM Pro to use this feature.
Frequently Asked Questions
Will my legacy rules be automatically converted?
No. UniFi does not provide an automatic migration tool. You must manually recreate each rule in the zone-based interface. The old rules remain active until you delete or disable them.
Can I keep both legacy and zone-based rules enabled at the same time?
Yes, in some versions you can have both, but it is not recommended because the rule evaluation order between the two systems is unclear. It can lead to unexpected behavior. It is safer to disable legacy rules once you have recreated them.
What happens to my existing port forwarding and NAT rules?
Port forwarding and NAT rules are separate from the firewall rules. They are not affected by the zone-based migration. You do not need to recreate them.
How do I allow traffic from the internet to a specific server on my LAN?
In the zone-based firewall, create a rule with source zone WAN, destination zone LAN, and specify the server’s IP address as the destination. You also need a port forwarding rule to map the external port to the internal IP.
Is the zone-based firewall available on the UniFi Cloud Key?
Yes, if the Cloud Key is running UniFi Network 7.2 or later and is managing a compatible gateway (e.g., UDM, UDM Pro). The zone-based firewall is a network application feature, not a hardware feature.
Can I use MAC addresses in zone-based rules?
Yes, you can use MAC addresses as the source type in a zone-based rule, but not as a destination type. This is similar to legacy rules, which also only allowed MAC as source.