PAN-OS: Template Stack Order and Configuration Precedence

Introduction: Combining Configurations

In Panorama, Templates hold reusable Network and Device settings, while Template Stacks allow you to combine multiple Templates and apply them collectively to a Device Group. This provides modularity and flexibility in configuration management.

However, it's common for different Templates within the same Stack to configure the *same* setting (e.g., both Template A and Template B define DNS servers). Understanding how Panorama resolves these conflicts and determines the final configuration pushed to the firewall is critical.

The key principle is that the order of Templates within the Stack dictates precedence .

Template Stack Processing Order

Top-Down Evaluation, Last Setting Wins

Think of it as applying layers of configuration. Each template adds its settings, potentially overwriting settings applied by the layers (templates) beneath it in the stack.

Example Scenario:

Consider a Template Stack named `Branch-Stack` applied to the `Branch-Firewalls` Device Group, with the following templates listed in this order:

  1. `Global-Network-Settings` Template:
    • DNS Server Primary: 8.8.8.8
    • NTP Server 1: pool.ntp.org
    • Zone: Trust (contains eth1/1)
  2. `Branch-Specific-Settings` Template:
    • DNS Server Primary: 10.1.1.1 (Local DNS)
    • Zone: Guest (contains eth1/3)
    • Syslog Server Profile: Branch-Syslog

Resulting Configuration on a Firewall in `Branch-Firewalls` DG:

graph TD
    subgraph Panorama
        Stack[Template Stack: Branch-Stack] --> T1(Template: Global-Network-Settings);
        Stack --> T2(Template: Branch-Specific-Settings);

        subgraph T1_Config [Config in Global-Network-Settings]
            direction LR
            DNS1_T1[DNS Primary: 8.8.8.8]
            NTP_T1[NTP: pool.ntp.org]
            Zone_T1[Zone: Trust]
        end

        subgraph T2_Config [Config in Branch-Specific-Settings]
            direction LR
            DNS1_T2[DNS Primary: 10.1.1.1]
            Zone_T2[Zone: Guest]
            Syslog_T2[Syslog Profile: Branch-Syslog]
        end

        T1 --> T1_Config;
        T2 --> T2_Config;

        Stack -- Applied To --> DG[Device Group: Branch-Firewalls];
    end

    subgraph ManagedFirewall [Result on Firewall]
        direction LR
        DNS_FW[DNS Primary: 10.1.1.1 - From T2: Overrides T1]
        NTP_FW[NTP: pool.ntp.org - From T1]
        Zones_FW[Zones: Trust, Guest - Merged]
        Syslog_FW[Syslog Profile: Branch-Syslog - From T2]
    end

    DG --> ManagedFirewall;

    style Stack fill:#eaf2f8,stroke:#aed6f1,stroke-width:2px
    style T1 fill:#fdebd0,stroke:#f5b041,stroke-width:1px
    style T2 fill:#fdebd0,stroke:#f5b041,stroke-width:1px
    style DNS1_T2 fill:#f8d7da,stroke:#dc3545    ; Indicates override
    style DNS_FW fill:#d5f5e3,stroke:#58d68d


     
Diagram illustrating Template Stack precedence.

Impact of Template Order

Best Practices

PCNSE Exam Focus

For the PCNSE exam, concerning Template Stack order: