OPNexusdocs

Interface roles

Two firewalls do not always have the same interfaces: one has a guest VLAN as opt3, the other none at all, or the same VLAN is called opt5 there. Because the OPNsense identifier (opt3) is only a number from the assignment order, a central rule with opt3 could hit the wrong network on the second firewall. OPNexus rejects this ("Interface … does not mean the same network on all targets"). With roles you do not need dummy VLANs for this.

  1. On the host page under Interface roles create a role (name e.g. GUEST) and choose the interface of this firewall. Each firewall does this for itself: fw-1 assigns opt3, fw-2 assigns vlan0.20, fw-3 assigns nothing.
  2. In the rule (or port forward, 1:1, outbound NAT) choose the role in the Interface field. {{IF_GUEST}} is stored.
  3. The preview shows the real interface per firewall. fw-3 appears as "Role not assigned · skipped" and is not touched; this is not an error.
  • Nothing is guessed: a role only takes effect where you assigned it. Without an assignment the firewall does not get the rule. If all targets lack the role, nothing is deployed (message "Role … is not assigned on any target").
  • Checked live: when saving the assignment and once more before deploying, the interface must exist on the firewall. If it has been removed there in the meantime, the request is rejected before anything is written.
  • Adopting and linking: this is how you gather existing, hand-made rules centrally: first assign the role on every firewall. When adopting the rule on the first firewall, the dialog offers, next to "Adopt", the button "Adopt as role GUEST" (only if this firewall has assigned the role to exactly this interface; rules, port forwards, 1:1 and outbound NAT). The central rule then carries {{IF_GUEST}}. On the further firewalls the equivalent rule appears as "Link": it matches if GUEST points there to the interface on which the rule sits (exact comparison after resolution, as with site variables). Without an assignment or with a different interface only the difference is shown, never linked. Adopting and linking write nothing to the firewall.
  • Optional: plain identifiers (lan, wan, opt3) work as before, including the check for the same meaning. The interface field contains either an identifier or exactly one role, never a mixture.
  • Config as code: roles are stored like other variables in the variables section (IF_GUEST: opt3) and as {{IF_GUEST}} in the interface of the objects.
  • Policy hierarchy: hierarchy rules can also carry a role as interface. The order of inherited rules (pre/post) is established per firewall on the actual interface; a host without the role does not get this rule and does not carry it in its order. Other fields of a hierarchy rule remain without placeholders.
  • Not supported: roles for device groups (each firewall assigns for itself).