Security policies and security zones are crucial for ensuring proper traffic control and segmentation in Junos SRX Series devices. For a beginner, it’s important to understand that:
Assigning interfaces to a zone:
set security zones security-zone trust interfaces ge-0/0/1
set security zones security-zone untrust interfaces ge-0/0/2
Security policies define how traffic is handled between zones. They consist of criteria for matching traffic and specify actions.
Match Criteria:
Actions:
Stateful Inspection:
Zone-Based Policies:
Applied between specific zones (e.g., Trust to Untrust).
Example:
set security policies from-zone trust to-zone untrust policy allow-http match application junos-http
set security policies from-zone trust to-zone untrust policy allow-http then permit
Global Policies:
When traffic fails to flow as expected, the problem often lies in one of these areas:
Incorrect Policy Order:
Mismatched Criteria:
Session State:
Stale or incorrect session entries can cause issues.
Clear sessions if necessary:
clear security flow session
Logs provide valuable insights into traffic behavior. For example:
Use this command to find logs related to traffic drops:
show log messages | match "RT_FLOW"
Look for entries like "RT_FLOW_SESSION_DENY," which indicate dropped traffic and the reason for it.
Verify which policies are active and whether they are being hit:
Check policies between specific zones:
show security policies from-zone trust to-zone untrust
The output includes:
Analyze existing sessions to ensure traffic matches a policy:
View active sessions:
show security flow session
Verify:
This is a frequent issue when communication between zones is blocked. Steps to resolve:
Verify Interface-Zone Mapping:
Ensure the correct interfaces are assigned to the correct zones:
set security zones security-zone trust interfaces ge-0/0/1
Check Policies:
Ensure a policy exists to allow traffic between the zones:
set security policies from-zone trust to-zone untrust policy allow-http match application junos-http
set security policies from-zone trust to-zone untrust policy allow-http then permit
Review Logs:
Although intra-zone traffic is allowed by default, unintended global policies can override this behavior.
Resolution:
Check for global policies that might be blocking traffic:
show security policies global
If necessary, explicitly permit intra-zone traffic.
To debug why a policy isn’t matching:
Enable traceoptions:
set security policies traceoptions file policy-debug
set security policies traceoptions flag all
View the trace logs:
show log policy-debug
Look for detailed information about why traffic was denied or dropped.
Capture live traffic on a specific interface:
monitor traffic interface ge-0/0/1
This allows you to see exactly what traffic is hitting the interface, which helps identify mismatches or missing policies.
Security policies on Juniper SRX devices are evaluated top-down, and only the first matching policy is applied. This process is fundamental to understanding and troubleshooting why certain traffic is allowed or denied.
Top-Down Matching: Policies are read from top to bottom as configured under each policy context.
First Match Wins: Once a policy matches the traffic, evaluation stops—even if a more specific or seemingly better policy appears further down.
Implicit Deny: If no policy matches the traffic, the default action is deny. While administrators can technically configure a default permit policy, doing so is discouraged from a security perspective.
Global Policy Evaluation Order:
Zone-based policies are evaluated first.
If no zone-based policy matches, and global policies are enabled, global policies are then evaluated.
This subtle priority order is often tested in exams and commonly overlooked during troubleshooting.
Juniper SRX allows address objects and sets to be dynamically referenced in policies, which is extremely useful for scalability—but also a frequent source of errors.
Dynamic address entries (such as address book sets or external feeds) must be fully resolved for a policy to match.
If an address set contains undefined or empty references, the policy may not match any traffic—even if the logic appears sound.
Common exam question: You may be asked to diagnose a policy that uses a dynamic address book object which is not matching traffic.
Use the following command to verify address resolution:
show configuration security address-book
Also verify traffic against expected addresses using:
show security flow session
Logging is an optional but powerful part of security policies. It can be enabled at either session initiation or session closure, and it provides critical visibility during troubleshooting and compliance auditing.
set security policies from-zone <zone1> to-zone <zone2> policy <policy-name> then permit log session-init
or
... then permit log session-close
session-init: Logs the session when it is first created. Useful for tracking connection attempts.
session-close: Logs when the session is torn down. Useful for reviewing session duration and behavior.
Practical Exam Tip: You may be asked to identify which command enables session logging or what type of log entry to expect at session initiation.
Global policies are a powerful tool in Junos, offering policy enforcement across all zones, but they must be explicitly enabled.
Scope: Global policies are applied to any-to-any zone communication unless restricted by match criteria.
Disabled by Default: No global policy is active unless manually configured.
Use Case: They are commonly used for catch-all logging, baseline denial, or fallback permit rules.
set security policies global policy allow-all match application any
set security policies global policy allow-all then permit
Remember to verify their status:
show security policies global
When traffic is not flowing as expected, following a structured troubleshooting process can save time and prevent misdiagnosis. Here is a suggested flowchart-based approach:
| Step | Check Command | Purpose |
|---|---|---|
| 1. Check policy hits | show security policies |
Verify whether the expected policy is matching the traffic (check hit count) |
| 2. Verify interface-zone mapping | show security zones |
Ensure that the interface is assigned to the correct security zone |
| 3. Check session table | show security flow session |
Determine if a session has been successfully created |
| 4. Review logs | `show log messages | match "RT_FLOW"` |
| 5. Clear sessions | clear security flow session |
Remove stale or invalid sessions that may interfere with new ones |
This flow closely mirrors real-world troubleshooting and is often modeled in exam scenarios where the question describes a failed session or misapplied policy.
Why might traffic still be blocked even though a security policy appears to allow it?
The traffic may not match the policy conditions such as zones, addresses, or applications.
Security policies on SRX firewalls are evaluated based on multiple criteria including source zone, destination zone, source address, destination address, and application. If any of these parameters do not match the actual traffic, the policy will not be applied. When no matching policy is found, the firewall applies the default deny action. Administrators should verify that the policy correctly references the zones and address objects associated with the interfaces carrying the traffic.
Demand Score: 94
Exam Relevance Score: 95
What happens if no security policy matches traffic between two zones?
The traffic is denied by the default policy.
SRX firewalls follow a default deny security model. If traffic does not match any configured policy between the source and destination zones, the firewall drops the packet. This ensures that only explicitly permitted traffic is allowed through the device. Administrators must therefore create appropriate policies to allow required communication between zones.
Demand Score: 89
Exam Relevance Score: 92
Why must interfaces be assigned to security zones on an SRX firewall?
Security zones define the trust boundaries used for policy enforcement.
Security policies are evaluated based on traffic moving from one zone to another. If an interface is not assigned to a zone, the firewall cannot determine the security context of the traffic. As a result, policies cannot be evaluated correctly and traffic may be dropped. Assigning interfaces to zones establishes logical trust boundaries that control how traffic flows through the firewall.
Demand Score: 84
Exam Relevance Score: 91
What operational command can help verify which security policy is being matched by traffic?
The command show security flow session can reveal the matched policy.
This command displays active sessions along with the associated security policy that permitted the traffic. By examining the session table, administrators can confirm whether traffic is matching the intended policy or another rule earlier in the policy list. This helps diagnose incorrect policy ordering or misconfigured match conditions.
Demand Score: 82
Exam Relevance Score: 88
How does policy order affect traffic processing on an SRX firewall?
Policies are evaluated sequentially from top to bottom, and the first matching rule is applied.
When traffic enters the firewall, the system checks each policy in order until it finds a match. Once a matching rule is found, the firewall stops evaluating additional policies and applies the action defined in that rule. Therefore, rule ordering is important when multiple policies could match the same traffic.
Demand Score: 83
Exam Relevance Score: 90
Why might a policy counter remain at zero even though traffic is flowing through the firewall?
The traffic may be matching a different policy or bypassing the expected zone pair.
Policy counters increment only when traffic matches the specific policy rule. If the counter remains at zero, the traffic might be matching another rule earlier in the policy list or using a different zone pair than expected. Administrators should verify interface zone assignments, routing paths, and policy order to ensure the correct rule is evaluated.
Demand Score: 86
Exam Relevance Score: 91