Description

Junos OS allows configuration groups to be applied conditionally using the when statement. A configuration group is applied only when all conditions are defined under "when" evaluate to TRUE

Symptoms

  • Security policies configured under a configuration group are not visible in the active policy table:
show security policies
  • Only globally configured policies are displayed, while group-based policies are missing
Configuration is present under:
show configuration groups <group-name>
  • However, expected policies are not shown even with the inheritance view:
show configuration security policies | display inheritance
  • No commit errors are observed, but the expected group configuration is not applied. Policies appear correctly only after modifying or removing the when condition.

Solution

To ensure that policies defined under a configuration group are correctly applied, the "when" condition must match the actual system context.

1. Verify when the condition

Check the group configuration:
show configuration groups <group-name>

2. Ensure that the values used in the when clause (for example, peers) match the actual device/peer identifiers.

Correct the "when peers" knob configuration

3. Update the peer names to match the actual system context:

set groups <group-name> when peers <correct-peer-name>

Example:
set groups abc when peers FW-gw2
set groups abc when peers FW-gw3

4. The peer names must correspond to the configured peer identifiers in the device environment.

Apply the configuration group

Ensure the group is applied:
set apply-groups <group-name>

5. Verify inheritance

Check that the configuration is now applied:

show configuration | display inheritance
show security policies

Note: In Junos, apply-groups only links the configuration group, while the when condition determines whether it is actually applied. If the condition does not match (for example, incorrect peers value), the group is ignored and its policies are not inherited into the active configuration.

Modification History

2026-06-12 : Article Created

2026-06-16 : Non-tech changes