Protocol-Independent Routing · Topic 2 of 4
Aggregate and Generated Routes
Learn Junos aggregate and generated routes for the JN0-364: contributing routes, preference 130, reject and discard next hops and conditional defaults.
- 5 min
- Aggregate and generated routes both have default preference 130.
- They become active only when at least one more specific active contributing route exists.
- Aggregate next hop is reject by default;
discardis the alternative.
What it is
An aggregate route is a summary prefix that Junos creates when at least one more specific contributing route is active. Its next hop is reject by default, so it never forwards traffic itself. It exists to be advertised, usually in BGP, in place of many specific routes.
A generated route is built the same way, but it copies a real forwarding next hop from its primary contributing route. It is the usual way to build a conditional default route: the default exists only while a chosen upstream route exists.
How it works
Configuring an aggregate route
user@router# set routing-options aggregate route 10.10.0.0/16
When any active route inside 10.10.0.0/16, such as 10.10.1.0/24, exists in inet.0, the aggregate becomes active with preference 130.
user@router> show route 10.10.0.0/16 exact
inet.0: 18 destinations, 18 routes (18 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
10.10.0.0/16 *[Aggregate/130] 00:03:12
Reject
Use discard to drop silently instead of sending ICMP unreachable:
user@router# set routing-options aggregate route 10.10.0.0/16 discard
Contributing routes
A route contributes when all of these are true:
- It is more specific than the aggregate or generated prefix.
- It is the active route for its prefix.
- It is not the summary route itself.
By default any protocol can contribute. A policy statement limits which routes count:
user@router# set policy-options policy-statement ONLY-STATIC term 1 from protocol static
user@router# set policy-options policy-statement ONLY-STATIC term 1 then accept
user@router# set policy-options policy-statement ONLY-STATIC term 2 then reject
user@router# set routing-options aggregate route 10.10.0.0/16 policy ONLY-STATIC
The primary contributing route is the one with the lowest route preference. If preferences tie, the route with the numerically lowest prefix wins. For a generated route, the primary contributor supplies the next hop.
show route <prefix> exact detail lists the contributing routes under the summary route, which is the fastest way to see why it is active.
Aggregate compared with generated
| Aggregate route | Generated route | |
|---|---|---|
| Hierarchy | routing-options aggregate route | routing-options generate route |
| Default preference | 130 | 130 |
| Next hop | Reject by default, or discard | Copied from the primary contributor, or discard |
| Forwards traffic | No | Yes |
| Typical use | Summarize customer prefixes into BGP | Conditional default route |
Configuring a conditional default route
An edge router should advertise a default route into OSPF only while it has a route from its upstream provider. Here the provider sends 203.0.113.0/24 in BGP.
user@router# set policy-options policy-statement ISP-UP term 1 from route-filter 203.0.113.0/24 exact
user@router# set policy-options policy-statement ISP-UP term 1 then accept
user@router# set policy-options policy-statement ISP-UP term 2 then reject
user@router# set routing-options generate route 0.0.0.0/0 policy ISP-UP
The policy matters. Without it, any more specific route, including internal routes, would keep the default alive after the provider link fails.
Advertising the summary
Neither route type is advertised automatically. Export it with a policy that matches the protocol:
user@router# set policy-options policy-statement SEND-AGG term 1 from protocol aggregate
user@router# set policy-options policy-statement SEND-AGG term 1 then accept
user@router# set protocols bgp group EXT export SEND-AGG
Generated routes are also matched with from protocol aggregate, because Junos treats both as the aggregate protocol in policy.
In show route, an aggregate route shows Reject or Discard as its next hop. A generated route shows a real next hop such as to 192.0.2.1 via ge-0/0/0.0. That one line usually answers "which kind of route is this?"
Verifying
| Command | What to check |
|---|---|
show route protocol aggregate | Every aggregate and generated route and its state |
show route 0.0.0.0/0 exact detail | Contributing routes and the inherited next hop |
show route advertising-protocol bgp <neighbor> | Whether the summary is actually sent |
Common mistakes
Expecting an aggregate route to forward traffic. Its next hop is reject, so packets that match only the aggregate are dropped with an ICMP unreachable. Traffic is forwarded by the more specific routes.
Building a conditional default without a policy. Any more specific active route contributes by default, so the generated default never goes away.
Forgetting the export policy. The summary sits in inet.0 but no neighbor receives it.
A summary route never counts itself as a contributor, and contributors must be more specific. A /16 route cannot contribute to a /16 aggregate with the same prefix.
What to remember for the exam
- Aggregate and generated routes both have default preference 130.
- They become active only when at least one more specific active contributing route exists.
- Aggregate next hop is reject by default;
discardis the alternative. - Generated routes inherit the next hop of the primary contributing route.
- Primary contributor: lowest preference, then numerically lowest prefix.
- Use
policyto control which routes contribute; this is essential for a conditional default. - Both need an export policy (
from protocol aggregate) to be advertised. show route <prefix> exact detaillists contributing routes.
Check yourself
What is the default next hop of a Junos aggregate route?
Reject, so matching packets are dropped and an ICMP unreachable is sent;
discardcan be configured instead.Why use a generated route instead of an aggregate route for a conditional default?
A generated route copies a real forwarding next hop from its primary contributing route, so it can carry traffic.
An aggregate route 10.10.0.0/16 is configured but does not appear as active. What is the most likely reason?
No active route more specific than 10.10.0.0/16 exists, so there is no contributing route.
Topic 2 of 4 in Protocol-Independent Routing
Test yourself on Protocol-Independent Routing
The full Juniper JNCIS-SP JN0-364 question bank has 860 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.