01-03 Static Route Configuration
01-03 Static Route Configuration
Switches
Configuration Guide - IP Unicast Routing 3 Static Route Configuration
This chapter describes the functions, purposes, and applications of static routes,
and explains how they can be configured.
3.1 Overview of Static Routes
3.2 Understanding Static Routes
3.3 Application Scenarios for Static Routes
3.4 Summary of Static Route Configuration Tasks
3.5 Default Settings for Static Routes
3.6 Configuring IPv4 Static Routes
3.7 Configuring Static BFD for IPv4 Static Routes
3.8 Associating IPv4 Static Routes with NQA
3.9 Associating IPv4 Static Routes with EFM
3.10 Configuring IPv6 Static Routes
3.11 Configuring Static BFD for IPv6 Static Routes
3.12 Configuration Examples for Static Routes
Definition
A static route is a fixed route that allows network traffic to reach its target
destination. Typically, static routes are manually configured by network
administrators.
Purpose
Static routes are used in different ways on different types of network.
● On simple networks, static routes can be used alone, without the need for
dynamic routes.
● On complex networks, static routes can be used alongside dynamic routes to
improve network performance and ensure that bandwidth is available for
important applications.
● Static routes can be associated with VPN instances to manage VPN routes.
● If the BFD session bound to a static route detects a link fault, BFD reports the
link fault to the Routing Management (RM) module. The RM module then
sets the route to inactive, and this route is no longer available in the routing
table.
● If the BFD session bound to a static route detects that the faulty link has been
re-established, BFD reports a message to the RM module. The RM module
then sets the route to active, and this route becomes available in the IP
routing table once again.
For more details about BFD, see Understanding BFD in "BFD Configuration" in the
S1720, S2700, S5700, and S6720 V200R011C10 Configuration Guide - Reliability.
This problem requires an effective solution to detect faults in links for static
routes. BFD for static routes is applicable only in situations where both
communicating devices support it. However, if either of the two communicating
devices supports Network Quality Analysis (NQA), NQA for static routes can be
used to detect faults.
NQA for static routes refers to the association between a static route and an NQA
test instance. The system can use the NQA test instance to check the link status.
Based on the NQA test result, the system can determine an optimal route in time
to prevent communication interruptions and ensure service quality. NQA for static
routes works as follows:
● If NQA detects a fault in the link, the system sets the static route to inactive.
The route becomes unavailable and is deleted from the IP routing table.
● If NQA detects that the link has recovered, the system sets the static route to
active. The route becomes available and is re-added to the IP routing table.
For details about NQA, see NQA Configuration in the S1720, S2700, S5700, and
S6720 V200R011C10 Configuration Guide - Network Management and
Monitoring.
NOTE
When a static route is associated with an NQA test instance, only ICMP test instances are
used to test whether the source and destination can be reached through routes.
Each static route can be associated with only one NQA test instance.
Applications
On the network shown in Figure 3-1, access switches connect to users. Because
dynamic routing protocols are not available for communication between RouterB
and users, static routes are configured on RouterB. To make the network more
stable, RouterC is configured with static routes to the same destination as
RouterB, providing route backup. RouterA, RouterB, and RouterC run a dynamic
routing protocol to learn routes from each other. RouterB and RouterC import
static routes using a dynamic routing protocol and have different costs configured
for these static routes. After configuration is complete, RouterA can use the
dynamic routing protocol to learn from RouterB and RouterC the routes to users.
RouterA uses the link associated with the static route with the lower cost as the
active link, and the other link as the standby link.
NQA for static routes is also configured on RouterB. NQA tests are performed to
check the active link of RouterB → SwitchA → SwitchC → SwitchD. If the active
link fails, the static route is deleted from the routing table, and traffic diverts to
the standby link of RouterC → SwitchB → SwitchC → SwitchD. If both links are
working properly, traffic travels along the active link.
IP Network
RouterA
RouterB RouterC
SwitchA SwitchB
SwitchC SwitchD
In addition, you also need to control the priority and prefix length of a static route
to enable ping packets to always be forwarded through this static route. The
NOTICE
A device enabled with this feature always stores static routes in its IP routing
table, regardless of whether the static routes are reachable. If a path is
unreachable, the corresponding static route may become a blackhole route.
Applications
In Figure 3-2, border routers BR1, BR2, and BR3 belong to ISP1, ISP2, and ISP3
respectively. There are two links between BR1 and BR2, Link A and Link B.
However, ISP1 requires that service traffic be forwarded to ISP2 over Link A
without traveling through ISP3.
ISP2
BR2
10.1.1.2/24
LinkA
BR1
ISP1
LinkB BR3
ISP3
If Link A is working properly, BR1 forwards ping packets over Link A. If Link A
becomes faulty, the static route is still preferred because permanent advertisement
of static routes is enabled, despite the fact that service traffic can reach BR2 over
Link B. BR1 still attempts to forward ping packets over Link A, but fails. This
scenario also applies to BGP packets, resulting in a link fault that interrupts the
BGP peer relationship. The monitoring system detects service faults as returned in
the ping result and prompts maintenance engineers to rectify the faults before
services are affected.
Preference=60
Preference=60
SwitchA SwitchC
SwitchD
Both static routes from SwitchA to SwitchC have a preference value of 60 and are
stored in the routing table.
Route Backup
To implement route backup, set different preference values for different routes to
the same destination, as shown in Figure 3-4.
Preference=60
Preference=100
SwitchA SwitchC
SwitchD
There are two static routes with different preference values from SwitchA to
SwitchC. Static route B with next hop SwitchB has a smaller value, which signifies
a higher preference. The link associated with static route B functions as the active
link. Static route D with next hop SwitchD has a lower preference. The link
associated with static route D functions as the standby link, providing link backup
if a fault occurs on the active link.
● In normal situations, the link associated with static route B is the active link.
Static route B is included in the routing table and is used to forward data.
Static route D is not included in the routing table and is not used to forward
data.
● If a fault occurs on the active link, static route B is deleted from the routing
table. Static route D is added to the routing table and is used to forward data.
● When the fault on the active link is resolved, static route B is reactivated, and
is once again used to forward data. Static route D is deleted from the routing
table and functions as the backup route.
● Static routes used for backup are also known as floating static routes.
2 SwitchB 4
1 5
SwitchA SwitchC
In Figure 3-5, if no default static route is configured, static routes destined for
networks 3, 4, and 5 must be configured on SwitchA, static routes destined for
networks 1 and 5 must be configured on SwitchB, and static routes destined for
networks 1, 2, and 3 must be configured on SwitchC. Once all of these static
routes are configured, SwitchA, SwitchB, and SwitchC can communicate with each
other.
The next hop of packets sent by SwitchA to networks 3, 4, and 5 is SwitchB.
Therefore, configuring a single default route on SwitchA can replace the three
static routes destined for networks 3, 4, and 5. Similarly, configuring a single
default route from SwitchC to SwitchB can replace the three static routes destined
for networks 1, 2, and 3.
Pre-configuration Tasks
Before configuring IPv4 static routes, configure link layer parameters and IP
addresses for interfaces to ensure network-layer communication between
neighbor nodes.
Configuration Procedure
You can perform the following configuration tasks (excluding the task of Verifying
the IPv4 Static Route Configuration) in any sequence as required.
Context
When creating static routes, you can specify both the outbound interface and next
hop. Alternatively, you can specify only the outbound interface or next hop,
depending on the interface type:
● For point-to-point (P2P) interfaces, specify the outbound interface.
● For non-broadcast multiple access (NBMA) interfaces, specify the next hop.
● For broadcast interfaces (for example, Ethernet interfaces), specify the next
hop.
Specifying the same preference value for static routes to the same destination
implements load balancing among these routes. Conversely, specifying different
preference values for static routes to the same destination implements route
backup among the routes.
Setting the destination IP address and mask to all 0s configures the default IPv4
static route. By default, no default IPv4 static route is configured.
Procedure
Step 1 Run system-view
NOTE
To implement load balancing among an Ethernet interface's static route and other static
routes, configure the outbound interface and next hop.
Only the S6720EI, S6720S-EI, S5720HI, S5720EI, S6720SI, S6720S-SI, S5730SI, S5730S-EI,
S5720SI, S5720S-SI, S6720LI, S6720S-LI, S5720LI, S5720S-LI, S2720EI, S1720X-E, S1720GW-
E, S1720GWR-E, S1720GW, S1720GWR, S1720X support commands with the vpn-instance
parameter.
----End
Context
The default preference value of IPv4 static routes affects route selection. When an
IPv4 static route is configured without specifying a preference value, the default
preference value is used.
Procedure
Step 1 Run system-view
NOTE
After the default preference value is reconfigured, the new default preference value is valid
only for new IPv4 static routes.
----End
Context
Link connectivity directly affects network stability and availability. Monitoring link
status is an important part of network maintenance. If service traffic needs to be
forwarded along a specified path, you can monitor the status of the path by
pinging the destination addresses of static routes. In this manner, you can monitor
services at a very low cost.
Procedure
Step 1 Run system-view
NOTE
Only the S6720EI, S6720S-EI, S5720HI, S5720EI, S6720SI, S6720S-SI, S5730SI, S5730S-EI,
S5720SI, S5720S-SI, S6720LI, S6720S-LI, S5720LI, S5720S-LI, S2720EI, S1720X-E, S1720GW-
E, S1720GWR-E, S1720GW, S1720GWR, S1720X support the vpn-instance vpn-instance-
name parameter.
----End
Context
If the BFD session associated with a static route on the switch is in AdminDown
state, you can configure the switch not to select the static route. This ensures that
the switch can work together with non-Huawei devices.
By default, a static route can still be selected by the switch even if the BFD session
associated with it is in AdminDown state. However, this is not the case for non-
Huawei devices. As a result, the switch cannot interwork with non-Huawei devices.
Procedure
Step 1 Run system-view
The switch is configured not to select the static route if the associated BFD session
is in AdminDown state.
By default, a static route can still be selected by the switch even if the associated
BFD session is in AdminDown state.
----End
Context
If a link failure occurs on a network with IGP (OSPF for example), static, and
blackhole routes, static routes may be iterated to a blackhole route to remain
active. Static routes are preferentially selected over OSPF routes because they have
a higher priority. Although active, the static routes are unreachable because they
have been iterated to a blackhole route, resulting in service interruptions.
To address this problem, prevent static routes from being iterated to a blackhole
route so that OSPF routes will be preferentially selected.
Procedure
Step 1 Run system-view
----End
Procedure
● Run the display ip routing-table command to check brief information about
the IPv4 routing table.
● Run the display ip routing-table verbose command to check detailed
information about the IPv4 routing table.
----End
Pre-configuration Tasks
Before configuring static BFD for IPv4 static routes, complete the following tasks:
Procedure
Step 1 Run system-view
NOTE
Only the S6720EI, S6720S-EI, S5720HI, S5720EI, S6720SI, S6720S-SI, S5730SI, S5730S-EI,
S5720SI, and S5720S-SI support BFD for IPv4 static routes.
Before associating a static route with a BFD session, ensure that the BFD session and static
route are on the same link.
BFD Echo function can be associated with the a static route.
When a BFD session is associated with VRRP or a static route, by default, the system does
not allow the associated BFD session to be deleted. To delete the associated BFD session,
run the bfd session nonexistent-config-check disable command to prevent the device
from checking whether the associated BFD session is deleted. Note that deleting the BFD
session will prevent the configured association function from being implemented.
----End
● Run the display bfd session all [ verbose ] command to check information
about the BFD session.
Pre-configuration Tasks
Before associating IPv4 static routes with NQA, configure link layer parameters for
interfaces to ensure that the link layer protocol status on the interfaces is Up.
Procedure
Step 1 Configure an NQA ICMP test instance.
1. Run system-view
NOTE
When a static route is associated with an NQA test instance, only ICMP test instances
are used to test whether there are reachable routes between the source and
destination.
4. Run destination-address ipv4 ip-address
In an NQA test instance, you can specify an NQA server by running the
destination-address command to configure a destination address for the
NQA test instance.
5. (Optional) Run frequency interval
The number of probes to be sent each time is set for the NQA test instance.
By sending probes multiple times in an NQA test instance, you can accurately
estimate network quality based on the collected statistics.
7. Run:start
The start command can be used to configure an NQA test instance to start
immediately, at a specified time, or after a specified delay period. You can
perform one of the following operations as required:
– Run:start now [ end { at [ yyyy/mm/dd ] hh:mm:ss | delay { seconds
second | hh:mm:ss } | lifetime { seconds second | hh:mm:ss } } ]
The NQA test instance starts immediately.
– Run:start at [ yyyy/mm/dd ] hh:mm:ss [ end { at [ yyyy/mm/dd ]
hh:mm:ss | delay { seconds second | hh:mm:ss } | lifetime { seconds
second | hh:mm:ss } } ]
The NQA test instance will start at a specified time.
– Run:start delay { seconds second | hh:mm:ss } [ end { at [ yyyy/mm/dd ]
hh:mm:ss | delay { seconds second | hh:mm:ss } | lifetime { seconds
second | hh:mm:ss } } ]
The NQA test instance will start after a specified delay period.
8. Run quit
NOTE
The destination address of an NQA test instance cannot be the destination address of
an associated static route.
If the static route to be associated with an NQA test instance is already associated
with a different NQA test instance, the static route is disassociated from the first NQA
test instance once it becomes associated with the new NQA test instance.
----End
Pre-configuration Tasks
Before associating IPv4 static routes with EFM, set link layer protocol parameters
and assign IP addresses to interfaces to ensure that the link layer protocol status
of the interfaces is Up.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ip route-static ip-address { mask | mask-length } { nexthop-address |
interface-type interface-number [ nexthop-address ] } [ preference preference ]
track efm-state interface-type interface-number [ description text ]
EFM is associated with the IPv4 static route.
----End
Pre-configuration Tasks
Before configuring IPv6 static routes, configure link layer parameters and IPv6
addresses for interfaces to ensure network-layer communication between
neighbor nodes.
Configuration Procedure
You can perform the following configuration tasks (excluding the task of Verifying
the IPv6 Static Route Configuration) in any sequence as required.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Configure IPv6 static routes.
● Run ipv6 route-static dest-ipv6-address prefix-length { interface-type
interface-number [ nexthop-ipv6-address ] | nexthop-ipv6-address }
[ preference preference | tag tag ] * [ description text ]
To implement load balancing among an Ethernet interface's static route and other static
routes, configure the outbound interface and next hop.
Only the S6720EI, S6720S-EI, S5720HI, S5720EI, S6720SI, S6720S-SI, S5730SI, S5730S-EI,
S5720SI, S5720S-SI, S6720LI, S6720S-LI, S5720LI, S5720S-LI, S2720EI, S1720X-E, S1720GW-
E, S1720GWR-E, S1720GW, S1720GWR, S1720X support commands with the vpn-instance
vpn-instance-name parameter.
----End
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ipv6 route-static default-preference preference
The default preference value of IPv6 static routes is set.
The default preference value of static routes is initially set to 60.
After the default preference value is reconfigured, the new default preference
value is valid only for new IPv6 static routes.
----End
Usage Scenario
To use BFD sessions to provide link detection for IPv6 static routes, you can bind
IPv6 static routes to BFD sessions. One IPv6 static route can be bound to one BFD
session.
Optimal IPv6 static routes are delivered to the forwarding table for packet
forwarding. However, IPv6 static routes cannot detect the status of the link to the
next hop. You can bind IPv6 static routes to BFD sessions. A BFD session can fast
detect changes over a link and inform the routing management system of the
changes. The routing management system immediately deletes the static route
that is bound to the BFD session from the forwarding table and recalculates
another active route. In this manner, fast route convergence is implemented.
Pre-configuration Tasks
Before configuring static BFD for IPv6 static routes, complete the following tasks:
● Configure link layer protocol parameters and IP addresses for interfaces and
ensure that the link layer protocol of the interfaces is Up.
● Configure a BFD session. For details, see BFD Configuration in the S1720,
S2700, S5700, and S6720 V200R011C10 Configuration Guide - Reliability.
.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ipv6 route-static dest-ipv6-address prefix-length { interface-type interface-
number [ nexthop-ipv6-address ] | nexthop-ipv6-address | vpn-instance vpn-
destination-name nexthop-ipv6-address } [ preference preference | tag tag ] *
[ track bfd-session cfg-name ] [ description text ]
A BFD session is bound to an IPv6 static route.
NOTE
Only the S6720EI, S6720S-EI, S5720HI, S5720EI, S6720SI, S6720S-SI, S5730SI, S5730S-EI,
S5720SI, and S5720S-SI support static BFD for IPv6 static routes.
Before associating a static route with a BFD session, ensure that the BFD session and static
route are on the same link.
When a BFD session is associated with VRRP or a static route, the system does not allow
the associated BFD session to be deleted by default. To delete the associated BFD session,
run the bfd session nonexistent-config-check disable command to prevent the device
from checking whether the associated BFD session is deleted. However, deleting the BFD
session will prevent the configured association function from being implemented.
----End
Information about a BFD session can be viewed only after parameters of the BFD
session are set and the BFD session is established.
Networking Requirements
In Figure 3-6, PC1, PC2, and PC3 are on different network segments, and are
connected through SwitchA, SwitchB, and SwitchC. Any two PCs must be
connected using static routes to communicate with each other without using
dynamic routing protocols.
GE0/0/3
VLANIF40
10.1.2.1/24
GE0/0/1 GE0/0/2
VLANIF10 VLANIF20
10.1.4.2/30 10.1.4.5/30
SwitchB
SwitchA SwitchC
GE0/0/1 GE0/0/1
VLANIF10 VLANIF20
10.1.4.1/30 10.1.4.6/30
GE0/0/2 GE0/0/2
VLANIF30 VLANIF50
10.1.1.1/24 10.1.3.1/24
PC1 PC3
10.1.1.2/24 10.1.3.2/24
Configuration Roadmap
The configuration roadmap is as follows:
1. Create VLANs, add interfaces to VLANs, and assign IPv4 addresses to VLANIF
interfaces so that neighboring devices can communicate with each other.
2. Configure an IPv4 default gateway on each PC, and configure IPv4 static
routes or default static routes on each Switch so that any two PCs on
different network segments can communicate with each other.
Procedure
Step 1 Create VLANs and add interfaces to the VLANs.
# Configure SwitchA. The configurations of SwitchB and SwitchC are similar to the
configuration of SwitchA.
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan batch 10 30
[SwitchA] interface gigabitethernet 0/0/1
[SwitchA-GigabitEthernet0/0/1] port link-type trunk
[SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
[SwitchA-GigabitEthernet0/0/1] quit
[SwitchA] interface gigabitethernet 0/0/2
[SwitchA-GigabitEthernet0/0/2] port link-type access
[SwitchA-GigabitEthernet0/0/2] port default vlan 30
[SwitchA-GigabitEthernet0/0/2] quit
----End
Configuration Files
● SwitchA configuration file
#
sysname SwitchA
#
vlan batch 10 30
#
interface Vlanif10
ip address 10.1.4.1 255.255.255.252
#
interface Vlanif30
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 30
#
ip route-static 0.0.0.0 0.0.0.0 10.1.4.2
#
return
#
interface Vlanif20
ip address 10.1.4.5 255.255.255.252
#
interface Vlanif40
ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 40
#
ip route-static 10.1.1.0 255.255.255.0 10.1.4.1
ip route-static 10.1.3.0 255.255.255.0 10.1.4.6
#
return
● SwitchC configuration file
#
sysname SwitchC
#
vlan batch 20 50
#
interface Vlanif20
ip address 10.1.4.6 255.255.255.252
#
interface Vlanif50
ip address 10.1.3.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 20
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 50
#
ip route-static 0.0.0.0 0.0.0.0 10.1.4.5
#
return
Relevant Information
Video
How to Configure a Static Route
How to Configure a Default Route
How to Configure a Floating Static Route
PC2
FC00:0:0:2002::2/64
GE0/0/3
VLANIF30
GE0/0/1 FC00:0:0:2002::1/64
VLANIF20 GE0/0/2
FC00:0:0:2010::2/64 VLANIF40
FC00:0:0:2020::1/64
SwitchA SwitchB
SwitchC
GE0/0/1 GE0/0/1
VLANIF20
VLANIF40
FC00:0:0:2010::1/64 FC00:0:0:2020::2/64
GE0/0/2 GE0/0/2
VLANIF10 VLANIF50
FC00:0:0:2001::1/64 FC00:0:0:2003::1/64
PC1 PC3
FC00:0:0:2001::2/64 FC00:0:0:2003::2/64
Configuration Roadmap
The configuration roadmap is as follows:
1. Create VLANs, add interfaces to the VLANs, and assign IPv6 addresses to
VLANIF interfaces so that neighboring devices can communicate with each
other.
2. Configure an IPv6 default gateway on each PC, and configure IPv6 static
routes or default static routes on each Switch so that any two PCs on
different network segments can communicate with each other.
Procedure
Step 1 Add interfaces to VLANs.
# Configure SwitchA. The configurations of SwitchB and SwitchC are similar to the
configuration of SwitchA.
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan batch 10 20
[SwitchA] interface gigabitethernet 0/0/1
[SwitchA-GigabitEthernet0/0/1] port link-type trunk
[SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 20
[SwitchA-GigabitEthernet0/0/1] quit
[SwitchA] interface gigabitethernet 0/0/2
[SwitchA-GigabitEthernet0/0/2] port link-type access
[SwitchA-GigabitEthernet0/0/2] port default vlan 10
[SwitchA-GigabitEthernet0/0/2] quit
Step 3 Configure IPv6 addresses for the PCs and default gateway addresses.
Assign IPv6 addresses to the PCs, and set the default gateway address of PC1, PC2,
and PC3 to fc00:0:0:2001::1, fc00:0:0:2002::1, and fc00:0:0:2003::1 respectively.
Step 4 Configure IPv6 static routes.
# Configure a default IPv6 static route on SwitchA.
[SwitchA] ipv6 route-static :: 0 vlanif20 fc00:0:0:2010::2
Destination : :: PrefixLength : 0
NextHop : FC00:0:0:2010::2 Preference : 60
Cost :0 Protocol : Static
RelayNextHop : :: TunnelID : 0x0
Interface : Vlanif20 Flags :D
----End
Configuration Files
● SwitchA configuration file
#
sysname SwitchA
#
ipv6
#
vlan batch 10 20
#
interface Vlanif10
ipv6 enable
ipv6 address FC00:0:0:2001::1/64
#
interface Vlanif20
ipv6 enable
ipv6 address FC00:0:0:2010::1/64
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 20
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
#
ipv6 route-static :: 0 Vlanif20 FC00:0:0:2010::2
#
return
Networking Requirements
In Figure 3-8, SwitchA connects to the network management system (NMS)
across a network segment through SwitchB. Static routes need to be configured
on SwitchA so that SwitchA can communicate with the NMS. Link fault detection
between SwitchA and SwitchB must be completed within a few milliseconds to
speed up route convergence.
GE0/0/1 10.2.2.1/24
SwitchA VLANIF10 SwitchB NMS
10.1.1.2/24
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure a BFD session between SwitchA and SwitchB to complete link fault
detection within a few milliseconds.
2. Configure a static route from SwitchA to the NMS and bind a BFD session to
the static route to complete link fault detection within a few milliseconds and
speed up route convergence.
Procedure
Step 1 Create VLANs and add interfaces to the VLANs.
# Check the IP routing table on SwitchA. The command output shows that the
static route 10.2.2.0/24 exists in the routing table.
[SwitchA] display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 5 Routes : 5
# Check the IP routing table on SwitchA. The command output shows that the
static route 10.2.2.0/24 does not exist. This is because the static route has been
bound to a BFD session, and BFD immediately notifies that the bound static route
becomes unavailable after detecting a link fault.
[SwitchA]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 2 Routes : 2
# Check the IP routing table on SwitchA. The command output shows that the
static route 10.2.2.0/24 exists in the routing table. This is because BFD
immediately notifies that the bound static route becomes reachable again after
detecting link recovery.
[SwitchA] display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 5 Routes : 5
----End
Configuration Files
● SwitchA configuration file
#
sysname SwitchA
#
vlan batch 10
#
bfd
#
interface Vlanif10
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
bfd aa bind peer-ip 10.1.1.2
discriminator local 10
discriminator remote 20
commit
#
ip route-static 10.2.2.0 255.255.255.0 10.1.1.2 track bfd-session aa
#
return
#
sysname SwitchB
#
vlan batch 10 20
#
bfd
#
interface Vlanif10
ip address 10.1.1.2 255.255.255.0
#
interface Vlanif20
ip address 10.2.2.2 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
bfd bb bind peer-ip 10.1.1.1
discriminator local 20
discriminator remote 10
commit
#
return
Relevant Information
Video
How to Configure a Static Route
How to Configure a Default Route
How to Configure a Floating Static Route
Configuration Roadmap
The configuration roadmap is as follows:
Procedure
Step 1 Configure IPv6 addresses for interfaces of SwitchA and SwitchB.
# Configure SwitchA. The configuration of SwitchB is similar to that of SwitchA.
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] ipv6
[SwitchA] interface GigabitEthernet 0/0/1
[SwitchA-GigabitEthernet0/0/1] undo portswitch
[SwitchA-GigabitEthernet0/0/1] ipv6 enable
[SwitchA-GigabitEthernet0/0/1] ipv6 address fc00::1 64
[SwitchA-GigabitEthernet0/0/1] quit
Step 3 Configure a default static route and bind the route to the BFD session.
# On SwitchA, configure a default static route to SwitchB and bind the route to
the BFD session named aa.
[SwitchA] ipv6 route-static 0::0 0 fc00::2 track bfd-session aa
The command output shows that the BFD session has been established and is Up.
Run the display current-configuration | include bfd command in the system
view. The command output shows that the default static route has been bound to
the BFD session. The display on SwitchA is used as an example:
[SwitchA] display current-configuration | include bfd
bfd
bfd aa bind peer-ipv6 FC00::2
ipv6 route-static :: 0 FC00::2 track bfd-session aa
# Check the IPv6 routing table on SwitchA. The command output shows that the
default static route exists in the routing table.
[SwitchA] display ipv6 routing-table
Routing Table : Public
Destinations : 5 Routes : 5
Destination : :: PrefixLength : 0
NextHop : FC00::2 Preference : 60
Cost :0 Protocol : Static
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/1 Flags : RD
# Check the IPv6 routing table on SwitchA. The command output shows that the
default static route 0::0/0 does not exist. This is because the default static route
has been bound to a BFD session, and BFD immediately notifies that the bound
static route becomes unavailable after detecting a link fault.
[SwitchA] display ipv6 routing-table
Routing Table : Public
Destinations : 1 Routes : 1
----End
Configuration Files
● SwitchA configuration file
#
sysname SwitchA
#
ipv6
#
bfd
#
interface GigabitEthernet0/0/1
undo portswitch
ipv6 enable
ipv6 address FC00::1/64
#
bfd aa bind peer-ipv6 FC00::2
discriminator local 10
discriminator remote 20
commit
#
ipv6 route-static :: 0 FC00::2 track bfd-session aa
#
return
NOTE
In this scenario, ensure that all connected interfaces have STP disabled. If STP is enabled
and VLANIF interfaces of switches are used to construct a Layer 3 ring network, an
interface on the network will be blocked. As a result, Layer 3 services on the network
cannot run normally.
Internet
RouterA RouterB
10.1.10.1/24 10.1.20.1/24
SwitchA
GE0/0/1 GE0/0/2
VLANIF 100 VLANIF 200
10.1.10.2/24 10.1.20.2/24
GE0/0/3
VLANIF 300
10.1.30.2/24
LSW
Client
Configuration Roadmap
1. Create VLANs, add interfaces to the VLANs, and configure IP addresses for
VLANIF interfaces, so that neighboring devices can communicate with each
other.
2. Create ICMP NQA test instances to monitor the status of links.
ICMP NQA test instances need to be created on the NQA client SwitchA to
detect the status of links between SwitchA and RouterA and between SwitchA
and RouterB.
3. Configure default static routes and bind them to the NQA test instances.
Default static routes destined for RouterA and RouterB need to be configured
on SwitchA and bound to NQA test instances. In this way, if an NQA test
instance detects a link failure, traffic is switched to the other link.
Procedure
Step 1 On SwitchA, create VLANs and add interfaces to them.
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan batch 100 200 300
[SwitchA] interface gigabitethernet 0/0/1
[SwitchA-GigabitEthernet0/0/1] port link-type trunk
[SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 100
[SwitchA-GigabitEthernet0/0/1] quit
[SwitchA] interface gigabitethernet 0/0/2
[SwitchA-GigabitEthernet0/0/2] port link-type trunk
[SwitchA-GigabitEthernet0/0/2] port trunk allow-pass vlan 200
[SwitchA-GigabitEthernet0/0/2] quit
Step 4 Configure default static routes and bind them to the NQA test instances.
[SwitchA] ip route-static 0.0.0.0 0.0.0.0 10.1.10.1 track nqa user test1
[SwitchA] ip route-static 0.0.0.0 0.0.0.0 10.1.20.1 track nqa user test2
Completion:failed and Lost packet ratio: 100 % in the command output show
that the link between SwitchA and RouterB is faulty.
# Check the routing table. Only the default static route to RouterA is available.
[SwitchA] display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 7 Routes : 7
----End
Configuration Files
SwitchA configuration file
#
sysname SwitchA
#
vlan batch 100 200 300
#
interface Vlanif100
ip address 10.1.10.2 255.255.255.0
#
interface Vlanif200
ip address 10.1.20.2 255.255.255.0
#
interface Vlanif300
ip address 10.1.30.2 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 100
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 200
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 300
#
ip route-static 0.0.0.0 0.0.0.0 10.1.10.1 track nqa user test1
ip route-static 0.0.0.0 0.0.0.0 10.1.20.1 track nqa user test2
#
nqa test-instance user test1
test-type icmp
destination-address ipv4 10.1.10.1
frequency 11
interval seconds 5
timeout 4
probe-count 2
start now
#
nqa test-instance user test2
test-type icmp
destination-address ipv4 10.1.20.1
frequency 11
interval seconds 5
timeout 4
probe-count 2
start no
#
return
Relevant Information
Video
How to Configure a Static Route
How to Configure a Default Route
How to Configure a Floating Static Route
GE0/0/1 192.168.2.1/24
SwitchA VLANIF10 SwitchB NMS
192.168.1.2/24
Configuration Roadmap
The configuration roadmap is as follows:
1. Enable Ethernet in the First Mile (EFM) OAM globally and on interfaces of
SwitchA and SwitchB to implement real-time link quality detection.
2. Configure a static route from SwitchA to the NMS and bind the static route to
the EFM state to associate the static route with EFM. When a link where the
static route resides becomes faulty, traffic is switched to a route without link
faults.
Procedure
Step 1 Configure VLANs and add interfaces to the VLANs.
# Configure SwitchA. The configuration of SwitchB is similar to that of SwitchA.
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan 10
[SwitchA-vlan10] quit
[SwitchA] interface gigabitethernet 0/0/1
[SwitchA-GigabitEthernet0/0/1] port link-type trunk
[SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
[SwitchA-GigabitEthernet0/0/1] quit
# Check the IP routing table on SwitchA. The IP routing table contains the static
route 192.168.2.0/24.
[SwitchA] display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 5 Routes : 5
# Run the display efm session all command on SwitchA. The command output
shows that the EFM OAM protocol state is discovery, indicating that the interface
is in OAM discovery state.
[SwitchA] display efm session all
Interface EFM State Loopback Timeout
----------------------------------------------------------------------
GigabitEthernet0/0/1 discovery --
# Check the IP routing table on SwitchA. The IP routing table does not contain the
static route 192.168.2.0/24. This is because the static route has been bound to the
EFM state, and EFM OAM rapidly notifies SwitchA that the static route becomes
unavailable after detecting a link fault.
[SwitchA] display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 4 Routes : 4
# Run the display efm session all command on SwitchA. The command output
shows that the EFM OAM protocol state is detect, indicating that the interface is
in handshake state again.
[SwitchA] display efm session all
Interface EFM State Loopback Timeout
----------------------------------------------------------------------
GigabitEthernet0/0/1 detect --
# Check the IP routing table on SwitchA. The IP routing table contains the static
route 192.168.2.0/24 again. This is because EFM OAM rapidly notifies that the
bound static route becomes reachable again after detecting link recovery.
[SwitchA] display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 5 Routes : 5
----End
Configuration Files
● SwitchA configuration file
#
sysname SwitchA
#
vlan batch 10
#
efm enable
#
interface Vlanif10
ip address 192.168.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
efm enable
#
ip route-static 192.168.2.0 255.255.255.0 192.168.1.2 track efm-state GigabitEthernet0/0/1
#
return
Relevant Information
Video