Traditional routing decisions are based solely on the destination IP address. Advanced Policy-Based Routing (APBR) enhances this by enabling custom routing decisions based on multiple criteria, such as source IP, application, or protocol. This provides granular traffic control, optimizing network utilization and meeting specific business requirements.
Traffic selection involves identifying specific packets based on predefined criteria and applying custom routing rules to them.
APBR enables traffic to be forwarded into specific routing instances instead of the default routing table.
Policy-based decisions allow administrators to customize traffic routing behaviors beyond traditional routing protocols.
This example routes HTTP traffic through a specific routing instance (ISP1).
Define the policy statement:
set policy-options policy-statement apbr-policy term http-traffic from protocol tcp
set policy-options policy-statement apbr-policy term http-traffic from destination-port 80
set policy-options policy-statement apbr-policy term http-traffic then routing-instance ISP1
Apply the policy to the relevant interface:
set firewall filter filter-name term 1 from protocol tcp
set firewall filter filter-name term 1 then accept
set firewall filter filter-name term default then discard
Redirect traffic from a specific subnet (192.168.1.0/24) to a different routing instance (ISP2).
Define the policy statement:
set policy-options policy-statement apbr-policy term subnet-traffic from source-address 192.168.1.0/24
set policy-options policy-statement apbr-policy term subnet-traffic then routing-instance ISP2
Apply the policy to the interface:
set firewall filter source-filter term 1 from source-address 192.168.1.0/24
set firewall filter source-filter term 1 then accept
Use multiple routing instances to segregate traffic types (e.g., HTTP traffic to ISP1 and FTP traffic to ISP2).
Define routing instances:
set routing-instances ISP1 instance-type forwarding
set routing-instances ISP2 instance-type forwarding
Define APBR policy:
set policy-options policy-statement apbr-policy term http-traffic from destination-port 80
set policy-options policy-statement apbr-policy term http-traffic then routing-instance ISP1
set policy-options policy-statement apbr-policy term ftp-traffic from destination-port 21
set policy-options policy-statement apbr-policy term ftp-traffic then routing-instance ISP2
Apply the policy globally or on specific interfaces.
Check the configured policies to ensure correctness.
show policy-options policy-statement apbr-policy
Verify if sessions are being routed correctly as per the APBR policy.
show security flow session
Enable trace options to debug APBR behavior.
Enable trace options:
set routing-options traceoptions file apbr-trace
set routing-options traceoptions flag policy
View trace logs:
show log apbr-trace
Look for entries showing policy evaluations and routing decisions.
Define Specific Policies:
Test in a Lab Environment:
Monitor Regularly:
Keep Policies Organized:
Junos SRX supports Application-Based Policy-Based Routing, where traffic is routed based on identified applications such as Netflix, Zoom, or YouTube.
Application-based PBR requires AppSecure features (specifically AppID) to be enabled and properly licensed.
Without AppID, any reference to application or application-set in APBR match conditions will be ignored or ineffective.
set security policies default-policy permit-all
set applications application <app-name> ...
set security flow advanced-options appid-enable
Expect questions like:
“Why isn’t application-based PBR matching Netflix traffic?”
Correct answer: AppID is not enabled or not properly licensed.
APBR does not take effect immediately upon packet arrival at the SRX. Instead, it is applied after the packet is accepted by the security policy engine.
Packet Ingress
Zone and Interface Determination
Security Policy Evaluation (allow/deny decision)
Session Creation
APBR Match and Routing-Instance Selection
Forwarding Decision
APBR cannot override security policies. If the traffic is not allowed by a zone-based or global policy, PBR will not be evaluated.
When using multiple routing instances (e.g., ISP1, ISP2) in APBR scenarios, interfaces must be explicitly bound to their corresponding routing instances.
set routing-instances ISP1 instance-type forwarding
set interfaces ge-0/0/1 unit 0 routing-instance ISP1
Without this binding, traffic may not exit through the intended routing instance, even if APBR correctly matches.
You have two ISPs and use PBR to direct VoIP traffic over ISP1 and web browsing over ISP2. Each egress interface must be assigned to the correct routing-instance.
| Misconception | Why It’s Incorrect | Correct Understanding |
|---|---|---|
| APBR replaces routing policy | Misunderstands the design of APBR | APBR complements routing policy; both can coexist, but APBR provides flow-level control |
| Routing instance is always a VRF | Confuses APBR usage with MPLS VPNs | APBR uses forwarding-type routing-instances, not MPLS-based VRFs |
| Policies are global by default | Assumes APBR rules affect all traffic universally | APBR policies only apply to interfaces where they are explicitly attached |
| Application match always works | Ignores licensing and feature dependencies | App-based matching requires AppID, which must be enabled and licensed |
| All traffic is PBR-controlled | Misunderstands default fallback behavior | Only matched traffic is routed by PBR; others use the default routing table |
| Objective | Command | Purpose |
|---|---|---|
| View session routing instance | show security flow session |
See which routing instance is used per session |
| Check applied policy terms | show policy-options policy-statement <name> |
View match and action structure for PBR policies |
| Debug routing decisions | set routing-options traceoptions flag policy |
Enables tracing of policy-based routing evaluations |
| Monitor trace output | show log apbr-trace |
Review routing-instance decision logic |
| Interface-instance binding check | `show interfaces terse | match routing-instance` |
Is APBR evaluated before or after security policy matching?
→ After.
Does APBR apply globally by default?
→ No. You must attach it to specific interfaces.
Can APBR override security zones or firewall policies?
→ No. It only influences routing after the policy allows the session.
Is AppID required for application-based routing?
→ Yes. AppSecure and AppID must be active and licensed.
What is the primary purpose of policy-based routing on an SRX device?
Policy-based routing allows traffic to be forwarded based on policies instead of the routing table.
Normally, routers use the routing table to determine where packets should be forwarded. Policy-based routing overrides this behavior by evaluating traffic against match conditions such as source address, destination address, or application. If a packet matches the policy, it is forwarded to a specified next hop regardless of the routing table entry.
Demand Score: 78
Exam Relevance Score: 89
Why might policy-based routing fail to redirect traffic on an SRX firewall?
The traffic may not match the policy conditions or the policy may not be applied to the correct interface.
PBR policies operate only on interfaces where they are explicitly configured. If the policy is attached to the wrong interface or the match conditions are incorrect, the traffic will continue to follow the normal routing table path. Administrators should verify policy attachment and match criteria when troubleshooting.
Demand Score: 74
Exam Relevance Score: 87
How does policy-based routing interact with the routing table on a Juniper device?
PBR is evaluated before the routing table lookup occurs.
When a packet arrives at the device, the system first evaluates any policy-based routing rules associated with the ingress interface. If a rule matches, the specified next hop is used for forwarding. If no PBR rule matches, the device performs a normal routing table lookup to determine the forwarding path.
Demand Score: 72
Exam Relevance Score: 86