PAN-OS: Panorama Device Group Hierarchies & Policy Evaluation (PCNSE 4.2.1)

PCNSE Objective Focus (Domain 4 - 18%)

4.2 Configure device groups

Introduction: Organizing Policies and Objects

In Panorama, Device Groups are fundamental organizational containers used to manage Policies (Security, NAT, QoS, Decryption, etc.) and related Objects (Addresses, Services, Security Profiles, etc.) that are pushed to groups of managed firewalls.

Just as firewalls often have varying network configurations (handled by Templates/Template Stacks), they also frequently require different sets of policies based on their function, location, or trust level. Panorama allows administrators to create a hierarchy of Device Groups to manage these policy sets efficiently through inheritance.

Understanding Device Group hierarchies and the resulting policy evaluation order on the firewall is crucial for scalable, maintainable, and logically structured policy management in Panorama.

Device Group Hierarchy Concept

Parent-Child Relationships

Configuration Inheritance for Policies and Objects

      graph TD
          Shared[Shared Scope\nGlobal Objects/Policies] --> DG_Corp(DG: Corporate-Base\nCommon Policies/Objects)
          DG_Corp --> DG_Region(DG: Region-NA\nNA-Specific Policies)
          DG_Region --> DG_Branch(DG: Branch-Type-A\nBranch-Specific Policies)
          DG_Region --> DG_DC(DG: DC-Primary\nDC-Specific Policies)
          DG_Branch --> FW1[FW1 - Branch A]
          DG_Branch --> FW2[FW2 - Branch A]
          DG_DC --> FW3[FW3 - DC Primary]

          style Shared fill:#eaf2f8,stroke:#aed6f1,stroke-width:2px
          style DG_Corp fill:#d5f5e3,stroke:#58d68d,stroke-width:1px
          style DG_Region fill:#d5f5e3,stroke:#58d68d,stroke-width:1px
          style DG_Branch fill:#fdebd0,stroke:#f5b041,stroke-width:1px
          style DG_DC fill:#fdebd0,stroke:#f5b041,stroke-width:1px
          style FW1 fill:#e9ecef,stroke:#adb5bd
          style FW2 fill:#e9ecef,stroke:#adb5bd
          style FW3 fill:#e9ecef,stroke:#adb5bd

          linkStyle 0 stroke-dasharray: 5 5
          linkStyle 1 stroke-width:2px
          linkStyle 2 stroke-width:2px
          linkStyle 3 stroke-width:2px
          linkStyle 4 stroke-width:2px
    
Example Device Group Hierarchy. FW1 inherits policies and objects from Shared, Corporate-Base, Region-NA, and Branch-Type-A.

Policy Evaluation Order (Pre- and Post-Rules)

Within each Device Group (including 'Shared'), policies are further divided into Pre-rules and Post-rules . These designations, along with the Device Group hierarchy and any local firewall rules, dictate the final sequence in which security policies are evaluated by the firewall.

Comprehensive Firewall Policy Evaluation Order:

When Panorama pushes the merged policy configuration, the firewall evaluates Security Policy rules in this strict order:

  1. Panorama 'Shared' Scope Pre-rules
  2. Parent Device Group(s) Pre-rules (Evaluated top-down in the hierarchy, from the highest-level parent DG down to the parent DG just above the firewall's own DG)
  3. (Local Firewall Pre-rules - if manually configured on the firewall before its own DG's rule block. This is generally not a Panorama-managed practice and is discouraged.)
  4. Child Device Group Pre-rules (Pre-rules from the specific Device Group the firewall is a direct member of)
  5. Child Device Group "Local" Rules (These are the main body of rules, not designated as Pre or Post, within the Device Group the firewall is a direct member of. They are evaluated top-down as they appear in that Device Group's rulebase.)
  6. (Local Firewall Rules - if manually configured directly on the firewall's GUI, their evaluation point relative to the Child DG Local Rules depends on where they were inserted by the local admin. This practice is generally discouraged in a Panorama-managed environment for maintaining consistency and can be overridden by Panorama pushes.)
  7. Child Device Group Post-rules (Post-rules from the specific Device Group the firewall is a direct member of)
  8. (Local Firewall Post-rules - if manually configured on the firewall after its own DG's rule block. Also discouraged.)
  9. Parent Device Group(s) Post-rules (Evaluated bottom-up in the hierarchy, from the parent DG just above the firewall's own DG up to the highest-level parent DG)
  10. Panorama 'Shared' Scope Post-rules
  11. Firewall Default Security Rules (e.g., intrazone-default which defaults to 'allow', and interzone-default which defaults to 'deny'. These apply only if no explicit rule above has matched the traffic.)

This explicit order ensures that broader, inherited rules (especially cleanup rules in Post-rules) don't inadvertently override more specific rules defined closer to the device (Child DG or potentially Local FW rules if permitted). Template Stacks, which manage Network and Device settings, operate distinctly from this policy evaluation order.

Best Practices

Caveats and Gotchas

PCNSE Exam Focus

For the PCNSE exam, concerning Device Group Hierarchies:

Device Group Hierarchy Quiz

1. What types of configurations are primarily managed within Panorama Device Groups?

Device Groups are the primary containers for managing policy rulesets (Security, NAT, etc.) and the objects referenced within those policies. Network and Device settings are managed via Templates/Stacks.

2. What is the main benefit of creating a Device Group hierarchy (parent-child structure)?

Hierarchies allow child Device Groups to inherit configurations from their parents (and Shared), promoting reusability and enabling layered policy management.

3. What is the difference between Pre-rules and Post-rules within a Device Group configuration?

Pre-rules are evaluated before other rules within the same Device Group scope and before rules in lower-level Device Group scopes. Post-rules are evaluated after other rules in the same scope and after rules in lower-level scopes. The full evaluation order considers all hierarchy levels.

4. A firewall belongs to `DG-Branch-A`, which is a child of `DG-Region-NA`, which is a child of `DG-Corporate`. Which Device Group's policies/objects are applied to the firewall?

A firewall inherits the merged configuration from its entire hierarchy path, starting from Shared (if used), down through all parent Device Groups, to the specific Device Group it belongs to, with specific evaluation order for rules.

5. In the overall firewall policy evaluation order, where do the firewall's default security rules (e.g., interzone-default) get evaluated?

Firewall default security rules are the rules of last resort, evaluated only if no preceding explicit rule (from any Panorama scope or locally on the firewall) matches the traffic.

6. An administrator wants to create a baseline Security Policy rule to block specific high-risk applications for ALL firewalls managed by Panorama. Where is the most appropriate place to configure this rule to ensure it's evaluated early?

For rules that must be enforced globally and take precedence early in the evaluation, configuring them as Pre-rules in the 'Shared' scope ensures they are evaluated first across all inheriting firewalls.

7. Which configuration component is typically managed using Templates/Template Stacks rather than Device Groups?

Templates and Template Stacks are used for Network and Device settings, which include interface configurations. Policies and Objects (like Address Objects and URL Filtering Profiles) are managed within Device Groups.

8. What is the maximum depth allowed for a Device Group hierarchy below the 'Shared' scope?

Panorama supports a maximum nesting depth of four Device Group levels beneath the top-level 'Shared' context.

9. If an Address Object with the name 'Server-A' (e.g., 10.1.1.1) is defined in a Parent Device Group, and another Address Object also named 'Server-A' (e.g., 192.168.1.1) is defined in a Child Device Group, which IP address will 'Server-A' represent for a policy rule within the Child Device Group?

Objects defined at a lower (more specific) level in the hierarchy override objects with the same name defined at higher (more general) levels. The Child DG's definition of 'Server-A' (192.168.1.1) takes precedence for policies within that Child DG.

10. Where are Post-rules in the 'Shared' scope evaluated in the comprehensive firewall policy evaluation order?

'Shared' Post-rules are evaluated very late in the sequence, after all Device Group specific rules (Pre, Local, Post) and any local firewall rules, but before the final Default Security Rules. This makes them suitable for ultimate cleanup actions.