Configuring an Independent Preference for Static Routes

Configuring independent preferences allows you to configure multiple static routes with different preferences and metrics to the same destination. The static route with the best preference, metric, and reachable next hop is chosen as the active route. This feature allows you to specify preference and metric on a next-hop basis using the qualified-next-hop statement.

Note: The preference and metric options configured by means of this statement only apply to the qualified next hops. The qualified next hop preference and metric override the route preference and metric (for that specific qualified next hop), similar to how the route preference overrides the default preference and metric (for that specific route).

To specify an independent preference for a static route on a point-to-point interface or on an Ethernet interface, include the following statements:

qualified-next-hop address {interface interface-name;metric metric;preference preference;}

For a list of hierarchy levels at which you can include these statements, see the statement summary sections for these statements.

Specify a next-hop interface by including the qualified-next-hop option. Specifying a next-hop interface is useful when you are creating a route to an IPv6 link-local next-hop address (which is a link-only scope address and is specific only to an interface). The preference value can be a number from 0 through 4,294,967,295 (232 – 1). A lower number indicates a more preferred route. The metric value can also be a number from 0 through 4,294,967,295.

You can configure static routes on an unnumbered Ethernet interface by using the qualified-next-hop option to specify the unnumbered interface as the next-hop interface for a configured static route.

To configure an unnumbered Ethernet interface as the next-hop interface for a static route and to specify independent preferences, include the following statements:

qualified-next-hop interface-name {metric metric;preference preference;}

For a list of hierarchy levels at which you can include these statements, see the statement summary sections for these statements.

Keep the following points in mind when you configure static routes for unnumbered Ethernet interfaces:

For information about how to configure an unnumbered Ethernet interface, see the Junos Network Interfaces Configuration Guide.

Note: The qualified-next-hop statement is mutually exclusive with all other types of next hops, except for next-hop address. Therefore, you cannot configure next-hop reject, next-hop discard, and next-hop receive with qualified-next-hop for the same destination.

For sample configurations, see the following sections:

Example: Configuring Independent Preferences for an IPv4 Static Route

The following example configures:

[edit]routing-options {static {defaults {metric 10;preference 10;}route 0.0.0.0/8 {next-hop 192.168.1.254 {retain;no-readvertise;}route 10.0.0.0/8 {next-hop [192.168.1.2];qualified-next-hop 192.168.1.254 {preference 5;}metric 6;preference 7;}}}}

Example: Configuring Independent Preferences for an IPv6 Static Route

Configure the following qualified next hops:

[edit]routing-options {rib inet6.0 {static {defaults {metric 10;preference 10;}route fec0:1:1:4::/64 {next-hop fec0:1:1:2::1 {retain;no-readvertise;}route fec0:1:1:5::/64 {next-hop fec0:1:1:2::3;qualified-next-hop fec0:1:1:2::2 {preference 5;}metric 6;preference 7;}}}}}

Example: Configuring Independent Preferences for an Unnumbered Ethernet Interface

The following example configures two things:

interfaces {lo0 {unit 0 {family inet {address 5.5.5.1/32;address 6.6.6.1/32;}}}}interfacesge-0/0/0 {unit 0 {family inet {unnumbered-address lo0.0;}}}routing-options {static {route 7.7.7.1/32 {qualified next-hop ge-0/0/0.0 {metric 5;preference 6;}}}}