The ip route-static vpn-instance command configures an IPv4 static route for a VPN instance.
The undo ip route-static vpn-instance command deletes an IPv4 static route from a VPN instance.
By default, no IPv4 static routes are configured for a VPN instance.
ip route-static vpn-instance vpn-source-name destination-address { mask | mask-length } static-vpn-peer nexthop-address [ preference preference | tag tag | cost cost ] * [ bfd enable | track { bfd-session cfg-name | nqa admin-name test-name | efm-state { efm-interface-name | efm-interface-type efm-interface-number } } | permanent ] [ no-advertise | no-install ] [ inter-protocol-ecmp ] [ description text ]
ip route-static vpn-instance vpn-source-name destination-address { mask | mask-length } nexthop-address [ public ] [ recursive-lookup host-route ] [ preference preference | tag tag ] * [ bfd enable | track { bfd-session cfg-name | nqa admin-name test-name | efm-state { efm-interface-name | efm-interface-type efm-interface-number } } | inherit-cost | permanent ] [ no-advertise | no-install ] [ inter-protocol-ecmp ] [ description text ]
ip route-static vpn-instance vpn-source-name destination-address { mask | mask-length } { interface-name | interface-type interface-number } [ { nexthop-address | dhcp } ] [ preference preference | tag tag ] * [ bfd enable | track { bfd-session cfg-name | nqa admin-name test-name | efm-state { efm-interface-name | efm-interface-type efm-interface-number } } | permanent ] [ no-advertise | no-install ] [ inter-protocol-ecmp ] [ description text ]
undo ip route-static vpn-instance vpn-source-name destination-address { mask | mask-length } { { interface-name | interface-type interface-number } [ { nexthop-address | dhcp } ] }
ip route-static vpn-instance vpn-source-name destination-address { mask | mask-length } { public | vpn-instance vpn-destination-name } [ preference preference | tag tag ] * [ no-advertise | no-install ] [ description text ]
undo ip route-static vpn-instance vpn-source-name destination-address { mask | mask-length } nexthop-address [ public ] [ inherit-cost ]
undo ip route-static vpn-instance vpn-source-name destination-address { mask | mask-length }
undo ip route-static vpn-instance vpn-source-name destination-address { mask | mask-length } { public | vpn-instance vpn-destination-name }
Parameter | Description | Value |
---|---|---|
vpn-source-name |
Specifies the name of a source VPN instance. Each VPN instance has its own routing table. The configured static route is added to the routing table of the specified VPN instance. |
The value is a string of 1 to 31 case-sensitive characters, spaces not supported. In addition, the VPN instance name must not be _public_. When double quotation marks are used around the string, spaces are allowed in the string. |
destination-address |
Specifies the destination IP address of a static route. |
The value is in dotted decimal notation. |
mask |
Specifies the subnet mask. |
The value is in dotted decimal notation. |
mask-length |
Specifies the mask length. |
The value is an integer ranging from 0 to 32. |
interface-type |
Specifies the type of the outbound interface of the static route. |
- |
interface-number |
Specifies the number of the outbound interface of the static route. |
The value is a string of 1 to 63 case-sensitive characters, spaces not supported. |
nexthop-address |
Specifies the next hop address of a static route. If the outbound interface is a broadcast interface, the next hop address must be specified. |
- |
preference preference |
Specifies a priority for the static route. |
The value is an integer that ranges from 1 to 255. The default value is 60. A smaller value indicates a higher priority. |
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 routes with specified tag values through routing policies. |
The value is an integer ranging from 1 to 4294967295. The default value is 0. |
bfd |
Associates a dynamic BFD session with the static route to fast detect faults. |
- |
enable |
Associates a dynamic BFD session with the static route to fast detect faults. |
- |
track |
Specify a track object. |
- |
bfd-session cfg-name |
Associates a static BFD session with the static route to fast detect faults. The undo ip route-static [ track bfd-session ] all command with track bfd-session cfg-name specified dissociates the static route from the current BFD session only without deleting the static route. |
The value is a string of 1 to 64 case-sensitive characters, spaces not supported. |
nqa admin-name |
Associates a static route with an NQA test instance to fast detect faults. The system determines whether to activate a static route based on the link test result of NQA. This helps control static route advertisement and correctly forward the traffic from the remote end. Currently, only ICMP and TCP NQA test instances can be bound to static routes to implement fast fault detection. |
The value is a string of 1 to 32 case-sensitive characters. |
test-name |
Associates the static route with an NQA test instance to fast detect faults so that the system determines whether to activate the static route based on the NQA link detection result to control route advertisement and guide remote traffic. Currently, only ICMP NQA test instances can be bound to static routes to implement fast fault detection. |
The value is a string of 1 to 32 case-sensitive characters. |
efm-state efm-interface-type |
Specifies the interface whose EFM OAM status needs to be detected. After track efm-state is configured, the system responds to the interface Up/Down event that is triggered by the change of EFM OAM extension status, and determines whether to activate static routes. In this manner, route advertisement can be controlled, and the traffic from the remote end can be correctly forwarded. Currently, this parameter can be used only on IPv4 networks, because IPv6 networks do not provide EFM OAM extension for static routes. The interfaces to be detected through track efm-state must be Ethernet interfaces or GE interfaces. |
- |
efm-interface-number |
Specifies the interface whose EFM OAM status needs to be detected. After track efm-state is configured, the system responds to the interface Up/Down event that is triggered by the change of EFM OAM extension status, and determines whether to activate static routes. In this manner, route advertisement can be controlled, and the traffic from the remote end can be correctly forwarded. Currently, this parameter can be used only on IPv4 networks, because IPv6 networks do not provide EFM OAM extension for static routes. The interfaces to be detected through track efm-state must be Ethernet interfaces or GE interfaces. |
The value is a string of 1 to 63 case-sensitive characters, spaces not supported. |
permanent |
Configures permanent advertisement of the static route. If service traffic needs to be forwarded along a specified path, regardless of the link status. You can specify permanent to configure permanent advertisement of static routes. |
- |
no-advertise |
Prevents static routes from being advertised. In network maintenance scenarios, static routes are required to verify services. If you do not want these static routes to be imported by other protocols, specify no-advertise to prevent these static routes from being advertised. no-advertise takes effect only when it is configured for all the active static routes with the same destination address and mask. |
- |
description text |
Specifies the description of the static route. You can specify description to configure a description for static routes. This is convenient for the administrator to check and maintain static routes. To check the configured description, run the display this or display current-configuration command in the system view. The description parameter cannot be followed by other parameters, such as bfd and preference. Otherwise, the configuration will be used only as the description. For example, if ip route-static 1.1.1.1 255.255.255.255 NULL0 description aa preference 10 is run, aa preference 10 is used as the description. |
The description is a string of 1 to 150 characters, spaces supported. |
public |
Indicates that the specified nexthop-address is a public network address. If the nexthop-address parameter is not specified, a device searches the public network forwarding table if the device fails to find a forwarding path in the current VPN instance forwarding table. |
- |
recursive-lookup |
Recursive route lookup policy. |
- |
host-route |
Recurses the static route to a 32-bit host route. |
- |
inherit-cost |
Enables the static route to inherit the cost of recursive routes. If you have specified an outbound interface for a static route, you can no longer specify inherit-cost for the static route. |
In a scenario in which an L2VPN accesses an L3VPN, the direct-route track pw-state command can be configured to control the cost of a direct route to reduce downstream traffic loss during the traffic switchback after the primary PW recovers. The CSG is connected to a number of base stations. These base stations usually use logical IP addresses to communicate with AGGs. As a result, packets cannot be forwarded over direct routes between base stations and AGGs. In addition, AGGs do not have routes to the logical IP addresses of stations. In this situation, static routes must be configured on AGGs. As network administrators usually configure consecutive logical IP addresses for base stations based on IP address planning, you need to configure static routes to specific base stations on AGGs. If the static routes are not associated with the PW status, some downstream traffic may be lost during the traffic switchback after the primary PW recovers. To solve this problem, associate static routes with the PW status. If you do not specify outbound interfaces when configuring static routes, the static routes will recurse to direct routes. In this situation, specify inherit-cost so that the static routes can inherit the costs of recursive routes. Because the costs of direct routes are determined by the PW status, this configuration can associate static routes with the PW status, which reduces traffic loss during the traffic switchback. |
no-install |
Prevents the static route from being delivered to the FIB. |
- |
inter-protocol-ecmp |
Enables inter-protocol load balancing among static routes and the routes of dynamic routing protocols. If a static route is the optimal or suboptimal route and the optimal and suboptimal routes share the same priority, the static route and the routes of dynamic routing protocols can participate in inter-protocol load balancing. If inter-protocol load balancing among static routes and the routes of dynamic routing protocols is enabled for any static route in the routing table, the other static routes in the routing table that have the same prefix as that of this static route can also participate in inter-protocol load balancing with the routes of dynamic routing protocols. Intra-protocol and inter-process load balancing and inter-protocol load balancing are mutually exclusive. If you configure them both, the former takes effect. Inter-protocol load balancing does not take effect in the following cases:
|
- |
static-vpn-peer |
Specifies the IP address of a static VPN peer. |
The value is in dotted decimal notation. |
cost cost |
Specifies a cost value for a static route. |
The value is an integer ranging from 1 to 4294967295. The default value is 0. |
vpn-destination-name |
Specifies the name of the destination VPN instance. If the destination VPN instance is specified and no next hop address is specified, the Next-Table function is configured. In this case, after receiving packets, the device searches the forwarding table of the source VPN instance for a forwarding entry with the destination VPN instance. Then, the device searches the forwarding table of the destination VPN instance for the corresponding forwarding entry. |
The value is a string of 1 to 31 case-sensitive characters, spaces not supported. In addition, the VPN instance name must not be _public_. When double quotation marks are used around the string, spaces are allowed in the string. |
dhcp |
Sets the IP address of a DHCP gateway as the next hop of the static route. |
- |
Usage Scenario
In a simple IPv4 VPN, the ip route-static vpn-instance command can be used to configure static routes for this VPN.
If the destination address and mask of a static route are all 0s, the static route is a default route.Prerequisites
A VPN instance has been configured using the ip vpn-instance command.
BFD has been enabled so that static routes can be associated with the BFD session. An NQA test instance has been created so that static routes can be associated with the NQA test instance.Follow-up Procedure
If a configured static route needs to be sent to the peer PE, import the static route into BGP running between the PEs.
Precautions
If a fault occurs on the network or the topology changes, static routes cannot automatically change. Therefore, exercise caution when configuring static routes.
During the configuration of a static route for a VPN instance, nexthop-address can belong to a VPN instance or a public network. When the next hop address of the static route is a public network address, you need to specify public following nexthop-address. If the outbound interface is a broadcast interface, you need to specify the next hop address. If the undo ip route-static vpn-instance command is run, all static route configurations in the specified VPN instance are deleted. Therefore, exercise caution when running the command. After the static route configuration is saved and the device is restarted in CFG mode, the configuration sequence in the configuration file may be different from that before the restart.<HUAWEI> system-view [~HUAWEI] ip vpn-instance vpn1 [*HUAWEI-vpn-instance-vpn1] ipv4-family [*HUAWEI-vpn-instance-vpn1-af-ipv4] quit [*HUAWEI-vpn-instance-vpn1] quit [*HUAWEI] ip vpn-instance vpn2 [*HUAWEI-vpn-instance-vpn2] ipv4-family [*HUAWEI-vpn-instance-vpn2-af-ipv4] quit [*HUAWEI-vpn-instance-vpn2] quit [*HUAWEI] ip route-static vpn-instance vpn1 10.1.1.1 32 vpn-instance vpn2 172.16.1.2