Escolar Documentos
Profissional Documentos
Cultura Documentos
This chapter describes the functions, purposes, and applications of static routes, and explains
how they can be configured.
3.1 Static Route Overview
3.2 Principles
3.3 Applications
3.4 Configuration Task Summary
3.5 Default Configuration of 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
3.13 References
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.
l On simple networks, static routes can be used alone, without the need for dynamic
routes.
l On complex networks, static routes can be used alongside dynamic routes to improve
network performance and ensure that bandwidth is available for important applications.
l Static routes can be associated with VPN instances to manage VPN routes.
3.2 Principles
l 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.
l 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 - Principles" in the 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
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.
IS P 2
BR2
1 0 .1 .1 .2 /2 4
L in k A
BR1
IS P 1
L in k B BR3
IS P 3
An External Border Gateway Protocol (EBGP) peer relationship is established between BR1
and BR2, making them BGP peers. For service monitoring purposes, a static route destined
for BR2 at 10.1.1.2/24 is configured on BR1, and permanent advertisement of static routes is
enabled on BR1. The interface that connects BR1 to BR2 is specified as the outbound
interface of the static route. The network monitoring system periodically pings 10.1.1.2 to
determine the status of Link A.
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.
3.3 Applications
P re fe re n ce = 6 0
P re fe re n ce = 6 0
S w itc h A S w itch C
S w itch D
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.
P re fe re n ce = 6 0
P re fe re n ce = 1 0 0
S w itc h A S w itch C
S w itch D
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.
l 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.
l 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.
l 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.
l 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.
Configuring static routes Static routes are manually l 3.6 Configuring IPv4
configured by administrators Static Routes
to ensure normal operations l 3.10 Configuring IPv6
of simple networks and Static Routes
required bandwidth for
important network
applications.
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 Procedures
You can perform the following configuration tasks (excluding checking the configuration) as
required and in any sequence.
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:
l For point-to-point (P2P) interfaces, specify the outbound interface.
l For non-broadcast multiple access (NBMA) interfaces, specify the next hop.
l 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
To implement load balancing among an Ethernet interface's static route and other static routes, configure
the outbound interface and next hop.
Only the S5720S-SI, S5720SI, S5720EI, S5720HI, S6720S-EI and S6720EI 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
Step 2 Run:
ip route-static default-preference preference
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.
After permanent advertisement of static routes is configured, static routes always take effect
regardless of the outbound interface status. In this case, the system forwards ping packets
along a specified path only, which helps monitor the link status of the path.
Procedure
Step 1 Run:
system-view
Step 2 Run:
ip route-static ip-address { mask | mask-length } { nexthop-address | interface-
type interface-number [ nexthop-address ] | vpn-instance vpn-instance-name
nexthop-address } permanent
NOTE
Only the S5720S-SI, S5720SI, S5720EI, S5720HI, S6720S-EI and S6720EI support 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.
To address this problem, run the ip route-static track bfd-session admindown invalid
command to configure the switch not to select the static route if the associated BFD session is
in AdminDown state.
Procedure
Step 1 Run:
system-view
Step 2 Run:
ip route-static track bfd-session session-name bfd-name admindown invalid
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
Step 2 Run:
ip route recursive-lookup blackhole protocol static disable
----End
Procedure
l Run the display ip routing-table command to check brief information about the IPv4
routing table.
l 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:
l Configure link layer parameters and IP addresses for interfaces to ensure network-layer
communication between neighbor nodes.
l Configure a BFD session.
For details, see "BFD Configuration" in S1720&S2700&S5700&S6720 Series Ethernet
Switches - Configuration Guide - Reliability.
Procedure
Step 1 Run:
system-view
NOTE
Only the S5720S-SI, S5720SI, S5720EI, S5720HI, S6720S-EI and S6720EI 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.
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
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
The number of probes to be sent each time is set for the NQA test instance.
By default, the number of probes is 3.
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 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
specified interface goes Down. Traffic is then switched to a route without link faults to
prevent lengthy service interruptions.
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
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 ]
----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 Procedures
You can perform the following configuration tasks (excluding checking the configuration) as
required and in any sequence.
Context
When creating IPv6 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:
l For point-to-point (P2P) interfaces, specify the outbound interface.
l For non-broadcast multiple access (NBMA) interfaces, specify the next hop.
l For broadcast interfaces, specify the outbound interface. If the next hop address is also
specified, it does not need to be a link-local address.
Specifying the same preference value for IPv6 static routes to the same destination
implements load balancing among these routes. Conversely, specifying different preference
values for IPv6 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 IPv6 static route.
By default, no default IPv6 static route is configured.
Procedure
Step 1 Run:
system-view
To implement load balancing among an Ethernet interface's static route and other static routes, configure
the outbound interface and next hop.
Only the the S5720S-SI, S5720SI, S5720EI, S5720HI, S6720S-EI and S6720EI supports commands
with the vpn-instance vpn-instance-name parameter.
----End
Context
The default preference value of IPv6 static routes affects route selection. When an IPv6 static
route is configured without specifying a preference value, the default preference value is used.
Procedure
Step 1 Run:
system-view
Step 2 Run:
ipv6 route-static default-preference preference
After the default preference value is reconfigured, the new default preference value is valid
only for new IPv6 static routes.
----End
Procedure
l Run the display ipv6 routing-table command to check brief information about the IPv6
routing table.
l Run the display ipv6 routing-table verbose command to check detailed information
about the IPv6 routing table.
----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:
l Configure link layer protocol parameters and IP addresses for interfaces and ensure that
the link layer protocol of the interfaces is Up.
l Configure a BFD session. For details, see "BFD Configuration" in the
S1720&S2700&S5700&S6720 Series Ethernet Switches Configuration Guide -
Reliability
.
Procedure
Step 1 Run:
system-view
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 ]
NOTE
Only the S5720S-SI, S5720SI, S5720EI, S5720HI, S6720S-EI and S6720EI 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.
l Run the display bfd session { all | discriminator discr-value } [ verbose ] command to
check information about BFD sessions.
l Run the display current-configuration | include bfd command to check configurations
of BFD for IPv6 static routes.
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.
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
# Configure SwitchA. The configurations of SwitchB and SwitchC are similar to the
configuration of SwitchA.
[SwitchA] interface vlanif 10
[SwitchA-Vlanif10] ip address 10.1.4.1 30
[SwitchA-Vlanif10] quit
[SwitchA] interface vlanif 30
[SwitchA-Vlanif30] ip address 10.1.1.1 24
[SwitchA-Vlanif30] quit
Set the default gateway addresses of PC1, PC2, and PC3 to 10.1.1.1, 10.1.2.1, and 10.1.3.1
respectively.
Step 4 Configure IPv4 static routes.
# Configure a default IPv4 static route on SwitchA.
[SwitchA] ip route-static 0.0.0.0 0.0.0.0 10.1.4.2
----End
Configuration Files
l 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
l SwitchB configuration file
#
sysname SwitchB
#
vlan batch 10 20 40
#
interface Vlanif10
ip address 10.1.4.2 255.255.255.252
#
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
l 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
Networking requirements
Figure 3-7 shows an IPv6 network. 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.
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
l 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
#
sysname SwitchC
#
ipv6
#
vlan batch 40 50
#
interface Vlanif40
ipv6 enable
ipv6 address FC00:0:0:2020::2/64
#
interface Vlanif50
ipv6 enable
ipv6 address FC00:0:0:2003::1/64
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 40
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 50
#
ipv6 route-static :: 0 Vlanif40 FC00:0:0:2020::1
#
return
3.12.3 Example for Configuring Static BFD for IPv4 Static Routes
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.
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.
# 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
# Run the undo shutdown command on GE0/0/1 of SwitchB to simulate link recovery.
[SwitchB-GigabitEthernet0/0/1]undo shutdown
# 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
l 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
Relevant Information
Video
How to Configure a Static Route
How to Configure a Default Route
How to Configure a Floating Static Route
3.12.4 Example for Configuring Static BFD for IPv6 Static Routes
Networking Requirements
In Figure 3-9, SwitchA and SwitchB connect to each other and have IPv6 static routes
configured between them. It is required that a fault on the link between SwitchA and SwitchB
be detected within a few milliseconds, and that SwitchA and SwitchB dynamically update
their IPv6 routing tables.
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure a BFD session between SwitchA and SwitchB to complete fault detection
within a few milliseconds.
2. Configure a static route from SwitchA to SwitchB and bind the IPv6 static route to the
BFD session so that SwitchA and SwitchB can update their IPv6 routing tables after a
fault is detected.
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
l 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
l SwitchB configuration file
#
sysname SwitchB
#
ipv6
#
bfd
#
interface GigabitEthernet0/0/1
undo portswitch
ipv6 enable
ipv6 address FC00::2/64
#
bfd bb bind peer-ipv6 FC00::1
discriminator local 20
discriminator remote 10
commit
#
return
l A fault detection mechanism must be deployed for static routes so that link faults can be
detected rapidly for static routes and traffic can be switched from a faulty link to prevent
lengthy service interruptions.
l When the primary link SwitchBSwitchD is working properly, traffic must be
transmitted along the primary link.
l When the primary link becomes faulty, traffic must be switched to the backup link
SwitchCSwitchD.
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 may be
blocked. As a result, Layer 3 services on the network cannot run normally.
IP N e t w o r k
S w it c h A
V L A N IF 3 0 V L A N IF 4 0
G E 0 /0 /1 G E 0 /0 /2
V L A N IF 3 0 V L A N IF 4 0
S w it c h B G E 0 /0 /1 G E 0 /0 /1 S w it c h C
V L A N IF 1 0 V L A N IF 2 0
VL 0
G E 0 /0 /3 AN IF 6 /2 G E 0 /0 /3
G E IF 5 0 AN 0
0 /0 VL E0/
G
/2
V L A N IF 1 0 0 VL V L A N IF 2 0
G E 0 /0 /1 IF 6 /2 AN
G E 0 /0 /1
AN 0 G E IF 5 0
VL E 0/ ...... 0 /0
G /2
V L A N IF 7 0 GE V L A N IF 8 0
0/ 0 /3 G E 0 /0 /4
G E 0 /0 /4 0/
3 0/
S w it c h D GE S w it c h E
...... ......
VLANIF 30 192.168.3.1/24
SwitchA
VLANIF 40 192.168.4.1/24
VLANIF 30 192.168.3.2/24
VLANIF 10 192.168.1.1/24
VLANIF 40 192.168.4.2/24
VLANIF 20 192.168.2.1/24
VLANIF 60 192.168.6.2/24
VLANIF 70 192.168.7.1/24
VLANIF 20 192.168.2.2/24
VLANIF 80 192.168.8.1/24
Configuration Roadmap
1. Create an Internet Control Message Protocol (ICMP) NQA test instance to monitor the
status of the primary link.
Create an ICMP NQA test instance on the NQA client SwitchB to test whether the
primary link SwitchBSwitchD is running properly.
2. Configure static routes and associate the static routes with the NQA test instance.
Configure static routes on aggregation switches SwitchB and SwitchC, and associate the
static route configured on SwitchB with the ICMP NQA test instance. When the ICMP
NQA test instance detects a link fault, it instructs the routing management module to
delete the associated static route from the IPv4 routing table.
3. Configure a dynamic routing protocol (for example, OSPF).
Configure a dynamic routing protocol on aggregation switches SwitchA, SwitchB, and
SwitchC so that they can learn routes from each other.
4. Configure OSPF to import static routes, and set a higher cost for the static route used for
the backup link than that for the static route used for the primary link to implement link
backup.
Configure OSPF on aggregation switches SwitchB and SwitchC to import static routes,
and set a higher cost for the static route imported by SwitchC than for the static route
imported by SwitchB. This configuration allows SwitchA to preferentially select the link
SwitchBSwitchD with a lower cost.
Procedure
Step 1 Configure VLANs and add interfaces to the VLANs.
# Configure SwitchA. The configurations of SwitchB, SwitchC, SwitchD, and SwitchE are
similar to the configuration of SwitchA.
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan batch 30 40
[SwitchA] interface gigabitethernet 0/0/1
[SwitchA-GigabitEthernet0/0/1] port link-type trunk
[SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 30
[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 40
[SwitchA-GigabitEthernet0/0/2] quit
# Configure SwitchA. The configurations of SwitchB, SwitchC, SwitchD, and SwitchE are
similar to the configuration of SwitchA.
[SwitchA] interface vlanif 30
[SwitchA-Vlanif30] ip address 192.168.3.1 24
[SwitchA-Vlanif30] quit
[SwitchA] interface vlanif 40
[SwitchA-Vlanif40] ip address 192.168.4.1 24
[SwitchA-Vlanif40] quit
Step 3 Create an NQA test instance on SwitchB to test the link between SwitchB and SwitchD.
[SwitchB] nqa test-instance user test
[SwitchB-nqa-user-test] test-type icmp
[SwitchB-nqa-user-test] destination-address ipv4 192.168.1.2
[SwitchB-nqa-user-test] frequency 10
[SwitchB-nqa-user-test] probe-count 2
[SwitchB-nqa-user-test] interval seconds 5
[SwitchB-nqa-user-test] timeout 4
[SwitchB-nqa-user-test] start now
[SwitchB-nqa-user-test] quit
# Configure an IPv4 static route on SwitchB and associate it with the NQA test instance.
[SwitchB] ip route-static 192.168.7.0 255.255.255.0 Vlanif 10 192.168.1.2 track
nqa user test
Step 5 Configure a dynamic routing protocol on SwitchA, SwitchB, and SwitchC. OSPF is used in
this example.
# Configure OSPF on SwitchB to import a static route, and set the cost to 10 for the static
route.
[SwitchB] ospf 1
[SwitchB-ospf-1] import-route static cost 10
[SwitchB-ospf-1] quit
# Configure OSPF on SwitchC to import a static route, and set the cost to 20 for the static
route.
[SwitchC] ospf 1
[SwitchC-ospf-1] import-route static cost 20
[SwitchC-ospf-1] quit
After the configuration is complete, run the display current-configuration | include nqa
command in the system view on aggregation switch Switch B. The command output shows
that the IPv4 static route has been associated with the NQA test instance. Run the display nqa
results command. The command output shows that an NQA test instance has been created.
The command output shows "Lost packet ratio 0 %," indicating that the link is running
properly.
The command output shows that a route to 192.168.7.0/24 exists in the routing table. The
route's next-hop address is 192.168.3.2 and its cost is 10. Traffic is then preferentially
transmitted along the link SwitchB -> SwitchD.
# Shut down GigabitEthernet0/0/3 on SwitchB to simulate a link fault.
[SwitchB] interface GigabitEthernet0/0/3
[SwitchB-GigabitEthernet0/0/3] shutdown
[SwitchB-GigabitEthernet0/0/3] quit
The command output shows "Completion:failed" and "Lost packet ratio is 100 %," indicating
that the link is faulty.
# Check the IP routing table on SwitchB.
[SwitchB] display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 8 Routes : 8
The command output shows that the static route has been deleted.
# Check the IP routing table on SwitchA.
The static route has been associated with the NQA test instance on SwitchB. If NQA detects a
link fault, it rapidly notifies SwitchB that the associated static route becomes unavailable.
SwitchA then cannot learn the route to 192.168.7.0/24 from SwitchB. However, SwitchA can
learn the route to 192.168.7.0/24 from SwitchC. The route's next-hop address is 192.168.4.2,
and its cost is 20. Traffic has been switched to the link SwitchC -> SwitchD.
----End
Configuration Files
l SwitchA configuration file
#
sysname SwitchA
#
vlan batch 30 40
#
interface Vlanif30
ip address 192.168.3.1 255.255.255.0
#
interface Vlanif40
ip address 192.168.4.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 30
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 40
#
ospf 1 router-id 10.1.1.1
area 0.0.0.0
network 192.168.3.0 0.0.0.255
network 192.168.4.0 0.0.0.255
#
return
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 30
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 50
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10
#
ospf 1 router-id 10.2.2.2
import-route static cost 10
area 0.0.0.0
network 192.168.3.0 0.0.0.255
#
ip route-static 192.168.7.0 255.255.255.0 Vlanif10 192.168.1.2 track nqa user
test
#
nqa test-instance user test
test-type icmp
destination-address ipv4 192.168.1.2
frequency 10
interval seconds 5
timeout 4
probe-count 2
start now
#
return
#
sysname SwitchD
#
vlan batch 10 60 70
#
interface Vlanif10
ip address 192.168.1.2 255.255.255.0
#
interface Vlanif60
ip address 192.168.6.2 255.255.255.0
#
interface Vlanif70
ip address 192.168.7.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 60
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 70
#
return
Relevant Information
Video
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 undo efm enable command in the view of GigabitEthernet0/0/1 on SwitchB to
simulate a link fault.
[SwitchB] interface gigabitethernet 0/0/1
[SwitchB-GigabitEthernet0/0/1] undo efm enable
# 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.
# Run the efm enable command in the view of GigabitEthernet0/0/1 on SwitchB to simulate
link recovery.
[SwitchB-GigabitEthernet0/0/1]efm enable
# 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
l 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
How to Configure a Static Route
How to Configure a Default Route
How to Configure a Floating Static Route
3.13 References
None