Monitoring and Troubleshooting · Topic 2 of 3

Validating Behaviors

Learn to validate SRX behavior for JNCIA-SEC: reading the session table, session filters, NAT rule hits, screens, zones, traffic logs and ping tests.

  • 6 min
In a nutshell
  • Every permitted flow creates a session; show security flow session shows policy, interfaces, NAT and timeout.
  • The In line is the initiating direction; the Out line is the expected reply, showing translated addresses.
  • Filters include source-prefix, destination-prefix, destination-port, protocol, application, summary and extensive.

What it is

Validating behaviors means proving that the SRX does what the configuration says: the right policy permits the traffic, NAT translates it as planned, screens and Content Security act as expected, and the session is built through the right interfaces.

The session table is the center of it. Each session entry records the policy, the interfaces, the translated addresses and the timeout.

Test trafficSession tablepolicy, NAT, interfacesFeature countersNAT, screens, UTMTraffic logscreate and close

How it works

Reading a session

user@srx> show security flow session destination-port 80
Session ID: 3427, Policy name: WEB-OUT/5, Timeout: 1796, Valid
  In: 10.1.1.10/51544 --> 198.51.100.20/80;tcp, If: ge-0/0/1.0, Pkts: 6, Bytes: 712
  Out: 198.51.100.20/80 --> 203.0.113.1/24156;tcp, If: ge-0/0/0.0, Pkts: 5, Bytes: 3240
Total sessions: 1
FieldWhat it tells you
Policy name: WEB-OUT/5The policy that permitted the session, and its index
Timeout: 1796Seconds left before the idle session is removed; TCP starts at 1800
In:The initiating direction, as it arrived, with the ingress interface
Out:The reply direction, as the SRX expects it, with the interface it arrives on
Pkts, BytesTraffic counted in each direction

Read NAT from the two lines. Here the In line shows the private source 10.1.1.10, and the Out line shows replies going to 203.0.113.1, so source NAT translated the host to 203.0.113.1. For destination NAT, the In line shows the public destination and the Out line shows the reply coming from the internal server address.

Exam tip

Packets counted on the In line but zero on the Out line mean the request left the SRX and nothing came back. Look beyond the SRX: the server, its route back, or an upstream device.

Filtering and clearing sessions

Command (operational mode)Use
show security flow session source-prefix 10.1.1.10Sessions from one host or subnet
show security flow session destination-prefix 198.51.100.20Sessions to one destination
show security flow session protocol udpSessions of one protocol
show security flow session application dnsSessions of one application
show security flow session summarySession counts only
show security flow session extensiveFull detail of each session
clear security flow session source-prefix 10.1.1.10Remove matching sessions
clear security flow session allRemove every session

Existing sessions keep the policy and NAT result they were built with. After changing a policy or NAT rule, clear the affected sessions so the next packet builds a new session under the new configuration.

Checking the pieces around the session

When no session appears, check the parts that decide whether one can be built.

What to validateCommand
Interfaces are up and addressedshow interfaces terse
Interfaces are in the expected zonesshow security zones
The route picks the expected egress interfaceshow route 198.51.100.20
A policy matches the flowshow security match-policies ...
Source NAT rules are hitshow security nat source rule all
Destination and static NAT rules are hitshow security nat destination rule all, show security nat static rule all
Screens are dropping trafficshow security screen statistics zone untrust
Content Security is actingshow security utm web-filtering statistics and the other UTM statistics
No sessionInterfacesand zonesRouteto destinationPolicymatchNATrule hitsScreensstatistics

Screens act before the policy lookup, so check screen statistics when untrusted traffic is dropped with no policy log.

Validating with logs

Policy logs confirm behavior over time. With then log session-init session-close on the policy, each session writes a create message and a close message.

The close message carries the reason the session ended, for example a TCP FIN, a TCP RST or an idle timeout, together with packet and byte counts. A close reason of idle timeout on a session that should still be active points to an application timeout that is too short.

Testing from the SRX itself

ping and traceroute from the SRX test routing and reachability. Use source to send from a specific interface address.

user@srx> ping 198.51.100.20 source 203.0.113.1 count 5
user@srx> traceroute 198.51.100.20 source 10.1.1.1

These tests start on the SRX, so they are not transit traffic and do not test the security policy between two zones. To test a policy, send traffic from a host in the source zone, or use show security match-policies.

monitor traffic interface ge-0/0/1.0 captures packets on an interface, but only traffic to or from the SRX itself. Transit traffic handled in the forwarding path does not appear, which is why flow traceoptions exist.

Validating the flow mode

show security flow status shows the forwarding mode for each family. By default, IPv4 is processed in flow mode, which is what builds sessions and applies policies, NAT and screens.

Common mistakes

Expecting a policy change to affect existing sessions. Unless policy-rematch is enabled, sessions keep the result they were built with until they time out or are cleared.

Testing a transit policy with ping from the SRX. Traffic the SRX starts does not use the zone pair policies you are testing.

Using monitor traffic for transit packets. It sees only host-bound and host-generated traffic.

Ignoring the Out line. It shows the translated addresses and whether replies arrive.

Watch out

clear security flow session all drops every session on the device, including management and VPN traffic passing through it. Clear with a filter such as source-prefix whenever you can.

What to remember for the exam

  • Every permitted flow creates a session; show security flow session shows policy, interfaces, NAT and timeout.
  • The In line is the initiating direction; the Out line is the expected reply, showing translated addresses.
  • Filters include source-prefix, destination-prefix, destination-port, protocol, application, summary and extensive.
  • Existing sessions keep their old policy and NAT result; clear them after a change.
  • No session: check interfaces, zones, route, policy, NAT hits and screen statistics.
  • ping and traceroute from the SRX do not test transit policies.
  • monitor traffic shows host traffic only, not transit traffic.

Check yourself

  • A session shows packets on the In line and zero packets on the Out line. What does that mean?

    The SRX forwarded the request but no reply came back, so look at the destination, its return route or upstream devices.

  • You changed a source NAT pool, but existing sessions still use the old address. Why?

    Sessions keep the translation they were built with; clear the affected sessions so new ones use the new pool.

  • Why does a ping from the SRX not prove that the trust to untrust policy permits a host?

    The ping starts on the SRX itself, so it is not transit traffic and is not checked against that zone pair policy.

Topic 2 of 3 in Monitoring and Troubleshooting

Test yourself on Monitoring and Troubleshooting

The full Juniper JNCIA-SEC JN0-232 question bank has 658 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.