6.1 Static, Aggregate, and Generated Routes
Key Takeaways
Static routes in Junos OS are configured under [edit routing-options static] and carry a default route preference of 5, making them strictly preferred over internal OSPF (10) and IS-IS (15/18) routes.
Junos supports multiple next-hop options including remote IP addresses, point-to-point interfaces, discard (silent drop), and reject (drops traffic and returns an ICMP destination unreachable message).
Qualified next-hops enable deterministic floating static routes under a single prefix entry without requiring separate route configuration stanzas.
Aggregate routes require at least one active more-specific contributing route in the routing table, carry a default preference of 130, and install a reject next-hop by default.
Generated routes also require active contributing routes and share preference 130, but uniquely inherit the forwarding next-hop of the primary contributing route instead of dropping traffic.
Static, Aggregate, and Generated Routes
In Junos OS, protocol-independent routing features provide granular forwarding control without relying on dynamic neighbor negotiations or routing protocol update packets. Enterprise network engineers deploy static routes for predictable path selection, aggregate routes for hierarchical route summarization, and generated routes for conditional default routing. Mastering their configuration syntax, default route preferences, and forwarding behaviors is vital for the JNCIS-ENT examination.
1. Junos Static Routing Architecture
Static routes in Junos are defined globally under the [edit routing-options static] hierarchy or locally within a specific routing instance under [edit routing-instances <name> routing-options static]. Unlike dynamic protocols that periodically refresh reachability, static routes remain in the Routing Information Base (RIB, known as inet.0 for IPv4 unicast) while their next hop satisfies the configured resolution rules; an installed ARP-reachable subnet does not guarantee the remote service is healthy.
Next-Hop Types and Forwarding Actions
When configuring a static route in Junos, several next-hop types can be specified:
[edit routing-options static]
user@router# set route <destination-prefix> next-hop <target>
| Next-Hop Option | Forwarding Behavior | Common Enterprise Use Case |
|---|---|---|
| IPv4 / IPv6 Address | Resolves the Layer 3 address to an egress interface using connected reachability by default; supported recursive resolution requires its applicable resolve configuration. | Standard gateway pointing to a neighboring router or upstream firewall. |
| Interface Name | Transmits packets directly out the specified physical or logical interface. | Strictly valid only on point-to-point links (e.g., GRE tunnels, serial links). Not valid on broadcast Ethernet interfaces without an explicit IP next-hop. |
discard | Silently drops matched packets without generating any ICMP error response back to the sender. | Null-routing unauthorized subnets, blackholing DDoS traffic, or mitigating forwarding loops. |
reject | Drops matched packets and immediately generates an ICMP Destination Unreachable (host or network unreachable) packet sent back to the source IP. | Route summarization boundaries where downstream subnets do not exist, providing clean diagnostic feedback to clients. |
Critical Junos Rule: You cannot configure an Ethernet interface (such as
ge-0/0/0.0) as the bare next-hop of a static route on a broadcast multi-access network. Because Ethernet networks require Address Resolution Protocol (ARP) to map Layer 3 IP addresses to Layer 2 MAC addresses, Junos cannot resolve which specific host on the multi-access segment should receive the frame. An IP next-hop is mandatory on broadcast Ethernet links unless a qualified point-to-point encapsulation is used.
2. Qualified Next-Hops and Floating Static Routes
In conventional network operating systems, creating a backup "floating" static route requires entering a completely independent static route command containing an artificially inflated administrative distance. In Junos OS, multiple next-hops are organized cleanly under a single route prefix entry using the qualified-next-hop statement.
Qualified Next-Hop Configuration
Consider a scenario where an enterprise branch router forwards traffic toward corporate headquarters (10.50.0.0/16) via a primary high-speed fiber link (192.168.1.1), with a secondary cellular backup gateway (192.168.2.1):
[edit routing-options static]
user@router# set route 10.50.0.0/16 next-hop 192.168.1.1
user@router# set route 10.50.0.0/16 qualified-next-hop 192.168.2.1 preference 150
Under this configuration:
- The primary next-hop
192.168.1.1inherits the default static route preference of 5. - The secondary next-hop
192.168.2.1is assigned an explicit preference of 150. - Because lower preference values are superior in Junos, the primary next-hop is actively installed into the forwarding table (Packet Forwarding Engine).
- If the interface connecting to
192.168.1.1goes operationally down or the next-hop becomes unreachable, Junos automatically activates the qualified next-hop192.168.2.1with preference 150 without deleting the route entry.
3. Junos Default Route Preferences (Administrative Distance)
Junos OS utilizes Route Preference (analogous to Administrative Distance in other platforms) to rank routes learned from different routing protocols or mechanisms. When multiple protocols offer a path to the exact same prefix, Junos installs the route with the lowest preference value into the active forwarding table.
+---------------------------------------------------------------------------------------------------+
| JUNOS OS DEFAULT ROUTE PREFERENCE VALUES |
+----------------------------------+------------------+---------------------------------------------+
| Routing Source / Protocol | Default Value | Operational Characteristics |
+----------------------------------+------------------+---------------------------------------------+
| Direct Interface Route | 0 | Directly connected active subnet |
| Local Interface Route | 0 | Assigned IP address on router interface |
| Static Route | 5 | Default static configuration |
| OSPF Internal | 10 | Both intra-area (Area 0) and inter-area |
| IS-IS Level 1 Internal | 15 | Intra-area link-state routes |
| IS-IS Level 2 Internal | 18 | Inter-area backbone link-state routes |
| RIP | 100 | Distance-vector routing updates |
| Aggregate Route | 130 | Route summarization sink (reject next-hop) |
| Generated Route | 130 | Route summarization with inherited next-hop |
| OSPF External (Type 5 / Type 7) | 150 | AS-external and NSSA redistributed routes |
| IS-IS Level 1 External | 160 | Redistributed routes into Level 1 |
| IS-IS Level 2 External | 165 | Redistributed routes into Level 2 |
| BGP (Both EBGP and IBGP) | 170 | Uniform preference for all BGP routes |
+----------------------------------+------------------+---------------------------------------------+
Critical Preference Traps on the JNCIS-ENT Exam
- Static vs. OSPF Internal: In Cisco IOS, static routes have an administrative distance of 1, beating OSPF (110). In Junos, static routes have a preference of 5, which also beats internal OSPF (10). However, if an engineer configures a qualified static next-hop with preference 12, an internal OSPF route (preference 10) will supersede that static route!
- Uniform BGP Preference: Many networking vendors assign EBGP an administrative distance of 20 and IBGP an administrative distance of 200. In Junos OS, both EBGP and IBGP share an identical default route preference of 170. Junos prefers EBGP over IBGP during the internal BGP path selection algorithm tie-breaker, not through the initial route preference mechanism.
- OSPF External vs. Internal: OSPF intra-area and inter-area routes share preference 10, whereas OSPF external routes (Type 5 LSAs redistributed from static or BGP) receive a preference of 150, making them less preferred than IS-IS internal routes (15 and 18).
4. Aggregate Routes
An aggregate route (routing-options aggregate route <prefix>) synthesizes multiple more-specific routes into a broader summary prefix advertised to upstream peers. This reduces link-state database bloat and shields neighboring routers from flapping subnets.
Operating Characteristics of Aggregate Routes
- Contributing Route Requirement: By default, an aggregate route is inactive without a contributor;
passiveis an explicit exception. It requires at least one active, more-specific route within its address boundary present in the routing table (known as a contributing route). For example, configuring aggregate172.16.0.0/16requires an active route such as172.16.1.0/24or172.16.2.0/24ininet.0. If all contributing routes disappear, Junos makes the aggregate inactive unless configured otherwise. - Default Next-Hop Action: By default, an aggregate route installs a
rejectnext-hop in the forwarding table. If transit traffic arrives addressed to an IP within172.16.0.0/16that does not match an existing, more-specific subnet, the router drops the packet and responds with an ICMP unreachable message. - Default Route Preference: Aggregate routes carry a default preference of 130.
- Policy Filtering: Contributing routes can be selectively restricted using the
policy <policy-name>statement under the aggregate definition.
[edit routing-options]
user@router# set aggregate route 172.16.0.0/16
user@router# set aggregate route 172.16.0.0/16 policy filter-contributing-subnets
5. Generated Routes: The Forwarding Alternative
A generated route (routing-options generate route <prefix>) operates similarly to an aggregate route in that it synthesizes a prefix based on the presence of contributing routes. However, it exhibits one fundamental, high-impact distinction: a generated route inherits the forwarding next-hop of its primary contributing route.
Mechanics of Generated Routes
While an aggregate route functions as a summary route intended to blackhole/reject unassigned address space, a generated route is designed to actively forward packets. When multiple contributing routes exist within the generated prefix boundary, Junos elects a primary contributing route using the following deterministic selection sequence:
- Prefer the contributing route with the lowest route preference, then its preference2 where applicable.
- Break a remaining tie using the numerically lowest destination prefix, rather than its next-hop address.
- If destination addresses tie, use the lower prefix length. Only a usable forwarding contributor supplies a generated route’s next hop.
The generated route extracts the physical next-hop interface and gateway address from this primary contributing route and installs them as its own forwarding destination in the forwarding table.
Enterprise Use Case: Conditional Default Routing
A common enterprise design pattern is generating a default route (0.0.0.0/0) conditioned upon upstream transit reachability:
[edit routing-options]
user@router# set generate route 0.0.0.0/0 policy match-public-bgp
In this deployment, the router only introduces and maintains a default route in inet.0 as long as active BGP routes matching match-public-bgp exist in the table. Furthermore, all transit packets matched to 0.0.0.0/0 are forwarded directly out the next-hop of the primary contributing BGP route. If the upstream provider links fail and the BGP routes withdraw, the generated default route automatically collapses, preventing internal hosts from sending packets into a dead-end link.
6. Comparison: Static vs. Aggregate vs. Generated Routes
| Feature | Static Route | Aggregate Route | Generated Route |
|---|---|---|---|
| Hierarchy | [edit routing-options static] | [edit routing-options aggregate] | [edit routing-options generate] |
| Default Preference | 5 | 130 | 130 |
| Contributing Routes Needed? | No (remains active as long as next-hop is resolvable) | Yes (requires at least one active more-specific route) | Yes (requires at least one active more-specific route) |
| Default Next-Hop Action | Specified target IP, interface, discard, or reject | reject (drops traffic & sends ICMP unreachable) | Inherited from the primary contributing route |
| Forwarding Capability | Forwards directly or drops based on configured target | Sinks non-contributing transit traffic | Actively forwards transit traffic toward primary contributor |
| Primary Enterprise Use | Fixed host routes, edge default paths, out-of-band management | BGP/OSPF route summarization, loop suppression | Conditional default routes tied to upstream transit availability |
7. Verification and Troubleshooting CLI Commands
To inspect protocol-independent routes in Junos OS, utilize the following operational commands:
user@router> show route 10.50.0.0/16 detail
user@router> show route 172.16.0.0/16 exact
user@router> show route table inet.0 protocol aggregate
user@router> show route table inet.0 protocol static
When evaluating aggregate or generated routes, appending the detail or extensive switch displays the active contributing routes, the primary contributor, and the exact next-hop inheritance tree. If an aggregate route is missing from show route, verify that at least one contributing route exists in inet.0 with an active next-hop.
Output note: Command output shown here is a schematic teaching example, not a captured device session. Field names and feature support depend on platform and Junos release.
Official references checked 2026-10-18: Contributor selection.
When an aggregate route is configured in Junos OS under [edit routing-options aggregate route 172.16.0.0/12], what is the default next-hop behavior applied to packets destined to unassigned subnets within that aggregate block?
Junos forwards the packet to the next-hop of the lowest-metric contributing route.
Junos silently drops the packet using a discard next-hop without notifying the sender.
Junos drops the packet and transmits an ICMP destination unreachable message back to the sender using a reject next-hop.
Junos floods the packet out all active interfaces participating in the primary routing instance.
An EX Series switch learns the prefix 10.100.0.0/16 via internal OSPF (intra-area) with a metric of 20, via EBGP with an AS-path length of 1, and also has a static route configured for 10.100.0.0/16 with default settings. Which route will Junos OS install as active in inet.0?
The static route, because Junos assigns static routes a default preference of 5, which beats OSPF internal (preference 10) and BGP (preference 170).
The OSPF route, because dynamic routing protocols always supersede static configurations in Junos unless qualified.
The EBGP route, because external BGP carries an administrative preference of 20 in Junos.
Both the static and OSPF routes, resulting in equal-cost load sharing across both next-hops.
An engineer needs to create a summary route in Junos OS that only remains active as long as at least one public BGP route exists in the routing table, and the summary route must actively forward transit packets out the next-hop of the primary contributing route. Which Junos routing-options statement meets these criteria?
set routing-options static route 0.0.0.0/0 qualified-next-hop discard preference 130
set routing-options aggregate route 0.0.0.0/0 policy match-bgp-routes
set routing-options rib-groups default-leak import-rib [ inet.0 default.inet.0 ]
set routing-options generate route 0.0.0.0/0 policy match-bgp-routes
Sections you finish are checked off in the contents.