Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

static (Routing Options)

Syntax

Hierarchy Level

Description

Configure static routes to be installed in the routing table. You can specify any number of routes within a single static statement, and you can specify any number of static options in the configuration.

Options

defaults—(Optional) Specify global static route options. These options only set default attributes inherited by all newly created static routes. These are treated as global defaults and apply to all the static routes you configure in the static statement.

Note:

Specifying the global static route options does not create default routes. These options only set default attributes inherited by all newly created static routes.

route—Configure individual static routes. In this part of the static statement, you optionally can configure static route options. These options apply to the individual destination only and override any options you configured in the defaults part of the static statement.

  • destination-prefix/prefix-lengthdestination-prefix is the network portion of the IP address, and prefix-length is the destination prefix length.

When you configure an individual static route in the route part of the static statement, specify the destination of the route (in route destination-prefix) in one of the following ways:

  • network/mask-length, where network is the network portion of the IP address and mask-length is the destination prefix length.

  • default if this is the default route to the destination. This is equivalent to specifying an IP address of 0.0.0.0/0.

    Note:

    IPv4 packets with a destination of 0.0.0.0 (the obsoleted limited broadcast address) and IPv6 packets with a destination of 0::0 are discarded by default. To forward traffic destined to these addresses, you can add a static route to 0.0.0.0/32 for IPv4 or 0::0/128 for IPv6.

  • nsap-prefixnsap-prefix is the network service access point (NSAP) address for ISO.

  • next-hop address—Reach the next-hop routing device by specifying an IP address, an interface name, or an ISO network entity title (NET).

    IPv4 or IPv6 address of the next hop to the destination, specified as:

    • IPv4 or IPv6 address of the next hop

    • Interface name (for point-to-point interfaces only)

    • address or interface-name to specify an IP address of a multipoint interface or an interface name of a point-to-point interface.

      Note:

      If an interface becomes unavailable, all configured static routes on that interface are withdrawn from the routing table.

      Note:

      Load balancing is not supported on management and internal Ethernet (fxo) interfaces because this type of interface cannot handle the routing process. On fxp interfaces, you cannot configure multiple next hops and enable load balancing.

next-hop options—Additional information for how to manage forwarding of packets to the next hop.

  • discard—Do not forward packets addressed to this destination. Instead, drop the packets, do not send ICMP (or ICMPv6) unreachable messages to the packets’ originators, and install a reject route for this destination into the routing table.

  • iso-net—Reach the next-hop routing device by specifying an ISO NSAP.

  • next-table routing-table-name—Name of the next routing table to the destination.

    If you use the next-table action, the configuration must include a term qualifier that specifies a different table than the one specified in the next-table action. In other words, the term qualifier in the from statement must exclude the table in the next-table action. In the following example, the first term contains rib vrf-customer2.inet.0 as a matching condition. The action specifies a next-hop in a different routing table, vrf-customer1.inet.0. The second term does the opposite by using rib vrf-customer1.inet.0 in the match condition and vrf-customer2.inet.0 In the next-table action.

    Note:

    Within a routing instance, you cannot configure a static route with the next-table inet.0 statement if any static route in the main routing instance is already configured with the next-table statement to point to the inet.0 routing table of the routing instance. For example, if you configure on the main routing instance a static route 192.168.88.88/32 with the next-table test.inet.0 statement and the routing instance test is also configured with a static route 192.168.88.88/32 with the next-table inet.0 statement, the commit operation fails. Instead, you must configure a routing table group both on the main instance and on the routing instance, which enables you to install the static route into both routing tables.

    Note:

    With the fix for PR 1383419, configuring a static route with a next-table action on QFX5xxx/EX4xxx switches results in software forwarding when the prefix length is less than 16 bits for IPv4 or 64 bits for IPv6. To avoid possible performance impact you should configure multiple static routes with prefixes equal to or longer than 16 and 64 bits for IPv6 and IPv6, respectively

  • receive—Install a route for this next-hop destination into the routing table.

    The receive option forces the packet to be sent to the Routing Engine.

    The receive option can be useful in the following cases:

    • For receiving MPLS packets destined to a VRF instance's loopback address

    • For receiving packets on a link's subnet address, with zeros in the host portion of the address

  • reject—Do not forward packets addressed to this destination. Instead, drop the packets, send ICMP (or ICMPv6) unreachable messages to the packets’ originators, and install a reject route for this destination into the routing table.

static-options—(Optional under route) Additional information about static routes, which is included with the route when it is installed in the routing table.

You can specify one or more of the following in static-options. Each of the options is explained separately.

  • (active | passive);

  • as-path <as-path> <origin (egp | igp | incomplete)> <atomic-aggregate> <aggregator as-number in-address>;

  • community [ community-ids ];

  • (install | no-install);

  • (metric | metric2 | metric3 | metric4) value <type type>;

  • (preference | preference2 | color | color2) preference <type type>;

  • (readvertise | no-readvertise);

  • (resolve | no-resolve);

  • (retain | no-retain);

  • tag metric type number;

The remaining statements are explained separately. See CLI Explorer.

Required Privilege Level

routing—To view this statement in the configuration.

routing-control—To add this statement to the configuration.

Release Information

Statement introduced before Junos OS Release 7.4.

Support for BFD authentication introduced in Junos 9.6.

Support for BFD authentication introduced in Junos 9.6 for EX Series switches.