====== HP 5830 Switch Series - Configuring Static Routing ====== ===== 1. Static route configuration items ===== Before configuring a static route, understand the following concepts: **Destination address and mask:** In the ip route-static command, an IPv4 address is in dotted decimal format and a mask can be either in dotted decimal format or in the form of mask length (the number of consecutive 1s in the mask). **Output interface and next hop address:** When configuring a static route, specify either the output interface or the next hop address, or both depending on the specific occasion. The next hop address cannot be a local interface IP address or the route configuration does not take effect. In fact, each route lookup operation has to find the next hop to resolve the destination link layer address. When specifying the output interface: * If the output interface is a Null 0 interface, there is no need to configure the next hop address. * If the user specifies a broadcast interface (such as VLAN interface) as the output interface, the user must specify the corresponding next hop for the output interface. **Other attributes:** The user can configure different priorities for different static routes so that route management policies can be more flexible. For example, specifying the same priority for different routes to the same destination enables load sharing, but specifying different priorities for these routes enables route backup. ===== 2. Configuring a static route ===== **Prerequisites:** Before configuring a static route, complete the following tasks: * Configure the physical parameters for related interfaces * Configure the link-layer attributes for related interfaces * Configure the IP addresses for related interfaces **Procedure:** When configuring a static route, the static route does not take effect if the user specifies the next hop address first and then configure it as the IP address of a local interface, such as VLAN interface. If the user does not specify the preference when configuring a static route, the default preference will be used. Reconfiguring the default preference applies only to newly created static routes. * Enter system view. system-view * Ordered List ItemConfigure a static route. ip route-static dest-address { mask | mask- length } { next-hop-address [ track track- entry-number ] | interface-type interface- number [ next-hop-address ] } [ preference preference-value ] [ tag tag-value ] [ permanent ] [ description description-text ] * Configure the default preference for static routes. ip route-static default-preference default- preference-value The user can flexibly control static routes by configuring tag values and using the tag values in the routing policy. If the destination IP address and mask are both configured as 0.0.0.0 with the ip route-static command, the route is the default route. ===== 3. Configuring BFD for static routes ===== BFD provides a general-purpose, standard, medium-, and protocol-independent fast failure detection mechanism. It can uniformly and quickly detect the failures of the bidirectional forwarding paths between two routers for protocols, such as routing protocols and MPLS. A dynamic routing protocol notifies BFD of its neighbor information. BFD uses such information to establish sessions with neighbors by sending BFD control packets. Static routing, which has no neighbor discovery mechanism, implements BFD. **BFD control packet mode:** To use BFD control packets for bidirectional detection between two devices, the user needs to enable BFD control packet mode for each device static route destined to the peer. For direct session: * Ordered List ItemEnter system view. system-view * Unordered List ItemOrdered List ItemConfigure a static route and enable BFD control packet mode for it. ip route-static dest-address { mask | mask-length } interface- type interface-number next-hop-address bfd control-packet [ preference preference-value ] [ tag tag-value ] [ description description-text ] For indirect session: * Ordered List ItemEnter system view. system-view * Unordered List ItemOrdered List ItemConfigure a static route and enable BFD control packet mode for the route. ip route-static dest-address { mask | mask-length } next-hop- address bfd control-packet bfd-source ip-address [ preference preference-value ] [ tag tag-value ] [ description description- text ] **BFD echo packet mode:** With BFD echo packet mode enabled for a static route, the local device sends BFD echo packets to the peer, which loops them back to test the link. If route flaps occur, enabling BFD could worsen them. Enable BFD with care in such cases. The source address of echo packets must be configured if the BFD session operates in the echo mode. If the user configures BFD for a static route, he needs to specify the outbound interface and next hop IP address for the route. BFD cannot be used for a static route with the outbound interface having the spoofing attribute. BFD can be used for static routes with direct nexthops rather than non-direct nexthops. * Enter system view. system-view * Configure the source address of echo packets. bfd echo-source-ip ip-address * Enable BFD echo packet mode for static routes. ip route-static dest-address { mask | mask-length } interface- type interface-number next-hop-address bfd echo-packet [ preference preference-value ] [ tag tag-value ] [ description description-text ] BFD echo function is revised to specify that a BFD session is established at only one end when the echo mode is used. ===== 4. Configuring static route FRR ===== When the link in the network fails, the packets on the path may be discarded, or a routing loop may occur. Then, the traffic will be interrupted. To avoid such issues, the user can enable static FRR. **Figure 1: Network diagram for static route FRR** {{:hpe:switch:5800:c03128052.jpg.jpg?400|}} As shown in Figure 1, FRR can designate a backup next hop by using a routing policy for routes matching the specified criteria when a network failure is detected so that packets can be directed to the backup next hop for forwarding. This prevents traffic interruption. **Prerequisites:** Configuring static route FRR needs to reference a routing policy. The user can specify a backup next hop in a routing policy by using the apply fast-reroute backup-interface command. **Procedure:** Static route FRR takes effect only for static routes that have both the outbound interface and next hop specified. Do not use static route FRR and BFD (for static route) at the same time. * Enter system view. system-view * Configure the source address of echo packets. bfd echo-source-ip ip-address * Configure static route FRR. ip route-static fast-reroute route- policy route-policy-name ===== 5. Displaying and maintaining static routes ===== The VPN instance support in delete [ vpn-instance vpn-instance-name ] static-routes all depends on the device model. * Display information of static routes. display ip routing-table protocol static [ inactive | verbose ] [ | { begin | exclude | include } regular- expression ] * Delete all the static routes. delete static-routes all ===== 6. Static route configuration examples ===== **Basic static route configuration example:** **Network requirements:** The IP addresses and masks of the switches and hosts are shown in Figure 2. Static routes are required for interconnection between any two hosts. **Figure 2:** Network diagram for static route configuration {{:hpe:switch:5800:c03128053.jpg.jpg?400|}} **Procedure:** * Configure IP addresses for interfaces (omitted). * Configure static routes: **Configure a default route on Switch A:** system-view [SwitchA] ip route-static 0.0.0.0 0.0.0.0 1.1.4.2 **Configure two static routes on Switch B:** system-view [SwitchB] ip route-static 1.1.2.0 255.255.255.0 1.1.4.1 [SwitchB] ip route-static 1.1.3.0 255.255.255.0 1.1.5.6 **Configure a default route on Switch C:** system-view [SwitchC] ip route-static 0.0.0.0 0.0.0.0 1.1.5.5 **Configure the hosts:** **The default gateways for hosts A, B and C are 1.1.2.3, 1.1.6.1 and 1.1.3.1, respectively. The configuration procedure is omitted.** **Display the configuration:** **Display the IP routing table of Switch A:** [SwitchA] display ip routing-table Routing Tables: Public Destinations : 7 Routes : 7 Destination/Mask Proto Pre Cost NextHop Interface 0.0.0.0/0 Static 60 0 1.1.4.2 Vlan500 1.1.2.0/24 Direct 0 0 1.1.2.3 Vlan300 1.1.2.3/32 Direct 0 0 127.0.0.1 InLoop0 1.1.4.0/30 Direct 0 0 1.1.4.1 Vlan500 1.1.4.1/32 Direct 0 0 127.0.0.1 InLoop0 127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0 127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0 **Display the IP routing table of Switch B:** [SwitchB] display ip routing-table Routing Tables: Public Destinations : 10 Routes : 10 Destination/Mask Proto Pre Cost NextHop Interface 1.1.2.0/24 Static 60 0 1.1.4.1 Vlan500 1.1.3.0/24 Static 60 0 1.1.5.6 Vlan600 1.1.4.0/30 Direct 0 0 1.1.4.2 Vlan500 1.1.4.2/32 Direct 0 0 127.0.0.1 InLoop0 1.1.5.4/30 Direct 0 0 1.1.5.5 Vlan600 1.1.5.5/32 Direct 0 0 127.0.0.1 InLoop0 127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0 127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0 1.1.6.0/24 Direct 0 0 1.1.6.1 Vlan100 1.1.6.1/32 Direct 0 0 127.0.0.1 InLoop0 **Use the ping command on Host B to check the reachability of Host A, assuming Windows XP runs on the two hosts.** C:\Documents and Settings\Administrator>ping 1.1.2.2 Pinging 1.1.2.2 with 32 bytes of data: Reply from 1.1.2.2: bytes=32 time=1ms TTL=255 Reply from 1.1.2.2: bytes=32 time=1ms TTL=255 Reply from 1.1.2.2: bytes=32 time=1ms TTL=255 Reply from 1.1.2.2: bytes=32 time=1ms TTL=255 Ping statistics for 1.1.2.2: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 1ms, Maximum = 1ms, Average = 1ms **Use the tracert command on Host B to check the reachability of Host A.** C:\Documents and Settings\Administrator>tracert 1.1.2.2 Tracing route to 1.1.2.2 over a maximum of 30 hops 1 <1 ms <1 ms <1 ms 1.1.6.1 2 <1 ms <1 ms <1 ms 1.1.4.1 3 1 ms <1 ms <1 ms 1.1.2.2 **Static route FRR configuration example:** **Network requirements:** Switch S, Switch A, and Switch D are interconnected through static routes, as illustrated in Figure 3. Configure static route FRR so that when the link between Switch S and Switch D fails, traffic can be switched to Link B immediately. **Figure 3: Network diagram for static route FRR configuration** {{:hpe:switch:5800:c03128058.jpg.jpg?400|}} **Procedure:** ** * Configure IP addresses for the interfaces on each switch and configure static routes:** Configure static routes on Switch S, Switch A, and Switch D so that Switch S can reach Loopback 0 on Switch D, and Switch D can reach Loopback 0 on Switch S. Configure a static route on Switch S: system-view [SwitchS] ip route-static 4.4.4.4 32 vlan-interface 200 13.13.13.2 Configure a static route on Switch D: system-view [SwitchD] ip route-static 1.1.1.1 32 vlan-interface 200 13.13.13.1 Configure a static route on Switch A: system-view [SwitchA] ip route-static 4.4.4.4 32 vlan-interface 101 24.24.24.4 [SwitchA] ip route-static 1.1.1.1 32 vlan-interface 100 12.12.12.1 ** * Configure static route FRR:** Configure Switch S: [SwitchS] bfd echo-source-ip 1.1.1.1 [SwitchS] ip ip-prefix abc index 10 permit 4.4.4.4 32 [SwitchS] route-policy frr permit node 10 [SwitchS-route-policy] if-match ip-prefix abc [SwitchS-route-policy] apply fast-reroute backup-interface vlan-interface 100 backupnexthop 12.12.12.2 [SwitchS-route-policy] quit [SwitchS] ip route-static fast-reroute route-policy frr Configure Switch D: [SwitchD] bfd echo-source-ip 4.4.4.4 [SwitchD] ip ip-prefix abc index 10 permit 1.1.1.1 32 [SwitchD] route-policy frr permit node 10 [SwitchD-route-policy] if-match ip-prefix abc [SwitchD-route-policy] apply fast-reroute backup-interface vlan-interface 101 backupnexthop 24.24.24.2 [SwitchD-route-policy] quit [SwitchD] ip route-static fast-reroute route-policy frr ** * Verify the configuration:** **Display route 4.4.4.4/32 on Switch S to view the backup next hop information.** [SwitchS] display ip routing-table 4.4.4.4 verbose Routing Table : Public Summary Count : 1 Destination: 4.4.4.4/32 Protocol: Static Process ID: 0 Preference: 60 Cost: 0 IpPrecedence: QosLcId: NextHop: 13.13.13.2 Interface: vlan 200 BkNextHop: 12.12.12.2 BkInterface: vlan 100 RelyNextHop: 0.0.0.0 Neighbor : 0.0.0.0 Tunnel ID: 0x0 Label: NULL BKTunnel ID: 0x0 BKLabel: NULL State: Active Adv Age: 00h01m27s Tag: 0 **Display route 1.1.1.1/32 on Switch D to view the backup next hop information.** [SwitchD] display ip routing-table 1.1.1.1 verbose Routing Table : Public Summary Count : 1 Destination: 1.1.1.1/32 Protocol: Static Process ID: 0 Preference: 60 Cost: 0 IpPrecedence: QosLcId: NextHop: 13.13.13.1 Interface: vlan 200 BkNextHop: 24.24.24.2 BkInterface: vlan 101 RelyNextHop: 0.0.0.0 Neighbor : 0.0.0.0 Tunnel ID: 0x0 Label: NULL BKTunnel ID: 0x0 BKLabel: NULL State: Active Adv Age: 00h01m27s Tag: 0 **BFD for static routes configuration example:** **Network requirements:** As shown in Figure 4: * Configure a static route to subnet 120.1.1.0/24 on Switch A and configure a static route to subnet 121.1.1.0/24 on Switch B. Both routes have BFD enabled. * When the link over (which Switch A communicates with Switch B through the Layer 2) switch fails, BFD can detect the failure immediately. Switch A and Switch B then communicate through Switch C. **Figure 4: Network diagram for configuring BFD for static routes** {{:hpe:switch:5800:c03128061.jpg.jpg?400|}} {{:hpe:switch:5800:c03128062.jpg.jpg?400|}} **Procedure:** ** * Configure IP addresses for the interfaces (omitted).** ** * Configure BFD:** **Configure static routes on Switch A and enable BFD control packet mode for the static route through the Layer 2 switch.** system-view [SwitchA] interface vlan-interface10 [SwitchA-vlan-interface10] bfd min-transmit-interval 500 [SwitchA-vlan-interface10] bfd min-receive-interval 500 [SwitchA-vlan-interface10] bfd detect-multiplier 9 [SwitchA-vlan-interface10] quit [SwitchA] ip route-static 120.1.1.0 24 vlan-interface 10 12.1.1.2 bfd control-packet [SwitchA] ip route-static 120.1.1.0 24 vlan-interface 11 10.1.1.100 preference 65 [SwitchA] quit **Configure static routes on Switch B and enable BFD control packet mode for the static route through the Layer 2 switch.** system-view [SwitchB] interface vlan-interface10 [SwitchB-vlan-interface10] bfd min-transmit-interval 500 [SwitchB-vlan-interface10] bfd min-receive-interval 500 [SwitchB-vlan-interface10] bfd detect-multiplier 9 [SwitchB-vlan-interface10]] quit [SwitchB] ip route-static 121.1.1.0 24 vlan-interface 10 12.1.1.1 bfd control-packet [SwitchB] ip route-static 121.1.1.0 24 vlan-interface 13 13.1.1.2 preference 65 [SwitchB] quit **Verify the configuration:** **The following operations are performed on Switch A. The operations on Switch B are similar.** display bfd session Total Session Num: 1 Init Mode: Active Session Working Under Ctrl Mode: LD/RD SourceAddr DestAddr State Holdtime Interface 4/7 12.1.1.1 12.1.1.2 Up 2000ms Vlan10 **Display the static route information of Switch A:** display ip routing-table protocol static Public Routing Table : Static Summary Count : 2 Static Routing table Status : < Active> Summary Count : 1 Destination/Mask Proto Pre Cost NextHop Interface 120.1.1.0/24 Static 60 0 12.1.1.2 Vlan10 Direct Routing table Status : Summary Count : 1 Destination/Mask Proto Pre Cost NextHop Interface 120.1.1.0/24 Static 65 0 10.1.1.100 Vlan11 **Enable BFD debugging on Switch A. When the link between Switch A and Layer 2 switch fails, Switch A can detect the failure:** debugging bfd event debugging bfd scm terminal debugging %Jul 27 10:18:18:672 2007 SwitchA BFD/4/LOG:Sess[12.1.1.1/12.1.1.2, Vlan10,Ctrl], Sta: UP->DOWN, Diag: 1 *Jul 27 10:18:18:672 2007 SwitchA BFD/7/EVENT:Send sess-down Msg, [Src:12.1.1.1,Dst:12.1.1.2, Vlan10,Ctrl], instance:0, protocol:STATIC *Jul 27 10:18:19:172 2007 SwitchA BFD/7/EVENT:Receive Delete-sess, [Src:12.1.1.1,Dst:12.1.1.2, Vlan10,Ctrl], Direct, Instance:0x0, Proto:STATIC *Jul 27 10:18:19:172 2007 SwitchA BFD/7/EVENT:Notify driver to stop receiving bfd control packet **Use display ip routing-table protocol static to display the static route information on Switch A.** display ip routing-table protocol static Public Routing Table : Static Summary Count : 2 Static Routing table Status : < Active> Summary Count : 1 Destination/Mask Proto Pre Cost NextHop Interface 120.1.1.0/24 Static 65 0 10.1.1.100 Vlan11 Static Routing table Status : < Inactive> Summary Count : 1 Destination/Mask Proto Pre Cost NextHop Interface 120.1.1.0/24 Static 60 0 12.1.1.2 Vlan10