Policy-Based Forwarding (PBF) Overview

Normally, the firewall uses the destination IP address in a packet to determine the outgoing interface. The firewall uses the routing table associated with the virtual router to which the interface is connected to perform the route lookup. Policy-Based Forwarding (PBF) allows you to override the routing table, and specify the outgoing or egress interface based on specific parameters such as source or destination IP address, or type of traffic.

PBF rules allow traffic to take an alternative path from the next hop specified in the route table, and are typically used to specify an egress interface for security or performance reasons.

Example Scenario: Performance Routing

Imagine your company has two links between the corporate office and the branch office: a cheaper internet link and a more expensive leased line. The leased line is a high-bandwidth, low-latency link. For enhanced security, you could use PBF to send unencrypted traffic (like FTP) over the private leased line and other traffic over the internet link. Alternatively, for performance, you could route business-critical applications over the leased line while sending general traffic (like web browsing) over the cheaper link.

Basic comparison of standard routing vs. PBF decision process.

Basic comparison of standard routing vs. PBF decision process.

PBF Concepts: Egress Path and Symmetric Return

Using PBF, you can direct traffic to a specific interface on the firewall, drop the traffic, or direct traffic to another virtual system (on systems enabled for multiple virtual systems).

In networks with asymmetric routes, such as in a dual ISP environment, connectivity issues occur when traffic arrives at one interface on the firewall and leaves from another interface. If the route is asymmetrical, where the forward (SYN packet) and return (SYN/ACK) paths are different, the firewall is unable to track the state of the entire session and this causes a connection failure.

To ensure that the traffic uses a symmetrical path (meaning traffic arrives at and leaves from the same interface on which the session was created), you can enable the Symmetric Return option within the PBF rule.

Network diagram showing dual ISP setup and GlobalProtect VPN
Figure: Asymmetric routing scenario, common in dual ISP or VPN setups, where Symmetric Return is useful.

With symmetric return enabled:

Same Subnet Exception: If the destination IP address of the return traffic is on the same subnet as the ingress/egress interface’s IP address, a normal route lookup is performed, and symmetric return is not enforced. This prevents traffic from being silently discarded in specific local network scenarios.

ARP Table Limit: The maximum number of entries supported in the symmetric return ARP table is limited by the firewall model and is not user-configurable . If this limit is reached, new symmetric return flows may fail. Use the CLI command show pbf return-mac all to check the limit and current usage.

admin@PA-NGFW> show pbf return-mac all

Understanding when and why to use Symmetric Return, especially in dual ISP or complex routing environments, is crucial for network stability and troubleshooting.

PBF Concepts: Path Monitoring

Path monitoring allows you to verify connectivity to a specific IP address (typically the next hop or a reliable target beyond it) so that the firewall can direct traffic through an alternate route when needed.

The firewall uses ICMP pings as heartbeats to verify that the specified IP address is reachable.

A monitoring profile allows you to configure:

When the monitored IP address becomes unreachable, you can configure one of the following actions in the PBF rule's monitoring settings:

When the fail-over or wait-recover action is taken, the monitoring profile continues to check if the target IP address becomes reachable again. If it does, the firewall automatically reverts back to using the original PBF rule path.

Flowchart illustrating Path Monitoring actions upon failure and recovery.

Flowchart illustrating Path Monitoring actions upon failure and recovery.

Behavior on Path Monitoring Failure

The following table summarizes the behavior for new vs. established sessions when a path monitoring failure occurs:

Behavior of a session on a monitoring failure Action: Wait-Recover Action: Fail-Over Action: Disable Rule
For an established session Continue to use egress interface specified in the PBF rule (might fail) Use path determined by routing table (no PBF) Continue to use egress interface specified in the PBF rule (might fail, as rule is active until disabled action takes effect, which might differ slightly from wait-recover internally)
For a new session Use path determined by routing table (no PBF) Use path determined by routing table (no PBF) Check remaining PBF rules. If no match, use the routing table.

Understanding the difference between Fail-over and Wait-recover, especially regarding established sessions, is important for exam scenarios involving high availability and failover behavior.

PBF: Wait-Recover vs. Failover

Policy-Based Forwarding (PBF) allows network administrators to forward traffic based on specific policies (like source IP, destination IP, port, or application) rather than solely relying on the destination IP address in the routing table. When using PBF with multiple potential paths (e.g., different internet connections), mechanisms are needed to handle path failures and recoveries. Two key concepts related to this are Failover and Wait-Recover .

PBF Failover

Failover is the fundamental mechanism for high availability. In the context of PBF:

PBF Wait-Recover

Wait-Recover is a specific mechanism that controls how PBF handles the *restoration* of a previously failed path. It's often an option configured alongside path monitoring and failover.

Key Differences Summarized

Mermaid State Diagram

This diagram illustrates the state transitions for a PBF path with path monitoring, failover, and wait-recover enabled:

Note: To render the diagram, you need a library or tool that supports Mermaid syntax (like GitHub, GitLab, or various plugins/editors).

PBF Failover vs. Wait-Recover: The Driving Analogy

Imagine you have a special GPS rule (that's Policy-Based Forwarding or PBF) for your important work video calls: " Always use the super-fast Main Highway (ISP 1) for video calls! " You also have a slower, but reliable, Side Road (ISP 2) available.

1. Failover: Taking the Detour

Suddenly, there's a big traffic jam or accident! The Main Highway (ISP 1) is completely blocked.

2. Wait-Recover: Checking Before Going Back

After a while, the accident on the Main Highway (ISP 1) is cleared, and the road reopens.

So, What's the Difference in Simple Terms?

You need Failover to deal with the road blockage in the first place. Wait-Recover is like an extra safety check to make getting back on the main road smoother and less frustrating.

PBF Concepts: Service Versus Applications

PBF rules are evaluated based on the initial packets of a session (typically SYN or SYN/ACK). At this early stage, the firewall often does not have enough information to definitively identify the application (App-ID).

Therefore, using application objects in PBF rules is generally not recommended . Whenever possible, use a Service object (which defines Layer 4 TCP/UDP ports) as the matching criteria, as port information is available in the first packet.

App-ID Caching Behavior with PBF

If you *do* specify an application in a PBF rule, the firewall employs App-ID caching :

  1. When the first session for a specific Destination IP/Port/Protocol arrives, the PBF rule might *not* match initially because the App-ID isn't known. The traffic follows the standard route table.
  2. As more packets arrive, the firewall identifies the application and caches this App-ID associated with that Destination IP/Port/Protocol.
  3. When a *new* session starts to the *same* Destination IP/Port/Protocol, the firewall might immediately use the cached App-ID from the previous session. If this cached App-ID matches the PBF rule, the PBF rule *will* be applied to this new session, even if this new session eventually turns out to be a different application. This can lead to incorrect forwarding.

Application Dependencies and Shifts

Furthermore, many modern applications have dependencies or shift their identity during a session. For example:

Because PBF makes its routing decision at the very beginning of the session based on limited information (or potentially a cached App-ID), it cannot react to these mid-session application shifts. The traffic will continue to follow the path determined by the initial PBF evaluation (or lack thereof).

Restrictions: You cannot use custom applications, application filters, or application groups in PBF rules.

Be aware of the limitations and potential pitfalls of using App-ID in PBF rules. Exam questions might test your understanding of App-ID caching and why Service objects are preferred for PBF matching.

Configuration: Create a Policy-Based Forwarding Rule

Use a Policy-Based Forwarding (PBF) rule to direct specific traffic to a designated egress interface, overriding the default routing table path.

Before creating a PBF rule, remember that IPv4 addresses are treated as a subset of IPv6 addresses in policy evaluation.

Steps to Create a PBF Rule:

  1. Navigate and Add Rule:

    • Go to Policies > Policy Based Forwarding and click Add .
  2. General Tab:

    • Enter a descriptive Name for the rule.
    PBF Rule General Tab Screenshot
    Figure: PBF Rule Configuration - General Tab.
  3. Source Tab:

    • Select the Type (Zone or Interface) the rule applies to and specify the source zone(s) or interface(s). You must select a source interface if you intend to use Symmetric Return.
    • Note: Only Layer 3 interfaces support PBF. Loopback interfaces do not.
    • (Optional) Specify Source Address (es) (IP, Address Object, FQDN). Use Negate to exclude specific source IPs/subnets.
    • (Optional) Add Source User (s) or groups.
  4. Destination/Application/Service Tab:

    • Specify Destination Address (es). Default is 'Any'. Use Negate to exclude destinations.
    • (Optional, Not Recommended) Add specific Application (s).
    • (Optional, Recommended) Add Service (s) (e.g., service-http, service-https, or custom service objects).

    As discussed previously, avoid using Applications if possible due to identification timing and caching issues. Use Service objects based on L4 ports instead.

  5. Forwarding Tab:

    • Select the Action :
      • Forward: Directs matching packets to a specified Egress Interface.
      • Forward to VSYS: (Multi-VSYS environments) Sends packets to another virtual system.
      • Discard: Drops matching packets.
      • No PBF: Excludes matching packets from PBF evaluation; these packets will use the standard route table. Useful for creating exceptions.
    • (Optional) Attach a Schedule to apply the rule only during specific times.
    • Select the Egress Interface for the 'Forward' action.
    • Configure the Next Hop :
      • IP Address: Enter the IP address of the next router (must be /32 for IPv4, /128 for IPv6, or use an Address Object).
      • FQDN: Enter a Fully Qualified Domain Name that resolves to the next hop IP. The FQDN must resolve to an IP on the same subnet as the PBF egress interface. The firewall typically uses the first IP returned by DNS for each address family (IPv4/IPv6).
      • None: Uses the packet's destination IP as the next hop. Only works if the destination is directly connected (on the same subnet) as the egress interface.
    • (Optional) Enable Monitor :
      • Attach a monitoring Profile (default or custom).
      • Specify the IP Address to monitor (usually the next hop, but can be another target). If left blank, monitors the configured Next Hop IP.
      • Optionally check Disable this rule if nexthop/monitor ip is unreachable (alternative to profile actions Fail-over/Wait-recover).
    • (Optional, but Required for Asymmetric Routing) Enable Enforce Symmetric Return :
      • Crucially, you MUST Add one or more specific IP addresses in the Next Hop Address List when using Symmetric Return. Failure to do so can exhaust the symmetric return ARP table (see Troubleshooting section).
  6. Commit Changes:

    • Click OK to save the rule, then Commit the configuration to the firewall.

Understanding each option in the PBF rule configuration, especially Action types, Next Hop settings, Monitoring, and Symmetric Return (including its requirement for a Next Hop Address List entry), is vital for configuration and troubleshooting.

Use Case: PBF for Outbound Access with Dual ISPs

This scenario demonstrates using PBF for redundant internet access in a branch office with two ISP connections, without relying on dynamic routing protocols like BGP.

Goal: Use ISP1 as the primary path for most outbound traffic. Use ISP2 as the backup, automatically failing over if ISP1 becomes unavailable.

Diagram of Dual ISP PBF setup
Figure: Network topology for the Dual ISP PBF use case.

Configuration Summary:

  1. Interfaces: Configure interfaces for LAN, ISP1, and ISP2, placing ISP interfaces in appropriate zones (can be the same zone).
  2. Static Route (Backup): Add a default static route (0.0.0.0/0) in the virtual router pointing to the backup ISP's gateway (ISP2). This route will be used if no PBF rule matches or the primary PBF rule fails.
  3. PBF Rule (Primary):
    • Match traffic originating from the LAN zone.
    • Optionally, match specific services (like HTTP/HTTPS) or use 'Any' for all traffic.
    • Optionally, use 'Negate' on Destination Address to exclude traffic destined for internal networks.
    • Action: Forward
    • Egress Interface: Interface connected to ISP1.
    • Next Hop: IP address of the ISP1 gateway router.
    • Monitor: Enable monitoring , targeting the ISP1 gateway (or another reliable IP via ISP1). Use a profile with 'Fail-over' or 'Disable Rule' action on failure.
    • (Optional but recommended for asymmetry) Enforce Symmetric Return (with ISP1 gateway added to Next Hop Address List).
  4. Source NAT Rules: Create two Source NAT rules:
    • Rule 1: Translates traffic from LAN zone going to ISP1 zone (egress interface ISP1) using the ISP1 interface IP address.
    • Rule 2: Translates traffic from LAN zone going to ISP2 zone (egress interface ISP2) using the ISP2 interface IP address.
    • These ensure the correct source IP is used depending on which path (primary PBF or backup static route) the traffic takes.
  5. Security Policy: Create a Security Policy rule allowing traffic from the LAN zone to the ISP zone(s).
Simplified traffic flow for Dual ISP PBF during normal operation and ISP1 failure.

Simplified traffic flow for Dual ISP PBF during normal operation and ISP1 failure.

Verification Steps:

Static Route Configuration
Figure: Configuring the static default route pointing to the backup ISP (ISP2).
PBF Rule Forwarding Tab Configuration
Figure: PBF rule forwarding settings directing traffic to ISP1 with monitoring enabled.
NAT Rules for Dual ISP
Figure: Example NAT rules for translating traffic via ISP1 and ISP2 interfaces.

This Dual ISP configuration using PBF, static routes, monitoring, and interface-based NAT is a common and important scenario to understand for network redundancy.

Use Case: PBF with GlobalProtect and Dual ISPs

This use case builds upon the Dual ISP scenario but adds GlobalProtect VPN, dedicating one ISP link specifically for VPN traffic while the other handles regular internet traffic.

Goal: Route all regular LAN outbound traffic via ISP1 (primary). Route all traffic originating from connected GlobalProtect VPN clients via ISP2.

Network diagram showing dual ISP setup and GlobalProtect VPN
Figure: Network topology dedicating ISP2 for GlobalProtect traffic.

Configuration Adjustments from Dual ISP Use Case:

  1. Interfaces: In addition to LAN, ISP1, ISP2 interfaces, configure a Tunnel interface (e.g., `tunnel.1`) and assign it to a dedicated VPN zone (e.g., 'Zone VPN').
  2. GlobalProtect Setup: Configure GlobalProtect Portal and Gateway.
    • The Gateway will typically listen on an interface connected to the internet (could be ISP1 or ISP2, often the one *not* used for VPN egress if dedicated).
    • Assign an IP pool for VPN clients (e.g., 172.16.1.0/24).
    • Associate the Gateway with the configured Tunnel interface (`tunnel.1`).
    • Configure client settings to push routes (e.g., push 0.0.0.0/0 to force all client traffic through the tunnel).
  3. Static Route (Primary): Keep the default static route pointing to ISP1 for general LAN traffic.
  4. PBF Rule (GlobalProtect Traffic): Create a *new* PBF rule:
    • Source Type: Interface
    • Source Interface: Select the Tunnel interface (`tunnel.1`).
    • Source Address: The IP pool assigned to VPN clients (e.g., 172.16.1.0/24). Or use 'Any' if only VPN client traffic hits the tunnel interface.
    • Destination Address: Typically 'Any', but you might use 'Negate' to exclude destinations reachable via ISP1 or the LAN if split-tunneling were used (though this example uses full tunnel).
    • Action: Forward
    • Egress Interface: Interface connected to ISP2.
    • Next Hop: IP address of the ISP2 gateway router.
    • Monitor: Optional, but recommended for the ISP2 path if redundancy is needed for VPN traffic itself.
    • Symmetric Return: Generally not needed here if NAT handles return path correctly, but consider if ISP2 path has asymmetry issues.
  5. NAT Rules: Keep the NAT rules from the Dual ISP case. Traffic egressing ISP1 (LAN default) uses ISP1 NAT. Traffic egressing ISP2 (VPN via PBF) uses ISP2 NAT.
  6. Security Policy: Ensure Security Policy rules allow traffic:
    • From LAN zone to ISP1 zone.
    • From VPN zone to ISP2 zone.
    • From the zone where the GP Gateway listens (e.g., ISP1 or ISP2 zone) to the firewall itself (for GP connections).

Traffic Flow Summary:

Traffic flow distinguishing LAN vs. GlobalProtect VPN traffic using PBF.

Traffic flow distinguishing LAN vs. GlobalProtect VPN traffic using PBF.

PBF Rule List showing VPN rule
Figure: Example PBF rule list, potentially showing the rule for VPN traffic.
PBF Rule Source Configuration for Tunnel
Figure: Configuring the PBF rule source as the Tunnel interface.
PBF Rule Forwarding Configuration for VPN
Figure: Configuring the PBF rule to forward VPN traffic via the ISP2 interface.

This configuration effectively segregates VPN traffic onto a dedicated ISP link using PBF based on the source tunnel interface, overriding the default route used by regular LAN traffic.

Troubleshooting: Symmetric Return Issues

Connectivity problems can arise when using PBF with Symmetric Return enabled, often due to misconfiguration or resource limits.

Symptom: Forwarding Fails for Specific Traffic

Traffic matching a PBF rule with "Enforce Symmetric Return" enabled fails, while other traffic works.

Diagnosis: Check the Symmetric Return MAC Table

The most common cause is exhausting the firewall's symmetric return MAC address table. This happens frequently if Symmetric Return is enabled *without* specifying any IP addresses in the "Next Hop Address List" within the PBF rule's Forwarding tab.

Use the following CLI command to check the table status:

admin@firewall> show pbf return-mac all

Look for these lines in the output:

If the `total ipv4 return mac entries in table` equals the `maximum ... supported` limit, the table is full, and new symmetric return sessions cannot be established.

PBF Forwarding Tab showing Next Hop Address List
Figure: Adding the required Next Hop Address(es) when using Symmetric Return.

Resolution: Configure Next Hop Address List

To resolve this, edit the PBF rule(s) where "Enforce Symmetric Return" is enabled:

  1. Go to Policies > Policy Based Forwarding .
  2. Edit the relevant PBF rule.
  3. Go to the Forwarding tab.
  4. Under the "Enforce Symmetric Return" section, click Add in the Next Hop Address List .
  5. Enter the IP address(es) of the actual next-hop router(s) reachable via the PBF Egress Interface. You can add up to 8 addresses.
  6. Click OK and Commit the changes.

By specifying the valid next-hop router IP(s), the firewall only needs to learn and store the MAC address(es) for those specific IPs in the symmetric return table, preventing it from filling up unnecessarily with MACs of numerous hosts beyond the next hop.

Key Takeaway: Always add the specific next-hop router IP(s) to the "Next Hop Address List" when enabling "Enforce Symmetric Return" in a PBF rule. Forgetting this step is a common cause of PBF failures in asymmetric environments.

Troubleshooting: Application-Based PBF Issues

Using applications as matching criteria in PBF rules can lead to unexpected behavior due to how and when PBF rules and App-ID are evaluated.

Symptom: PBF Rule Based on Application Doesn't Match Consistently or Matches Incorrectly

You configure a PBF rule to forward, discard, or route specific application traffic (e.g., forward 'youtube-base' via a specific ISP), but the rule doesn't seem to apply, or it applies to traffic that isn't actually that application.

Diagnosis: Understand the Limitations

  1. Timing Issue: PBF rules are evaluated on the first packets (SYN/SYN-ACK). App-ID often requires more packets to identify the application accurately. The PBF decision might be made *before* the application is known, causing the rule to be skipped initially.
  2. App-ID Caching: Once an application is identified for a flow (Destination IP/Port/Protocol), the firewall caches this App-ID. Subsequent *new* sessions to the *same* Destination IP/Port/Protocol might immediately use the cached App-ID for the PBF lookup. If the cached App-ID matches the PBF rule, the rule will apply, even if the new session is actually a different application that just happens to use the same destination/port.
  3. Application Shifts: Many applications change identity mid-session (e.g., web-browsing -> youtube-base). PBF makes its decision at the start and cannot react to these mid-session shifts.
  4. Unsupported Objects: Custom applications, Application Filters, and Application Groups cannot be used in PBF rules. Only pre-defined applications are selectable (and even those are not recommended).
PBF Application Selection showing limited options
Figure: Application selection in PBF rules - custom apps, filters, groups are unavailable.

Resolution / Best Practice

Exam questions often test the understanding that PBF operates early in the flow, before full App-ID might be available, and the implications of App-ID caching when applications *are* used in PBF rules. Knowing why Service objects are preferred is key.

Interactive Quiz: Policy-Based Forwarding

Test your understanding of the key PBF concepts covered.

1. What is the primary function of Policy-Based Forwarding (PBF)?

2. When are PBF rules typically evaluated in the packet flow?

3. What problem does the "Enforce Symmetric Return" option in PBF aim to solve?

4. When enabling "Enforce Symmetric Return", what is crucial to configure to prevent potential issues?

5. What mechanism does the firewall use for Path Monitoring in PBF?

6. If Path Monitoring detects a failure and the PBF rule action is set to "Fail-over", what happens to existing sessions matching that rule?

7. Why is using Application objects generally NOT recommended for PBF rule matching?

8. What happens if a PBF rule matches traffic based on a cached App-ID from a previous session?

9. Which PBF action explicitly tells the firewall *not* to apply PBF to matching traffic, forcing it to use the route table?

10. In the Dual ISP PBF use case, what ensures traffic uses the correct source IP address when egressing either ISP1 or ISP2?

11. In the Dual ISP PBF use case, which route is typically used when the primary ISP path (monitored by PBF) fails?

12. Which object type CANNOT be used in a PBF rule for matching?

13. If a PBF rule uses an FQDN for the Next Hop, what is a requirement for the resolved IP address?

14. What CLI command helps verify the status and configuration of PBF rules?

15. What CLI command is used to check the usage and limits of the Symmetric Return MAC table?

16. Can PBF rules be applied based on the source interface?

17. If a PBF rule has the Next Hop type set to "None", when will forwarding succeed?

18. In the PBF Use Case involving GlobalProtect and Dual ISPs, how is traffic from VPN clients typically directed to the dedicated ISP (ISP2)?

19. Which PBF path monitoring action ensures the routing table is used for *new* sessions but tries to maintain *existing* sessions on the original PBF path during a failure?

20. What determines the order in which PBF rules are evaluated?