Routing Policy, Filtering, and High Availability
Policy structure
A Junos policy-statement contains ordered terms. Each term matches conditions in from (protocol, prefix-list, route-filter, community, as-path, neighbor, interface) and applies actions in then (accept, reject, next term, local-preference, metric, community add/delete, as-path prepend, next-hop). Terms are evaluated top-down; the first terminating action wins.
Trap: if no term matches, evaluation falls through to the next policy in the chain. If nothing accepts the route, the protocol default applies - accept on import, reject on export. This is why advertising IGP or local routes into BGP requires an explicit export policy; the absence of one is not a bug.
Filtering tools
route-filter match types are worth memorizing:
exact- the prefix onlylonger- more specifics, not the prefix itselforlonger- the prefix and all more specificsupto /24- the prefix and specifics down to the given lengthprefix-length-range /20-/24
Use prefix-list for simple lists and route-filter inside policy for length-sensitive logic.
High availability
- Graceful restart lets a control plane restart while forwarding is preserved; neighbors must run in helper mode.
- NSR (nonstop routing) synchronizes protocol state to the backup Routing Engine so neighbors never notice a failover and no helper is required.
- BFD gives fast failure detection independent of hello timers; detection time ≈ minimum-interval × multiplier, so keep the multiplier at 3 or higher.
- GRES and unified ISSU combine with these for hitless upgrades.
Worked example
To accept 10.0.0.0/8 and every more specific down to /24: from route-filter 10.0.0.0/8 upto /24; then accept; - longer would exclude 10.0.0.0/8 itself.