r/opnsense • • 6d ago

Isolating every interface of a group

I have a larger number (150+) of interfaces in a single group.
I want traffic between those interfaces to be blocked, while allowing traffic between clients on the same interface.

Right now I have a rule (NOT quick) which allows every traffic from the group to something outside of the group and for each interface in the group I have an additional rule to allow traffic inside of that interface (PASS: i1 -> i1).

I want the same same behavior without bloating my rule table with 150 rules of the same template.

Can I somehow add a rule to a group, which allows traffic for every member with itself?

4 Upvotes

10 comments sorted by

14

u/clarkn0va 6d ago

Two hosts on the same subnet will communicate directly. There's no need to create a firewall pass rule and such a rule will match no traffic.

1

u/Hallo_5000 5d ago

I was pretty sure it didn't work before (now it does). So there is no way for the firewall to manage local traffic?

5

u/corelabjoe 6d ago

Floating rules apply to multiple interfaces or interface groups for things like this...

However this seems like a somewhat unique design. I have not run across a use case for that many interfaces and I feel like there's likely a better way to achieve what you're trying to do.

Why so many interfaces? Even on large enterprise firewall deployments we don't have that many interfaces.... There has to be a reason?

If you explain the use case or goal better, there is likely a more optimal way to run the firewall and your ruleset that is easier to manage.

0

u/Hallo_5000 6d ago

The firewall manages a dorm and every room can have multiple devices communicating with one another (for example smart home devices) but the rooms should not be able to communicate with other rooms.

As the information about which room a client is in comes from the vlan tag (created by switches or Unifi with WPA2-Enterprise), OPNSense simply maps the vlan tags to interfaces.

4

u/corelabjoe 6d ago edited 6d ago

This would be easier if the vlans and subnets were completely controlled by opnsense but that's not always an option...

Very important question - does each VLAN have its own dedicated subnet?

Very common in enterprise WiFi deployments - client isolation which blocks every WiFi device or even wired on some systems, from talking.

If your firewall is being blamed, ask about client isolation settings first!

I also suggest inverse sense of match RFC1918 rule across ALL your dorm room vlans which, should automatically block them all from talking to each other by default... Depending on your network and subnet assignments.

1

u/Hallo_5000 5d ago

The rooms interfaces are each created on one vlan device and each interface has its own subnet.

2

u/IsaacFL 6d ago

I assume you have a firewall group setup containing each of the interfaces. Just write rules in the Group. I do something similar on a smaller scale.

First you will need to have a pass rule src Group Network to dest the firewall itself for ports you want to allow ie DNS NTP.

Rule to Block src any to dest Firewall (to protect admin gui etc)

Then any rules to pass src Group Network to internal host alias you might want to allow universal access (optional).

Next a rule to block src Group Network to Group Network. (the traffic inside the interface does not need to route thru the firewall)

Finally a rule Pass src Group Network to any. ()

the pass rules are all ip version any, protocol TCP/UDP. Block rules are any any

I put stuff like ICMP in the floating rules.

1

u/Hallo_5000 5d ago

So this also comes down to local traffic being invisible for OPNSense?

1

u/IsaacFL 5d ago

Correct. The firewall itself is the only local traffic you have to account for.

1

u/SuccotashOk4084 6d ago

Floating with !RFc1918 and that should automatically block all of vlans from talking assuming that opnsense is handing out the network's and is the DHCP server