- Table of Contents
-
- 04-Network Connectivity Configuration Guide
- 00-Preface
- 01-About the network connectivity configuration guide
- 02-MAC address table configuration
- 03-Ethernet link aggregation configuration
- 04-Port isolation configuration
- 05-VLAN configuration
- 06-Loop detection configuration
- 07-Spanning tree configuration
- 08-LLDP configuration
- 09-Layer 2 forwarding configuration
- 10-PPP configuration
- 11-ARP configuration
- 12-IP addressing configuration
- 13-DHCP configuration
- 14-DHCPv6 configuration
- 15-DNS configuration
- 16-NAT configuration
- 17-IP performance optimization configuration
- 18-IPv6 basics configuration
- 19-Basic IP routing configuration
- 20-Static routing configuration
- 21-IPv6 static routing configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
20-Static routing configuration | 111.41 KB |
Configuring a static route group
Configuring the DHCP-designated default router as the next hop of a static route
Configuring a floating static route
Restrictions and guidelines for static route FRR
Configuring static route FRR by specifying a backup next hop
Configuring static route FRR to automatically select a backup next hop
Display and maintenance commands for static routing
Configuring static routing
About static routes
Static routes are manually configured. If a network's topology is simple, you only need to configure static routes for the network to work correctly.
Static routes cannot adapt to network topology changes. If a fault or a topological change occurs in the network, the network administrator must modify the static routes manually.
Configuring a static route
1. Enter system view.
system-view
2. Configure a static route.
ip route-static dest-address { mask-length | mask } { interface-type interface-number [ next-hop-address ] | next-hop-address } [ permanent ] [ preference preference ] [ tag tag-value ] [ description text ]
By default, no static route is configured.
3. (Optional.) Configure the default preference for static routes.
ip route-static default-preference default-preference
The default setting is 60.
Configuring a static route group
About this task
This task allows you to batch create static routes with different prefixes but the same output interface and next hop.
You can create a static route group, and specify the static group in the ip route-static command. All prefixes in the static route group will be assigned the next hop and output interface specified in the ip route-static command.
Procedure
1. Enter system view.
system-view
2. Create a static route group and enter its view.
ip route-static-group group-name
By default, no static route group is configured.
3. Add a static route prefix to the static route group.
prefix dest-address { mask-length | mask }
By default, no static route prefix is added to the static route group.
4. Return to system view.
quit
5. Configure a static route.
ip route-static group group-name { interface-type interface-number [ next-hop-address ] | next-hop-address } [ permanent ] [ preference preference ] [ tag tag-value ] [ description text ]
By default, no static route is configured.
Configuring the DHCP-designated default router as the next hop of a static route
About this task
After an interface obtains an IP address and gateway address through DHCP, the device automatically generates a static route with the interface as the output interface. The destination address of the static route is 0.0.0.0/0 and the next hop of the static route is the default router (the gateway address designated by the DHCP server). This static route cannot form ECMP routes with manually configured static routes. The device uses this static route to guide traffic forwarding only after the manually configured static routes become invalid.
Perform this task to use both the automatically generated static route and the manually configured static routes to guide traffic forwarding. The task is applicable when the device has dual egress WAN links.
This task enables the device to automatically generate a static route destined for the specified network with the DHCP-designated default router of the output interface as the next hop. This static route takes effect only after the output interface obtains an IP address and gateway address through DHCP, and becomes invalid upon the DHCP lease expiration. The next hop of this static route changes as the gateway address of the output interface changes. In addition, this static route can form ECMP routes with manually configured static routes.
Restrictions and guidelines
When you configure the next hop of a static route as the DHCP-designated default router, make sure the output interface of the static route is a broadcast interface.
Procedure
1. Enter system view.
system-view
2. Configure a static route and specify the default router designated by the DHCP server for the output interface as the next hop of the static route.
ip route-static { dest-address { mask-length | mask } | group group-name } interface-type interface-number dhcp [ backup-interface interface-type interface-number [ backup-nexthop backup-nexthop-address ] ] [ permanent ] [ preference preference ] [ tag tag-value ] [ description text ]
By default, no static route is configured with the DHCP-designated default router as the next hop.
Configuring a floating static route
Perform this task to implement route backup and improve network reliability.
When a static or dynamic route to a destination address already exists on the device, you can configure another static route with a lower priority as the backup route to improve the network reliability. This backup static route is called a floating static route, and it is activated only when the primary route fails. After the primary route recovers from failure, the floating static route becomes inactive, and data forwarding switches back to the primary route.
You can configure a floating static route in either of the following ways:
· Configure different priorities for multiple static routes to the same destination address. The route with lower priority automatically becomes the floating static route.
· When a route to a destination address already exists on the device, configure a static route with a lower priority to the same destination address.
When you configure a floating static route, the priority value of the route must be larger than the priority value of the primary route. For more information, see "Configuring a static route."
Deleting static routes
About this task
To delete a static route, use the undo ip route-static command. To delete all static routes including the default route, use the delete static-routes all command.
Procedure
1. Enter system view.
system-view
2. Delete all static routes.
delete static-routes all
CAUTION: This command might interrupt network communication and cause packet forwarding failure. Before executing the command, make sure you fully understand the potential impact on the network. |
Configuring static route FRR
About static route FRR
A link or router failure on a path can cause packet loss. Static route fast reroute (FRR) enables fast rerouting to minimize the impact of link or node failures.
As shown in Figure 1, upon a link failure, packets are directed to the backup next hop to avoid traffic interruption. You can either specify a backup next hop for FRR or enable FRR to automatically select a backup next hop (which must be configured in advance).
Restrictions and guidelines for static route FRR
Besides the configured static route for FRR, the device must have another route to reach the destination. When the state of the primary link (with Layer 3 interfaces staying up) changes from bidirectional to unidirectional or down, static route FRR quickly redirects traffic to the backup next hop. When the Layer 3 interfaces of the primary link are down, static route FRR temporarily redirects traffic to the backup next hop. In addition, the device searches for another route to reach the destination and redirects traffic to the new path if a route is found. If no route is found, traffic interruption occurs.
Configuring static route FRR by specifying a backup next hop
Restrictions and guidelines
A static route does not take effect when the backup output interface is unavailable.
To change the backup output interface or next hop, you must first remove the current setting. The backup output interface and next hop must be different from the primary output interface and next hop.
Procedure
1. Enter system view.
system-view
2. Configure static route FRR.
ip route-static dest-address { mask-length | mask } interface-type interface-number [ { dhcp | next-hop-address } [ backup-interface interface-type interface-number [ backup-nexthop backup-nexthop-address ] ] ] [ permanent ] [ preference preference ] [ tag tag-value ] [ description text ]
By default, static route FRR is disabled.
Configuring static route FRR to automatically select a backup next hop
1. Enter system view.
system-view
2. Configure static route FRR to automatically select a backup next hop.
ip route-static fast-reroute auto
By default, static route FRR is disabled from automatically selecting a backup next hop.
Display and maintenance commands for static routing
Execute display commands in any view.
Task |
Command |
Display static route information. |
display ip routing-table protocol static [ inactive | verbose ] |
Display static route next hop information. |
display route-static nib [ nib-id ] [ verbose ] |
Display static routing table information. |
display route-static routing-table [ ip-address { mask-length | mask } ] |
For more information about the display ip routing-table protocol static [ inactive | verbose ] command, see basic IP routing in Network Connectivity Command Reference.
Configuring a default route
A default route is used to forward packets that do not match any specific routing entry in the routing table. Without a default route, packets that do not match any routing entries are discarded and an ICMP destination-unreachable packet is sent to the source.
To configure a default route, configure a static route with both destination and mask being 0.0.0.0. For more information, see "Configuring static routing."
As shown in Figure 2, Device B is the next hop for packets from Device A to Device C, Device D, and Device E. You can configure a default route on Device A to replace the three static routes from Device A to Device C, Device D, and Device E. Then, packets that do not match any other routes will be forwarded based on the default route.
Configure the default route as follows:
· Configure the next hop address as 1.1.1.2.
· Configure the destination address as 0.0.0.0.
· Configure the subnet mask as 0.0.0.0.
Figure 2 Configuring a default route