Skip to content
ProHomeLab
RU

OPNsense VLAN Planner

Define your segments and the traffic you allow between them. Get aliases, the rule order for every interface and the overlaps with Docker and Podman networks.

Example loaded. Replace it with your own values.

Segments

VLAN ID, the OPNsense interface name and the IPv4 network.

VLAN IDSegmentOPNsense interfaceIPv4 CIDRInternetRemove

The Internet box adds a final Pass to any rule, so the segment can reach the internet. Without it the OPNsense default deny applies.

Allowed flows

A flow allows new connections from the source interface. Leave the IP empty to mean the whole segment.

FromToProtocolDestination portRemove

List ports with commas or give a range: 443, 8443, 20000-20100. ICMP needs no port.

Overlaps with container networks

For Docker pools the whole base is checked; size is the size of each subnet handed out.

If Docker has bip set, its subnet is checked. An overlap with a pool is a potential conflict: the pool hands out a subnet from there only once it gets that far. Compare with the host routes.

No overlaps in the checked ranges.

OPNsense plan

To enter by hand in Firewall → Aliases and Firewall → Rules.

For every rule: Direction In, TCP/IP Version IPv4, Quick on, Source port any. Pass rules use normal state tracking.

Put the allow rules above the blocks. Move an existing broad Pass below the blocks or replace it. Floating, interface group and automatic rules are evaluated earlier and can change the result.

The This Firewall block closes DNS, NTP, gateway ping and the OPNsense web UI. Allow whatever the segment needs from the firewall itself with a flow to This Firewall.

Pass to any lets through all remaining IPv4, including internal routes that are not in the blocks. IPv6, DHCP, NAT and routes are configured separately.

Aliases

NameTypeContent
PHL_RFC1918Network(s)10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
PHL_VLAN_10_NETNetwork(s)192.168.10.0/24
PHL_VLAN_20_NETNetwork(s)192.168.20.0/24
PHL_VLAN_30_NETNetwork(s)192.168.30.0/24
PHL_PORTS_1Port(s)443, 8443

Rules per interface

VLAN10_LAN · VLAN 10 · LAN

#ActionProtocolSourceDestinationDestination portDescription
1PassTCP/UDPPHL_VLAN_10_NETThis Firewall53Allowed flow
2PassTCPPHL_VLAN_10_NET192.168.20.15PHL_PORTS_1Allowed flow
3BlockanyPHL_VLAN_10_NETThis FirewallanyBlock access to firewall addresses
4BlockanyPHL_VLAN_10_NETPHL_RFC1918anyBlock RFC1918 networks
5PassanyPHL_VLAN_10_NETanyanyInternet access

VLAN20_APP · VLAN 20 · APP

#ActionProtocolSourceDestinationDestination portDescription
1BlockanyPHL_VLAN_20_NETThis FirewallanyBlock access to firewall addresses
2BlockanyPHL_VLAN_20_NETPHL_RFC1918anyBlock RFC1918 networks

VLAN30_IOT · VLAN 30 · IoT

#ActionProtocolSourceDestinationDestination portDescription
1PassTCP/UDPPHL_VLAN_30_NETThis Firewall53Allowed flow
2BlockanyPHL_VLAN_30_NETThis FirewallanyBlock access to firewall addresses
3BlockanyPHL_VLAN_30_NETPHL_RFC1918anyBlock RFC1918 networks

Everything is calculated in your browser. Nothing you enter is sent or stored.

How to use it

The planner follows the usual OPNsense segmentation pattern: on every VLAN the specific allow rules come first, then a block to the firewall itself and to all private networks, and last, if needed, internet access. Traffic between segments is closed by default; only the flows you describe are open.

Enter your segments, tick the ones that need the internet and add flows, for example from LAN to a server in APP on TCP 443, or from IoT to DNS on This Firewall. The plan below updates as you type. Create the aliases in Firewall → Aliases, then the rules on each interface in Firewall → Rules in the same order.

The address check comes next. If a VLAN subnet matches a Docker or Podman network on some host, that host sends its replies into its own bridge instead of the network. Paste your daemon.json or the subnets from docker network inspect and podman network inspect.

Questions and answers

Which VLAN ID should I pick?

Anything from 2 to 4094. VLAN 1 is the default VLAN on many switches, so keep it out of your own segments. Matching the ID to the third octet helps: VLAN 20 and 192.168.20.0/24 are easy to spot in logs.

Why does the private network block come before Pass to any?

OPNsense evaluates interface rules top to bottom and, with Quick on, stops at the first match. If Pass to any sits above the block, traffic to other segments goes through it.

Why block This Firewall separately?

This Firewall means every address of OPNsense itself, on every interface. Without the block, any segment can reach the firewall web UI and SSH. That is why DNS to the gateway is allowed with its own flow above the block; without it name resolution in the segment stops.

Why does Docker break access to a segment?

Docker takes subnets for its networks from 172.17.0.0/16 and the ranges after it, and from 192.168.0.0/16 once those run out. If one of them matches your VLAN, the host treats those addresses as local and never answers clients in that segment. The fix is default-address-pools.

Is IPv6 covered?

No, the plan is IPv4 only. Add IPv6 rules separately; otherwise, with IPv6 enabled, segments can talk to each other around the blocks.

Related articles