< Home

ip route-static

Function

The ip route-static command configures a unicast static route.

The undo ip route-static command deletes a unicast static route.

By default, no unicast static route is configured.

Format

ip route-static ip-address { mask | mask-length } { nexthop-address | interface-type interface-number [ nexthop-address ] | vpn-instance vpn-instance-name nexthop-address } [ preference preference | tag tag ] * [ track { route-monitor-group route-monitor-group-name | bfd-session cfg-name | efm-state interface-type interface-number | nqa admin-name test-name } | permanent ] [ description text ]

ip route-static ip-address { mask | mask-length } vpn-instance vpn-instance-name [ preference preference | tag tag ] * [ description text ] (supported only by the S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-HI, S6730-H, S6730S-H, S6730-S, and S6730S-S)

undo ip route-static ip-address { mask | mask-length } [ nexthop-address | interface-type interface-number [ nexthop-address ] ] [ preference preference | tag tag ] * [ track { bfd-session | efm-state } | permanent ]

undo ip route-static [ track bfd-session ] all

undo ip route-static ip-address { mask | mask-length } vpn-instance vpn-instance-name (supported only by the S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-HI, S6730-H, S6730S-H, S6730-S, and S6730S-S)

Parameters

Parameter Description Value

ip-address

Specifies a destination IP address.

The value is in dotted decimal notation.

mask

Specifies a subnet mask.

The value is in dotted decimal notation.

mask-length

Specifies the mask length. The 1s in each 32-bit mask must be consecutive. Therefore, a mask in dotted decimal notation can be presented by a mask length.

The value is an integer in the range from 0 to 32.

nexthop-address

Specifies the next-hop address.

The value is in dotted decimal notation.

interface-type interface-number

Specifies the type and number of an interface that forwards packets.

-

vpn-instance vpn-instance-name

Specifies the name of a VPN instance. If a VPN instance name is specified, the device searches the routing table of the VPN instance for a static route according to nexthop-address. If the nexthop-address parameter is not specified, the device searches a specified VPN instance forwarding table if the device fails to find a forwarding path in the public network forwarding table.

The value is a string of 1 to 31 case-sensitive characters with spaces. The string can contain spaces if it is enclosed with double quotation marks (").

preference preference

Specifies the preference of a static route. A smaller value indicates a higher preference.

The value is an integer that ranges from 1 to 255. The default value is 60.

tag tag

Specifies the tag value of a static route. By configuring different tag values, you can classify static routes to implement different routing policies. For example, routing protocols can import static routes with specified tag values through routing policies.

The value is an integer that ranges from 1 to 4294967295. The default value is 0.

track route-monitor-group route-monitor-group-name

Binds a static route to a route monitoring group for fast fault detection.

The value is a string of 1 to 31 case-sensitive characters.

track bfd-session cfg-name

Binds a static BFD session to a static route for fast fault detection.

cfg-name is a string of 1 to 15 characters without spaces. The string can contain spaces if it is enclosed with double quotation marks (").

track efm-state interface-type interface-number

Detects the EFM OAM state of a specified interface.

-

track nqa admin-name test-name

Specifies the administrator name of an NQA test instance bound to a static route, and the name of the test instance.

The values of admin-name and test-name are both a string of 1 to 32 case-sensitive characters without spaces.

permanent

Configures permanent advertisement of static routes.

-

description text

Configures a description for a static route.

The value is a string of 1 to 80 characters that can contain spaces.

all

Deletes all IPv4 unicast static routes.

-

Only the S5720-EI, S5720-HI, S5720I-SI, S5720S-SI, S5720-SI, S5735-S, S5735S-S, S5735-S-I, S5730-HI, S5730S-EI, S5730-SI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6720S-SI, S6720-SI, S6730-H, S6730S-H, S6730-S, and S6730S-S support the track bfd-session cfg-name parameter.

Views

System view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

On a simple network, you can configure static routes to ensure network connectivity. If a switch cannot use dynamic routing protocols for network connectivity, static routes can be configured on the switch.

Precautions

When configuring unicast static routes, note the following:
  • Only public routes can be used for tunnel iteration.
  • If no preference is set for a static route, the static route uses the default preference 60.
  • When both the destination IP address and the mask are set to 0.0.0.0, a default route is configured. If the switch cannot find a route in the routing table to forward packets, the switch uses the default route to forward packets.
  • By setting different preferences, you can implement different routing management policies. For example, if multiple routes to the same destination are configured with the same preference, load balancing can be implemented. If multiple routes to the same destination are configured with different preferences, route backup can be implemented.
  • You can specify the description text parameter to add a description for a static route so that the administrator can easily check and maintain the static route. You can run the display this command in the system view or run the display current-configuration command to view the descriptions of static routes.
  • When configuring static routes, you can specify outbound interfaces or next-hop addresses based on the outbound interface type. For example, you can specify only outbound interfaces for static routes on P2P interfaces and specify only next hops for static routes on NBMA interfaces, and you must specify next hops for static routes on broadcast interfaces.
  • In some cases, for example, the link layer protocol is PPP and the peer IP address is unknown, you can also specify outbound interfaces when configuring a switch. In this manner, you do not need to modify the switch configuration when the peer IP address changes.
  • If two static routes with the same destination IP address are configured, one of the routes is specified with a next hop IP address or outbound interface, and the other static route is configured with a next-hop VPN instance, without an outbound interface or next hop IP address, the latest configuration overwrites the previous one.
  • When configuring static routes, you can specify both the outbound interface or next-hop address for the supernet route. Otherwise, the route cannot be activated. Any route that meets one of the following conditions is a supernet route:
    • If you perform bitwise AND operations on the destination address mask with the destination address and next-hop address, respectively, the calculated network addresses are the same, and the destination address mask is greater than or equal to the next-hop address mask.
    • If you perform bitwise AND operations on the destination address mask with the destination address and next-hop address, respectively, the calculated network addresses are different. However, if you perform bitwise AND operations on the next-hop address mask with the destination address and next-hop address, respectively, the calculated network addresses are the same.

Example

# Set a static route with the destination address and mask are both 0.0.0.0 and the next-hop address 172.16.0.1.

<HUAWEI> system-view
[HUAWEI] ip route-static 0.0.0.0 0.0.0.0 172.16.0.1
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >