Typical Static Route Configuration
Example for Configuring Static Routes for Interworking Between Different Network Segments
Static Route Overview
Static routes use less bandwidth than dynamic routes and do not use CPU resources for route calculation and update analysis. They are manually configured by administrators. If a network fault occurs or the topology changes, static routes must be manually reconfigured as they cannot be automatically updated. Static routes have five parameters: destination IP address, mask, outbound interface, next hop, and priority.
Static routes are generally suitable for simple networks. However, they can be used on complex networks to improve network performance and ensure bandwidth for important applications.
Configuration Notes
- Communication between two devices is bidirectional, so reachable routes must be available in both directions. To enable two devices to communicate through static routes, configure a static route on the local device and then configure a return route on the peer device.
- If an enterprise network has two egresses, two equal-cost static routes can be configured for load balancing. In this case, two non-equal-cost static routes can be configured for active/standby backup. When the active link is faulty, traffic is switched from the active link to the standby link.
- This example applies to all versions of all S series switches.
Networking Requirements
As shown in Figure 3-122, hosts on different network segments are connected using several switches. Every two hosts on different network segments can communicate with each other without using dynamic routing protocols.
Configuration Roadmap
The configuration roadmap is as follows:
- Create VLANs, add interfaces to the VLANs, and assign IPv4 addresses to VLANIF interfaces so that neighboring devices can communicate with each other.
- Configure the IPv4 default gateway on each host, and configure IPv4 static routes or default static routes on each Switch so that hosts on different network segments can communicate with each other.
Procedure
- Create VLANs and add interfaces to the VLANs.
# Configure SwitchA. The configurations of SwitchB and SwitchC are similar.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 10 30 [SwitchA] interface gigabitethernet 1/0/1 [SwitchA-GigabitEthernet1/0/1] port link-type trunk [SwitchA-GigabitEthernet1/0/1] port trunk allow-pass vlan 10 [SwitchA-GigabitEthernet1/0/1] quit [SwitchA] interface gigabitethernet 1/0/2 [SwitchA-GigabitEthernet1/0/2] port link-type access [SwitchA-GigabitEthernet1/0/2] port default vlan 30 [SwitchA-GigabitEthernet1/0/2] quit
- Assign IPv4 addresses to the VLANIF interfaces.
# Configure SwitchA. The configurations of SwitchB and SwitchC are similar.
[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
- Configure hosts.
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.
- Configure static routes.
# Configure a default IPv4 route on SwitchA.
[SwitchA] ip route-static 0.0.0.0 0.0.0.0 10.1.4.2
# Configure two IPv4 static routes on SwitchB.
[SwitchB] ip route-static 10.1.1.0 255.255.255.0 10.1.4.1 [SwitchB] ip route-static 10.1.3.0 255.255.255.0 10.1.4.6
# Configure a default IPv4 route on SwitchC.
[SwitchC] ip route-static 0.0.0.0 0.0.0.0 10.1.4.5
- Verify the configuration.
# Check the IP routing table on SwitchA.
[SwitchA] display ip routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 7 Routes : 7 Destination/Mask Proto Pre Cost Flags NextHop Interface 0.0.0.0/0 Static 60 0 RD 10.1.4.2 Vlanif10 10.1.1.0/24 Direct 0 0 D 10.1.1.1 Vlanif30 10.1.1.1/32 Direct 0 0 D 127.0.0.1 Vlanif30 10.1.4.0/30 Direct 0 0 D 10.1.4.1 Vlanif10 10.1.4.1/32 Direct 0 0 D 127.0.0.1 Vlanif10 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
# Run the ping command to verify the connectivity.
[SwitchA] ping 10.1.3.1 PING 10.1.3.1: 56 data bytes, press CTRL_C to break Reply from 10.1.3.1: bytes=56 Sequence=1 ttl=253 time=62 ms Reply from 10.1.3.1: bytes=56 Sequence=2 ttl=253 time=63 ms Reply from 10.1.3.1: bytes=56 Sequence=3 ttl=253 time=63 ms Reply from 10.1.3.1: bytes=56 Sequence=4 ttl=253 time=62 ms Reply from 10.1.3.1: bytes=56 Sequence=5 ttl=253 time=62 ms --- 10.1.3.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 62/62/63 ms
# Run the tracert command to verify the connectivity.
[SwitchA] tracert 10.1.3.1 traceroute to 10.1.3.1(10.1.3.1), max hops: 30 ,packet length: 40,press CTRL_C to break 1 10.1.4.2 31 ms 32 ms 31 ms 2 10.1.3.1 62 ms 63 ms 62 ms
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 GigabitEthernet1/0/1 port link-type trunk port trunk allow-pass vlan 10 # interface GigabitEthernet1/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
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 GigabitEthernet1/0/1 port link-type trunk port trunk allow-pass vlan 10 # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 20 # interface GigabitEthernet1/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 GigabitEthernet1/0/1 port link-type trunk port trunk allow-pass vlan 20 # interface GigabitEthernet1/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
Example for Configuring Static Routes for Load Balancing
Static Route Overview
Static routes use less bandwidth than dynamic routes and do not use CPU resources for route calculation and update analysis. They are manually configured by administrators. If a network fault occurs or the topology changes, static routes must be manually reconfigured as they cannot be automatically updated. Static routes have five parameters: destination IP address, mask, outbound interface, next hop, and priority.
Static routes are generally suitable for simple networks. However, they can be used on complex networks to improve network performance and ensure bandwidth for important applications.
Configuration Notes
- Communication between two devices is bidirectional, so reachable routes must be available in both directions. To enable two devices to communicate through static routes, configure a static route on the local device and then configure a return route on the peer device.
- If an enterprise network has two egresses, two equal-cost static routes can be configured for load balancing. In this case, two non-equal-cost static routes can be configured for active/standby backup. When the active link is faulty, traffic is switched from the active link to the standby link.
- This example applies to the following products:
- S3700-SI, S3700-EI, S3700-HI
- S5700-SI, S5700-EI, S5700-HI, S5710-EI, S5710-HI, S5720-SI, S5720S-SI, S5720I-SI, S5720-EI, S5720-HI, S5730-HI, S5730-SI, S5730S-EI, S5731-H, S5731-S, S5731S-S, S5731S-H, S5732-H, S5735-S, S5735S-S, S5735-S-I, S5735S-H, S5736-S
- S6700-EI, S6720-SI, S6720S-SI, S6720-EI, S6720S-EI, S6720-HI, S6730-H, S6730-S, S6730S-S, S6730S-H
- S7703, S7706, S7712, S7703 PoE, S7706 PoE, S9703, S9706, S9712
For the product models whose applicable versions are not listed above, see Table 3-1 in "Applicable Products and Versions" for details.
To view detailed information about software mappings, visit Info-Finder, select a product series or product model, and click Hardware Center.
Networking Requirements
On the network shown in Figure 3-123, PC1 and PC2 are connected through four switches. Data traffic can be transmitted from PC1 to PC2 through two links: PC1->SwitchA->SwitchB->SwitchC->PC2 and PC1->SwitchA->SwitchD->SwitchC->PC2. To improve link efficiency, users want to implement load balancing between the two links. That is, traffic from PC1 to PC2 is evenly balanced between the two links. When faults occur on one of the two links, traffic is automatically switched to the other link.
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.
Configuration Roadmap
The configuration roadmap is as follows:
- Create VLANs, add interfaces to the VLANs, and assign IP addresses to VLANIF interfaces.
- Configure static routes in two directions of data traffic.
- Configure IP address and default gateways for hosts.
Procedure
- Specify the VLANs to which interfaces belong.
# Configure SwitchA. The configurations of SwitchB, SwitchC, and SwitchD are similar.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 10 100 400 [SwitchA] interface gigabitethernet 1/0/1 [SwitchA-GigabitEthernet1/0/1] port link-type access [SwitchA-GigabitEthernet1/0/1] port default vlan 10 [SwitchA-GigabitEthernet1/0/1] quit [SwitchA] interface gigabitethernet 1/0/2 [SwitchA-GigabitEthernet1/0/2] port link-type trunk [SwitchA-GigabitEthernet1/0/2] port trunk allow-pass vlan 100 [SwitchA-GigabitEthernet1/0/2] quit [SwitchA] interface gigabitethernet 1/0/3 [SwitchA-GigabitEthernet1/0/3] port link-type trunk [SwitchA-GigabitEthernet1/0/3] port trunk allow-pass vlan 400 [SwitchA-GigabitEthernet1/0/3] quit
- Configure an IP address for each VLANIF interface.
# Configure SwitchA. The configurations of SwitchB, SwitchC, and SwitchD are similar.
[SwitchA] interface vlanif 10 [SwitchA-Vlanif10] ip address 10.1.1.1 24 [SwitchA-Vlanif10] quit [SwitchA] interface vlanif 100 [SwitchA-Vlanif100] ip address 192.168.12.1 24 [SwitchA-Vlanif100] quit [SwitchA] interface vlanif 400 [SwitchA-Vlanif400] ip address 192.168.14.1 24 [SwitchA-Vlanif400] quit
- Configure static routes from PC1 to PC2.
# On SwitchA, configure two equal-cost static routes. The next hop of one route points to SwitchB, and that of the other route points to SwitchD. This configuration can implement load balancing for traffic from PC1 to PC2.
[SwitchA] ip route-static 10.1.2.0 24 192.168.12.2 [SwitchA] ip route-static 10.1.2.0 24 192.168.14.2
# Configure SwitchB.
[SwitchB] ip route-static 10.1.2.0 24 192.168.23.2
# Configure SwitchD.
[SwitchD] ip route-static 10.1.2.0 24 192.168.34.1
- Configure static routes from PC2 to PC1.
# On SwitchC, configure two equal-cost static routes. The next hop of one route points to SwitchB, and that of the other route points to SwitchD. This configuration can implement load balancing for traffic from PC2 to PC1.
[SwitchC] ip route-static 10.1.1.0 24 192.168.23.1 [SwitchC] ip route-static 10.1.1.0 24 192.168.34.2
# Configure SwitchB.
[SwitchB] ip route-static 10.1.1.0 24 192.168.12.1
# Configure SwitchD.
[SwitchD] ip route-static 10.1.1.0 24 192.168.14.1
- Configure hosts.
Assign IP address 10.1.1.2/24 and default gateway IP address 10.1.1.1 to PC1; assign IP address 10.1.2.2/24 and default gateway IP address 10.1.2.1 to PC2.
- Verify the configuration.
# Check the IP routing table on SwitchA.
[SwitchA] display ip routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 9 Routes : 10 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.1.0/24 Direct 0 0 D 10.1.1.1 Vlanif10 10.1.1.1/32 Direct 0 0 D 127.0.0.1 Vlanif10 10.1.2.0/24 Static 60 0 RD 192.168.12.2 Vlanif100 Static 60 0 RD 192.168.14.2 Vlanif400 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.12.0/24 Direct 0 0 D 192.168.12.1 Vlanif100 192.168.12.1/32 Direct 0 0 D 127.0.0.1 Vlanif100 192.168.14.0/24 Direct 0 0 D 192.168.14.1 Vlanif400 192.168.14.1/32 Direct 0 0 D 127.0.0.1 Vlanif400
The IP routing table on SwitchA contains two equal-cost routes to network segment 10.1.2.0/24. In this situation, data traffic is evenly balanced between two different links, achieving load balancing.
Configuration Files
SwitchA configuration file
# sysname SwitchA # vlan batch 10 100 400 # interface Vlanif10 ip address 10.1.1.1 255.255.255.0 # interface Vlanif100 ip address 192.168.12.1 255.255.255.0 # interface Vlanif400 ip address 192.168.14.1 255.255.255.0 # interface GigabitEthernet1/0/1 port link-type access port default vlan 10 # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 100 # interface GigabitEthernet1/0/3 port link-type trunk port trunk allow-pass vlan 400 # ip route-static 10.1.2.0 255.255.255.0 192.168.12.2 ip route-static 10.1.2.0 255.255.255.0 192.168.14.2 # return
SwitchB configuration file
# sysname SwitchB # vlan batch 100 200 # interface Vlanif100 ip address 192.168.12.2 255.255.255.0 # interface Vlanif200 ip address 192.168.23.1 255.255.255.0 # interface GigabitEthernet1/0/1 port link-type trunk port trunk allow-pass vlan 100 # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 200 # ip route-static 10.1.1.0 255.255.255.0 192.168.12.1 ip route-static 10.1.2.0 255.255.255.0 192.168.23.2 # return
SwitchC configuration file
# sysname SwitchC # vlan batch 20 200 300 # interface Vlanif20 ip address 10.1.2.1 255.255.255.0 # interface Vlanif200 ip address 192.168.23.2 255.255.255.0 # interface Vlanif300 ip address 192.168.34.1 255.255.255.0 # interface GigabitEthernet1/0/1 port link-type access port default vlan 20 # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 200 # interface GigabitEthernet1/0/3 port link-type trunk port trunk allow-pass vlan 300 # ip route-static 10.1.1.0 255.255.255.0 192.168.23.1 ip route-static 10.1.1.0 255.255.255.0 192.168.34.2 # return
SwitchD configuration file
# sysname SwitchD # vlan batch 300 400 # interface Vlanif300 ip address 192.168.34.2 255.255.255.0 # interface Vlanif400 ip address 192.168.14.2 255.255.255.0 # interface GigabitEthernet1/0/1 port link-type trunk port trunk allow-pass vlan 400 # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 300 # ip route-static 10.1.1.0 255.255.255.0 192.168.14.1 ip route-static 10.1.2.0 255.255.255.0 192.168.34.1 # return
Example for Configuring Static Routes for Link Backup
Static Route Overview
Static routes use less bandwidth than dynamic routes and do not use CPU resources for route calculation and update analysis. They are manually configured by administrators. If a network fault occurs or the topology changes, static routes must be manually reconfigured as they cannot be automatically updated. Static routes have five parameters: destination IP address, mask, outbound interface, next hop, and priority.
Static routes are generally suitable for simple networks. However, they can be used on complex networks to improve network performance and ensure bandwidth for important applications.
Configuration Notes
- Communication between two devices is bidirectional, so reachable routes must be available in both directions. To enable two devices to communicate through static routes, configure a static route on the local device and then configure a return route on the peer device.
- If an enterprise network has two egresses, two equal-cost static routes can be configured for load balancing. In this case, two non-equal-cost static routes can be configured for active/standby backup. When the active link is faulty, traffic is switched from the active link to the standby link.
- This example applies to all versions of all S series switches.
Networking Requirements
On the network shown in Figure 3-124, PC1 and PC2 are connected through four switches. Data traffic of PC1 can reach PC2 through two links: PC1->SwitchA->SwitchB->SwitchC->PC2 and PC1->SwitchA->SwitchD->SwitchC->PC2. To improve reliability, users want to implement backup between the two links. That is, traffic from PC1 to PC2 is first transmitted through the link that passes through SwitchB. When faults occur on this link, traffic is automatically switched to the link that passes through SwitchD.
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.
Configuration Roadmap
The configuration roadmap is as follows:
- Create VLANs, add interfaces to the VLANs, and assign IP addresses to VLANIF interfaces.
- Configure static routes in two directions of data traffic.
- Configure IP address and default gateways for hosts.
Procedure
- Specify the VLANs to which interfaces belong.
# Configure SwitchA. The configurations of SwitchB, SwitchC, and SwitchD are similar.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 10 100 400 [SwitchA] interface gigabitethernet 1/0/1 [SwitchA-GigabitEthernet1/0/1] port link-type access [SwitchA-GigabitEthernet1/0/1] port default vlan 10 [SwitchA-GigabitEthernet1/0/1] quit [SwitchA] interface gigabitethernet 1/0/2 [SwitchA-GigabitEthernet1/0/2] port link-type trunk [SwitchA-GigabitEthernet1/0/2] port trunk allow-pass vlan 100 [SwitchA-GigabitEthernet1/0/2] quit [SwitchA] interface gigabitethernet 1/0/3 [SwitchA-GigabitEthernet1/0/3] port link-type trunk [SwitchA-GigabitEthernet1/0/3] port trunk allow-pass vlan 400 [SwitchA-GigabitEthernet1/0/3] quit
- Configure an IP address for each VLANIF interface.
# Configure SwitchA. The configurations of SwitchB, SwitchC, and SwitchD are similar.
[SwitchA] interface vlanif 10 [SwitchA-Vlanif10] ip address 10.1.1.1 24 [SwitchA-Vlanif10] quit [SwitchA] interface vlanif 100 [SwitchA-Vlanif100] ip address 192.168.12.1 24 [SwitchA-Vlanif100] quit [SwitchA] interface vlanif 400 [SwitchA-Vlanif400] ip address 192.168.14.1 24 [SwitchA-Vlanif400] quit
- Configure static routes from PC1 to PC2.
# On SwitchA, configure two static routes with different priorities. The next hop of one route points to SwitchB, and that of the other route points to SwitchD. Subsequently, data traffic is first forwarded to SwitchB. When faults occur on the link that passes through SwitchB, the traffic is automatically switched to SwitchD.
[SwitchA] ip route-static 10.1.2.0 24 192.168.12.2 [SwitchA] ip route-static 10.1.2.0 24 192.168.14.2 preference 70
# Configure SwitchB.
[SwitchB] ip route-static 10.1.2.0 24 192.168.23.2
# Configure SwitchD.
[SwitchD] ip route-static 10.1.2.0 24 192.168.34.1
- Configure static routes from PC2 to PC1 and ensure that
the active and standby links in two directions are the same.
# On SwitchC, configure two static routes with different priorities. The next hop of one route points to SwitchB, and that of the other route points to SwitchD. Subsequently, data traffic is first forwarded to SwitchB. When faults occur on the link that passes through SwitchB, traffic is automatically switched to SwitchD.
[SwitchC] ip route-static 10.1.1.0 24 192.168.23.1 [SwitchC] ip route-static 10.1.1.0 24 192.168.34.2 preference 70
# Configure SwitchB.
[SwitchB] ip route-static 10.1.1.0 24 192.168.12.1
# Configure SwitchD.
[SwitchD] ip route-static 10.1.1.0 24 192.168.14.1
- Configure hosts.
Assign IP address 10.1.1.2/24 and default gateway IP address 10.1.1.1 to PC1; assign IP address 10.1.2.2/24 and default gateway IP address 10.1.2.1 to PC2.
- Verify the configuration.
# Check the IP routing table on SwitchA.
[SwitchA] display ip routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 9 Routes : 9 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.1.0/24 Direct 0 0 D 10.1.1.1 Vlanif10 10.1.1.1/32 Direct 0 0 D 127.0.0.1 Vlanif10 10.1.2.0/24 Static 60 0 RD 192.168.12.2 Vlanif100 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.12.0/24 Direct 0 0 D 192.168.12.1 Vlanif100 192.168.12.1/32 Direct 0 0 D 127.0.0.1 Vlanif100 192.168.14.0/24 Direct 0 0 D 192.168.14.1 Vlanif400 192.168.14.1/32 Direct 0 0 D 127.0.0.1 Vlanif400
# Check detailed information about the IP routing table on SwitchA.
[SwitchA] display ip routing-table 10.1.2.0 24 verbose Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Routing Table : Public Summary Count : 2 Destination: 10.1.2.0/24 Protocol: Static Process ID: 0 Preference: 60 Cost: 0 NextHop: 192.168.12.2 Neighbour: 0.0.0.0 State: Active Adv Relied Age: 00h13m13s Tag: 0 Priority: medium Label: NULL QoSInfo: 0x0 IndirectID: 0x80000001 RelayNextHop: 0.0.0.0 Interface: Vlanif100 TunnelID: 0x0 Flags: RD Destination: 10.1.2.0/24 Protocol: Static Process ID: 0 Preference: 70 Cost: 0 NextHop: 192.168.14.2 Neighbour: 0.0.0.0 State: Inactive Adv Relied Age: 00h00m45s Tag: 0 Priority: medium Label: NULL QoSInfo: 0x0 IndirectID: 0x80000002 RelayNextHop: 0.0.0.0 Interface: Vlanif400 TunnelID: 0x0 Flags: R
The IP routing table on SwitchA contains only one active route to network segment 10.1.2.0/24. Normally, data traffic from PC1 to PC2 is transmitted through the link that passes through SwitchB. Detailed information about the IP routing table on SwitchA shows two routes to network segment 10.1.2.0/24: one Active route that passes through SwitchB and the other Inactive route that passes through SwitchD. When faults occur on the active link, the Inactive route will become active to take over the traffic. This implements link backup.
Configuration Files
SwitchA configuration file
# sysname SwitchA # vlan batch 10 100 400 # interface Vlanif10 ip address 10.1.1.1 255.255.255.0 # interface Vlanif100 ip address 192.168.12.1 255.255.255.0 # interface Vlanif400 ip address 192.168.14.1 255.255.255.0 # interface GigabitEthernet1/0/1 port link-type access port default vlan 10 # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 100 # interface GigabitEthernet1/0/3 port link-type trunk port trunk allow-pass vlan 400 # ip route-static 10.1.2.0 255.255.255.0 192.168.12.2 ip route-static 10.1.2.0 255.255.255.0 192.168.14.2 preference 70 # return
SwitchB configuration file
# sysname SwitchB # vlan batch 100 200 # interface Vlanif100 ip address 192.168.12.2 255.255.255.0 # interface Vlanif200 ip address 192.168.23.1 255.255.255.0 # interface GigabitEthernet1/0/1 port link-type trunk port trunk allow-pass vlan 100 # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 200 # ip route-static 10.1.1.0 255.255.255.0 192.168.12.1 ip route-static 10.1.2.0 255.255.255.0 192.168.23.2 # return
SwitchC configuration file
# sysname SwitchC # vlan batch 20 200 300 # interface Vlanif20 ip address 10.1.2.1 255.255.255.0 # interface Vlanif200 ip address 192.168.23.2 255.255.255.0 # interface Vlanif300 ip address 192.168.34.1 255.255.255.0 # interface GigabitEthernet1/0/1 port link-type access port default vlan 20 # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 200 # interface GigabitEthernet1/0/3 port link-type trunk port trunk allow-pass vlan 300 # ip route-static 10.1.1.0 255.255.255.0 192.168.23.1 ip route-static 10.1.1.0 255.255.255.0 192.168.34.2 preference 70 # return
SwitchD configuration file
# sysname SwitchD # vlan batch 300 400 # interface Vlanif300 ip address 192.168.34.2 255.255.255.0 # interface Vlanif400 ip address 192.168.14.2 255.255.255.0 # interface GigabitEthernet1/0/1 port link-type trunk port trunk allow-pass vlan 400 # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 300 # ip route-static 10.1.1.0 255.255.255.0 192.168.14.1 ip route-static 10.1.2.0 255.255.255.0 192.168.34.1 # return
Example for Configuring NQA for IPv4 Static Routes
Overview of NQA for IPv4 Static Routes
The network quality analysis (NQA) technology measures network performance and collects statistics on the delay, jitter, and packet loss ratio. NQA can measure real-time network QoS, and perform effective network fault diagnosis and location.
On a simple network or on a network where the route to the destination cannot be established using dynamic routing protocols, static routes can be configured. Unlike dynamic routing protocols, static routes do not have a dedicated detection mechanism. If a fault occurs, static routes cannot detect the fault, and the network administrator must delete the corresponding static route. This delays the link switchover and may cause lengthy service interruptions.
BFD for IPv4 static routes is adaptable to link changes but both ends of the link must support BFD. If either end of a link does not support BFD, NQA for IPv4 static routes can be configured. When an NQA test instance detects a link fault, it instructs the routing management module to delete the associated static route from the IP routing table. Then service traffic switches to a route without any link fault to prevent lengthy service interruptions.
Configuration Notes
- The NQA function of the switch is license controlled. If the license is unavailable, NQA commands can be run, but the NQA function does not take effect.
- Applicable products and versions: V200R003C00 and later versions
Networking Requirements
As shown in Figure 3-125, SwitchA on a company network is connected to two egress routers (RouterA and RouterB) through two default static routes to implement load balancing. The company wants to deploy a link failure detection mechanism for the default static routes, so that traffic can be switched from a faulty link to the other functioning link promptly to prevent services from being interrupted.
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.
Configuration Roadmap
- Create VLANs, add interfaces to the VLANs, and configure IP addresses for VLANIF interfaces, so that neighboring devices can communicate with each other.
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.
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
- On SwitchA, create VLANs and add interfaces to them.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 100 200 300 [SwitchA] interface gigabitethernet 1/0/1 [SwitchA-GigabitEthernet1/0/1] port link-type trunk [SwitchA-GigabitEthernet1/0/1] port trunk allow-pass vlan 100 [SwitchA-GigabitEthernet1/0/1] quit [SwitchA] interface gigabitethernet 1/0/2 [SwitchA-GigabitEthernet1/0/2] port link-type trunk [SwitchA-GigabitEthernet1/0/2] port trunk allow-pass vlan 200 [SwitchA-GigabitEthernet1/0/2] quit [SwitchA] interface gigabitethernet 1/0/3 [SwitchA-GigabitEthernet1/0/3] port link-type trunk [SwitchA-GigabitEthernet1/0/3] port trunk allow-pass vlan 300 [SwitchA-GigabitEthernet1/0/3] quit
- On SwitchA, configure an IP address for each VLANIF interface.
[SwitchA] interface vlanif 100 [SwitchA-Vlanif100] ip address 10.1.10.2 24 [SwitchA-Vlanif100] quit [SwitchA] interface vlanif 200 [SwitchA-Vlanif200] ip address 10.1.20.2 24 [SwitchA-Vlanif200] quit [SwitchA] interface vlanif 300 [SwitchA-Vlanif300] ip address 10.1.30.2 24 [SwitchA-Vlanif300] quit
- On SwitchA, configure NQA test instances.
[SwitchA] nqa test-instance user test1 [SwitchA-nqa-user-test1] test-type icmp [SwitchA-nqa-user-test1] destination-address ipv4 10.1.10.1 [SwitchA-nqa-user-test1] frequency 11 [SwitchA-nqa-user-test1] probe-count 2 [SwitchA-nqa-user-test1] interval seconds 5 [SwitchA-nqa-user-test1] timeout 4 [SwitchA-nqa-user-test1] start now [SwitchA-nqa-user-test1] quit [SwitchA] nqa test-instance user test2 [SwitchA-nqa-user-test2] test-type icmp [SwitchA-nqa-user-test2] destination-address ipv4 10.1.20.1 [SwitchA-nqa-user-test2] frequency 11 [SwitchA-nqa-user-test2] probe-count 2 [SwitchA-nqa-user-test2] interval seconds 5 [SwitchA-nqa-user-test2] timeout 4 [SwitchA-nqa-user-test2] start now [SwitchA-nqa-user-test2] quit
- 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
- Verify the configuration.
# Check the configuration of NQA for default static routes. The command output shows that the default static routes have been bound to NQA test instances.
[SwitchA] display current-configuration | include nqa 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 nqa test-instance user test2
# Check NQA test results.
[SwitchA] display nqa results test-instance user test1 NQA entry(user, test1) :testflag is active ,testtype is icmp 1 . Test 10 result The test is finished Send operation times: 2 Receive response times: 2 Completion:success RTD OverThresholds number: 0 Attempts number:1 Drop operation number:0 Disconnect operation number:0 Operation timeout number:0 System busy operation number:0 Connection fail number:0 Operation sequence errors number:0 RTT Status errors number:0 Destination ip address:10.1.10.1 Min/Max/Average Completion Time: 30/30/30 Sum/Square-Sum Completion Time: 7/25 Last Good Probe Time: 2014-09-09 09:55:38.2 Lost packet ratio: 0 %
[SwitchA] display nqa results test-instance user test2 NQA entry(user, test2) :testflag is active ,testtype is icmp 1 . Test 11 result The test is finished Send operation times: 2 Receive response times: 2 Completion:success RTD OverThresholds number: 0 Attempts number:1 Drop operation number:0 Disconnect operation number:0 Operation timeout number:0 System busy operation number:0 Connection fail number:0 Operation sequence errors number:0 RTT Status errors number:0 Destination ip address:10.1.20.1 Min/Max/Average Completion Time: 30/30/30 Sum/Square-Sum Completion Time: 7/25 Last Good Probe Time: 2014-09-09 09:56:38.2 Lost packet ratio: 0 %
Completion:success and Lost packet ratio: 0 % in the command output show that the links between SwitchA and RouterA and between SwitchA and RouterB are normal.
# Check the routing table. The command output shows that there are two default static routes destined for RouterA and RouterB, respectively.
[SwitchA] display ip routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 9 Routes : 10 Destination/Mask Proto Pre Cost Flags NextHop Interface 0.0.0.0/0 Static 60 0 RD 10.1.10.1 Vlanif100 Static 60 0 RD 10.1.20.1 Vlanif200 10.1.10.0/24 Direct 0 0 D 10.1.10.2 Vlanif100 10.1.10.2/32 Direct 0 0 D 127.0.0.1 Vlanif100 10.1.20.0/24 Direct 0 0 D 10.1.20.2 Vlanif200 10.1.20.2/32 Direct 0 0 D 127.0.0.1 Vlanif200 10.1.30.0/24 Direct 0 0 D 10.1.30.2 Vlanif300 10.1.30.2/32 Direct 0 0 D 127.0.0.1 Vlanif300 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
# Shut down GigabitEthernet1/0/2 on SwitchA to simulate a link fault.
[SwitchA] interface gigabitethernet 1/0/2 [SwitchA-GigabitEthernet1/0/2] shutdown [SwitchA-GigabitEthernet1/0/2] quit
# Check NQA test results.
[SwitchA] display nqa results test-instance user test1 NQA entry(user, test1) :testflag is active ,testtype is icmp 1 . Test 12 result The test is finished Send operation times: 2 Receive response times: 2 Completion:success RTD OverThresholds number: 0 Attempts number:1 Drop operation number:0 Disconnect operation number:0 Operation timeout number:0 System busy operation number:0 Connection fail number:0 Operation sequence errors number:0 RTT Status errors number:0 Destination ip address:10.1.10.1 Min/Max/Average Completion Time: 30/30/30 Sum/Square-Sum Completion Time: 7/25 Last Good Probe Time: 2014-09-09 09:57:38.2 Lost packet ratio: 0 %
[SwitchA] display nqa results test-instance user test2 NQA entry(user, test2) :testflag is active ,testtype is icmp 1 . Test 13 result The test is finished Send operation times: 2 Receive response times: 0 Completion:failed RTD OverThresholds number: 0 Attempts number:1 Drop operation number:0 Disconnect operation number:0 Operation timeout number:2 System busy operation number:0 Connection fail number:0 Operation sequence errors number:0 RTT Status errors number:0 Destination ip address:10.1.20.1 Min/Max/Average Completion Time: 0/0/0 Sum/Square-Sum Completion Time: 0/0 Last Good Probe Time: 2014-09-09 09:58:38.2 Lost packet ratio: 100 %
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, T - to vpn-instance ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 7 Routes : 7 Destination/Mask Proto Pre Cost Flags NextHop Interface 0.0.0.0/0 Static 60 0 RD 10.1.10.1 Vlanif100 10.1.10.0/24 Direct 0 0 D 10.1.10.2 Vlanif100 10.1.10.2/32 Direct 0 0 D 127.0.0.1 Vlanif100 10.1.30.0/24 Direct 0 0 D 10.1.30.2 Vlanif300 10.1.30.2/32 Direct 0 0 D 127.0.0.1 Vlanif300 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
Configuration Files
# 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 GigabitEthernet1/0/1 port link-type trunk port trunk allow-pass vlan 100 # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 200 # interface GigabitEthernet1/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 now # return
Example for Configuring EFM for IPv4 Static Routes
Overview of EFM for IPv4 Static Routes
Ethernet in the first mile (EFM) defines the specifications of the Ethernet physical layer for user access and implements Ethernet management and maintenance. EFM provides link-level operation and management (OAM), for example, link connectivity detection, link fault monitoring, remote fault notification, and remote loopback functions on a link between two directly-connected devices.
Static routes are easy to configure and therefore widely used on networks with simple structures. Unlike dynamic routing protocols, static routes do not have a dedicated detection mechanism. If a fault occurs, static routes cannot detect the fault, and the network administrator must delete the corresponding static route. This delays the link switchover and may cause lengthy service interruptions. IP networks are being used more often to carry multiple services such as voice and video services. These services pose high requirements on network reliability, and fast fault detection and processing. EFM for IPv4 static routes can be configured to provide the detection mechanism for static routes so that they can detect the link quality changes in real time and switch services immediately.
Configuration Notes
- By default, EFM is disabled globally and on interfaces.
- After EFM OAM is enabled on an interface, the interface starts to send OAM PDUs to perform the point-to-point EFM link detection. EFM link detection can be implemented between two interfaces only after EFM OAM is enabled on the peer interface.
- Applicable products and versions: switches of all models.
Networking Requirements
As shown in Figure 3-126, SwitchA connects to the NMS across a network segment through SwitchB. SwitchA and SwitchB need to detect the link quality in real time. When the link between them becomes faulty, the corresponding static route is deleted from the IP routing table. Then traffic switches from the faulty link to a normal route to improve network reliability.
Configuration Roadmap
The configuration roadmap is as follows:
Enable EFM OAM globally and on interfaces of SwitchA and SwitchB to implement real-time link quality detection.
Configure a static route from SwitchA to the NMS and bind it to the EFM state to associate the static route with EFM. When a link where the static route resides becomes faulty, traffic switches to a route without link faults.
Procedure
- Specify the VLAN to which the interfaces belong.
# Configure SwitchA. The configuration of SwitchB is similar.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan 10 [SwitchA-vlan10] quit [SwitchA] interface gigabitethernet 1/0/1 [SwitchA-GigabitEthernet1/0/1] port link-type trunk [SwitchA-GigabitEthernet1/0/1] port trunk allow-pass vlan 10 [SwitchA-GigabitEthernet1/0/1] quit
- Configure an IP address for each VLANIF interface.
# Configure SwitchA. The configuration of SwitchB is similar.
[SwitchA] interface vlanif 10 [SwitchA-Vlanif10] ip address 192.168.1.1 24 [SwitchA-Vlanif10] quit
- Configure an EFM session between SwitchA and SwitchB.
# Enable EFM OAM on SwitchA.
[SwitchA] efm enable //Enable EFM globally. [SwitchA] interface gigabitethernet 1/0/1 [SwitchA-GigabitEthernet1/0/1] efm enable //Enable EFM on an interface. [SwitchA-GigabitEthernet1/0/1] quit
# Enable EFM OAM on SwitchB.
[SwitchB] efm enable //Enable EFM globally. [SwitchB] interface gigabitethernet 1/0/1 [SwitchB-GigabitEthernet1/0/1] efm enable //Enable EFM on an interface. [SwitchB-GigabitEthernet1/0/1] quit
- Configure a static route and bind it to the EFM state.
# Configure a static route from SwitchA to the external network and bind it to the EFM state of GigabitEthernet1/0/1.
[SwitchA] ip route-static 192.168.2.0 24 192.168.1.2 track efm-state gigabitethernet1/0/1
- Verify the configuration.
# After the configuration is complete, run the display efm session all command on SwitchA and SwitchB. The command output shows that an EFM session has been set up and in detect mode. That is, the interface is in handshake state. The following uses the display on SwitchA as an example.
[SwitchA] display efm session all Interface EFM State Loopback Timeout ---------------------------------------------------------------------- GigabitEthernet1/0/1 detect --
# Check the IP routing table on SwitchA. The IP routing table contains the static route.
[SwitchA] display ip routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 5 Routes : 5 Destination/Mask Proto Pre Cost Flags NextHop Interface 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.1.0/24 Direct 0 0 D 192.168.1.1 Vlanif10 192.168.1.1/32 Direct 0 0 D 127.0.0.1 Vlanif10 192.168.2.0/24 Static 60 0 RD 192.168.1.2 Vlanif10
# Run the undo efm enable command in the view of GigabitEthernet1/0/1 on SwitchB to simulate a link fault.
[SwitchB] interface gigabitethernet 1/0/1 [SwitchB-GigabitEthernet1/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 ---------------------------------------------------------------------- GigabitEthernet1/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 is bound to the EFM state. After EFM OAM detects a link fault, it rapidly notifies SwitchA that the static route is unavailable.
[SwitchA] display ip routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 4 Routes : 4 Destination/Mask Proto Pre Cost Flags NextHop Interface 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.1.0/24 Direct 0 0 D 192.168.1.1 Vlanif10 192.168.1.1/32 Direct 0 0 D 127.0.0.1 Vlanif10
# Run the efm enable command in the view of GigabitEthernet1/0/1 on SwitchB to simulate link recovery.
[SwitchB-GigabitEthernet1/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 ---------------------------------------------------------------------- GigabitEthernet1/0/1 detect --
# Check the IP routing table on SwitchA. The IP routing table contains the static route 192.168.2.0/24 again. After EFM OAM detects that the link recovers from a fault, it rapidly notifies that the bound static route is valid again.
[SwitchA] display ip routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 5 Routes : 5 Destination/Mask Proto Pre Cost Flags NextHop Interface 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.1.0/24 Direct 0 0 D 192.168.1.1 Vlanif10 192.168.1.1/32 Direct 0 0 D 127.0.0.1 Vlanif10 192.168.2.0/24 Static 60 0 RD 192.168.1.2 Vlanif10
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 GigabitEthernet1/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 GigabitEthernet1/0/1 # return
SwitchB configuration file
# sysname SwitchB # vlan batch 10 20 # efm enable # interface Vlanif10 ip address 192.168.1.2 255.255.255.0 # interface Vlanif20 ip address 192.168.2.2 255.255.255.0 # interface GigabitEthernet1/0/1 port link-type trunk port trunk allow-pass vlan 10 efm enable # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 20 # return