Understanding Conditionally Generated Routes
Generated routes are used as the route of last resort. A packet is forwarded to the route of last resort when the routing tables have no information about how to reach that packet’s destination. One use of route generation is to generate a default route to use if the routing table contains a route from a peer on a neighboring backbone.
A generated route becomes active when it has one or more contributing routes. A contributing route is an active route that is a more specific match for the generated destination. For example, for the destination 128.100.0.0/16, routes to 128.100.192.0/19 and 128.100.67.0/24 are contributing routes, but routes to 128.0.0.0./8, 128.0.0.0/16, and 128.100.0.0/16 are not.
A route can contribute only to a single generated route. However, an active generated route can recursively contribute to a less specific matching generated route. For example, a generated route to the destination 128.100.0.0/16 can contribute to a generated route to 128.96.0.0/13.
By default, when generated routes are installed in the routing table, the next hop is chosen from the primary contributing route.
You can configure only one generated route for each destination prefix.
To configure generated routes in the default routing table (inet.0
), include
the generate
statement:
generate { (defaults | route destination ) { (active | passive); as-path <as-path> <origin (egp | igp | incomplete)> <atomic-aggregate> <aggregator as-number in-address>; community [ community-ids ]; discard; (brief | full); (metric | metric2 | metric3 | metric4) metric <type type>; policy policy-name; (preference | preference2 | color | color2) preference <type type>; tag metric type number; } }
You cannot configure generated routes for the IPv4 multicast routing table (inet.1) or the
IPv6 multicast routing table (inet6.1
).
Starting from Junos OS release 15.1R3 onwards, generate route with table next-hop is supported.
The generate statement consists of two parts:
-
defaults
—Here you specify global generated route options. These are treated as global defaults and apply to all the generated routes you configure in the generate statement. This part of the generate statement is optional. -
route
—Here you configure individual generated routes. In this part of the generate statement, you optionally can configure generated route options. These options apply to the individual destination only and override any options you configured in the defaults part of the generate statement.