01-Static Routing Configuration
01-Static Routing Configuration
i
Configuring static routing
About static routes
Static routes are manually configured. If a network's topology is simple, you only need to configure
static routes for the network to work correctly.
Static routes cannot adapt to network topology changes. If a fault or a topological change occurs in
the network, the network administrator must modify the static routes manually.
1
Configuring a static route group
About static route groups
This task allows you to batch create static routes with different prefixes but the same output interface
and next hop.
You can create a static route group, and specify the static group in the ip route-static
command. All prefixes in the static route group will be assigned the next hop and output interface
specified in the ip route-static command.
Procedure
1. Enter system view.
system-view
2. Create a static route group and enter its view.
ip route-static-group group-name
By default, no static route group is configured.
3. Add a static route prefix to the static route group.
prefix dest-address { mask-length | mask }
By default, no static route prefix is added to the static route group.
4. Return to system view.
quit
5. Configure a static route.
Public network:
ip route-static group group-name { interface-type interface-number [
next-hop-address ] |
next-hop-address | vpn-instance d-vpn-instance-name next-hop-address
} [ permanent | track track-entry-number ] [ preference preference ] [
tag tag-value ] [ description text ]
VPN:
ip
route-static vpn-instance s-vpn-instance-name group group-name { inte
rface-type interface-number [ next-hop-address ] | next-hop-address
[ public ] | vpn-instance d-vpn-instance-name next-hop-address } [ per
manent
| track track-entry-number ] [ preference preference ] [ tag tag-value
] [ description text ]
MTR:
ip route-static topology topo-name group group-name { next-hop-address
| interface-type interface-number [ next-hop-address ] } [ preferenc
e preference ] [ tag tag-value ] [ description text ]
By default, no static route is configured.
2
Procedure
1. Enter system view.
system-view
2. Delete all static routes.
Public network:
delete static-routes all
VPN:
delete vpn-instance vpn-instance-name static-routes all
MTR:
delete topology topo-name static-routes all
About BFD
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.
For more information about BFD, see High Availability Configuration Guide.
3
By default, BFD control mode for a static route is not configured.
Configuring BFD control mode for a static route (indirect next hop)
1. Enter system view.
system-view
2. Configure BFD control mode for a static route.
Public network:
ip route-static dest-address { mask-length | mask } { next-hop-address
bfd control-packet bfd-source
ip-address | vpn-instance d-vpn-instance-name next-hop-address bfd co
ntrol-packet bfd-source ip-address } [ preference preference ] [ tag ta
g-value ] [ description text ]
VPN:
ip route-static vpn-instance s-vpn-instance-name dest-address {
mask-length | mask } { next-hop-address bfd control-packet bfd-source
ip-address | vpn-instance d-vpn-instance-name next-hop-address bfd co
ntrol-packet bfd-source ip-address } [ preference preference ] [
tag tag-value ] [ description text ]
By default, BFD control mode for a static route is not configured.
IMPORTANT:
Do not use BFD for a static route with the output interface in spoofing state.
Procedure
1. Enter system view.
system-view
2. Configure the source address of echo packets.
bfd echo-source-ip ip-address
By default, the source address of echo packets is not configured.
For more information about this command, see High Availability Command Reference.
3. Configure BFD echo mode for a static route.
Public network:
ip route-static dest-address { mask-length | mask } interface-type
interface-number
next-hop-address bfd echo-packet [ preference preference ] [ tag tag-v
alue ] [ description text ]
VPN:
ip route-static vpn-instance s-vpn-instance-name
dest-address { mask-length | mask } interface-type interface-number
next-hop-address bfd echo-packet [ preference preference ] [ tag tag-v
alue ] [ description text ]
4
Configuring static route FRR
About static route FRR
A link or router failure on a path can cause packet loss. Static route fast reroute (FRR) enables fast
rerouting to minimize the impact of link or node failures.
Figure 1 Network diagram
Backup nexthop: Router C
As shown in Figure 1, upon a link failure, packets are directed to the backup next hop to avoid traffic
interruption. You can either specify a backup next hop for FRR or enable FRR to automatically select
a backup next hop (which must be configured in advance).
5
ip route-static
vpn-instance s-vpn-instance-name dest-address { mask-length | mask } i
nterface-type interface-number [ next-hop-address [ backup-interface
interface-type interface-number [ backup-nexthop backup-nexthop-add
ress ] ] ] [ permanent ] [ preference preference ] [ tag tag-value ] [ des
cription text ]
MTR:
ip route-static topology topo-name dest-address { mask-length |
mask } { next-hop-address | interface-type interface-number [ next-ho
p-address [ backup-interface interface-type interface-number backup
-nexthop backup-nexthop-address ] ] } [ preference preference ] [ tag t
ag-value ] [ description text ]
By default, static route FRR is disabled.
6
Task Command
display ip
Display static route information. routing-table protocol static [ inactive | verbo
se ]
Display static route next hop
display route-static nib [ nib-id ] [ verbose ]
information.
display route-static
routing-table [ topology topo-name ] [ ip-addres
Display static routing table s { mask-length | mask } ]
information. display route-static
routing-table [ vpn-instance vpn-instance-nam
e ] [ ip-address { mask-length | mask } ]
Host B
1.1.6.2/24
GE2/0/3
1.1.6.1/24
GE2/0/1 GE2/0/2
1.1.4.2/30 1.1.5.5/30
Router B
GE2/0/2 GE2/0/2
1.1.4.1/30 1.1.5.6/30
GE2/0/1 GE2/0/1
1.1.2.3/24 1.1.3.1/24
Host A Router A Router C Host C
1.1.2.2/24 1.1.3.2/24
Procedure
1. Configure IP addresses for interfaces. (Details not shown.)
2. Configure static routes:
# Configure a default route on Router A.
<RouterA> system-view
[RouterA] ip route-static 0.0.0.0 0.0.0.0 1.1.4.2
# Configure two static routes on Router B.
<RouterB> system-view
7
[RouterB] ip route-static 1.1.2.0 255.255.255.0 1.1.4.1
[RouterB] ip route-static 1.1.3.0 255.255.255.0 1.1.5.6
# Configure a default route on Router C.
<RouterC> system-view
[RouterC] ip route-static 0.0.0.0 0.0.0.0 1.1.5.5
3. Configure the default gateways of Host A, Host B, and Host C as 1.1.2.3, 1.1.6.1, and 1.1.3.1.
(Details not shown.)
Verifying the configuration
# Display the static route information on Router A.
[RouterA] display ip routing-table protocol static
Summary Count : 1
Summary Count : 2
# Use the ping command on Host B to test the reachability of Host A (Windows XP runs on the two
hosts).
C:\Documents and Settings\Administrator>ping 1.1.2.2
8
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 1ms, Average = 1ms
Trace complete.
GE2/0/2 GE2/0/2
BFD
GE2/0/1 GE2/0/2
Router C
9
Procedure
1. Configure IP addresses for interfaces. (Details not shown.)
2. Configure static routes and BFD:
# Configure static routes on Route A and enable BFD control mode for the static route that
traverses the Layer 2 switch.
<RouterA> system-view
[RouterA] interface gigabitethernet 2/0/1
[RouterA-GigabitEthernet2/0/1] bfd min-transmit-interval 500
[RouterA-GigabitEthernet2/0/1] bfd min-receive-interval 500
[RouterA-GigabitEthernet2/0/1] bfd detect-multiplier 9
[RouterA-GigabitEthernet2/0/1] quit
[RouterA] ip route-static 120.1.1.0 24 gigabitethernet 2/0/1 12.1.1.2 bfd
control-packet
[RouterA] ip route-static 120.1.1.0 24 gigabitethernet 2/0/2 10.1.1.100 preference
65
[RouterA] quit
# Configure static routes on Router B and enable BFD control mode for the static route that
traverses the Layer 2 switch.
<RouterB> system-view
[RouterB] interface gigabitethernet 2/0/1
[RouterB-GigabitEthernet2/0/1] bfd min-transmit-interval 500
[RouterB-GigabitEthernet2/0/1] bfd min-receive-interval 500
[RouterB-GigabitEthernet2/0/1] bfd detect-multiplier 9
[RouterB-GigabitEthernet2/0/1] quit
[RouterB] ip route-static 121.1.1.0 24 gigabitethernet 2/0/1 12.1.1.1 bfd
control-packet
[RouterB] ip route-static 121.1.1.0 24 gigabitethernet 2/0/2 13.1.1.2 preference 65
[RouterB] quit
# Configure static routes on Router C.
<RouterC> system-view
[RouterC] ip route-static 120.1.1.0 24 13.1.1.1
[RouterC] ip route-static 121.1.1.0 24 10.1.1.102
The output shows that the BFD session has been created.
# Display static routes on Router A.
<RouterA> display ip routing-table protocol static
Summary Count : 1
10
Static Routing table Status : <Active>
Summary Count : 1
The output shows that Router A communicates with Router B through GigabitEthernet 2/0/1. Then
the link over GigabitEthernet 2/0/1 fails.
# Display static routes on Router A.
<RouterA> display ip routing-table protocol static
Summary Count : 1
The output shows that Router A communicates with Router B through GigabitEthernet 2/0/2.
11
Figure 4 Network diagram
/2
Router A Router B
/0
E2
BFD
E2
/0
G
/2
GE2/0/1 GE2/0/2
Router C
Procedure
1. Configure IP addresses for interfaces. (Details not shown.)
2. Configure static routes and BFD:
# Configure static routes on Router A and enable BFD control mode for the static route that
traverses Router D.
<RouterA> system-view
[RouterA] bfd multi-hop min-transmit-interval 500
[RouterA] bfd multi-hop min-receive-interval 500
[RouterA] bfd multi-hop detect-multiplier 9
[RouterA] ip route-static 120.1.1.0 24 2.2.2.9 bfd control-packet bfd-source 1.1.1.9
[RouterA] ip route-static 120.1.1.0 24 gigabitethernet 2/0/2 10.1.1.100 preference
65
[RouterA] quit
# Configure static routes on Router B and enable BFD control mode for the static route that
traverses Router D.
<RouterB> system-view
[RouterB] bfd multi-hop min-transmit-interval 500
[RouterB] bfd multi-hop min-receive-interval 500
[RouterB] bfd multi-hop detect-multiplier 9
12
[RouterB] ip route-static 121.1.1.0 24 1.1.1.9 bfd control-packet bfd-source 2.2.2.9
[RouterB] ip route-static 121.1.1.0 24 gigabitethernet 2/0/2 13.1.1.2 preference 65
[RouterB] quit
# Configure static routes on Router C.
<RouterC> system-view
[RouterC] ip route-static 120.1.1.0 24 13.1.1.1
[RouterC] ip route-static 121.1.1.0 24 10.1.1.102
# Configure static routes on Router D.
<RouterD> system-view
[RouterD] ip route-static 120.1.1.0 24 11.1.1.2
[RouterD] ip route-static 121.1.1.0 24 12.1.1.1
The output shows that the BFD session has been created.
# Display static routes on Router A.
<RouterA> display ip routing-table protocol static
Summary Count : 1
The output shows that Router A communicates with Router B through GigabitEthernet 2/0/1. Then
the link over GigabitEthernet 2/0/1 fails.
# Display static routes on Router A.
<RouterA> display ip routing-table protocol static
Summary Count : 1
13
Static Routing table Status : <Inactive>
Summary Count : 0
The output shows that Router A communicates with Router B through GigabitEthernet 2/0/2.
GE
1 2/0
2/0/ /2
GE
Link B
/1 GE
2/0 2/0
GE Link A /1
Loop0 Loop0
GE2/0/2 GE2/0/2
Router A Router B
Procedure
1. Configure IP addresses for interfaces. (Details not shown.)
2. Configure static route FRR on link A by using one of the following methods:
(Method 1.) Specify a backup next hop for static route FRR:
# Configure a static route on Router A, and specify GigabitEthernet 2/0/1 as the backup
output interface and 12.12.12.2 as the backup next hop.
<RouterA> system-view
[RouterA] ip route-static 4.4.4.4 32 gigabitethernet 2/0/2 13.13.13.2
backup-interface gigabitethernet 2/0/1 backup-nexthop 12.12.12.2
# Configure a static route on Router B, and specify GigabitEthernet 2/0/1 as the backup
output interface and 24.24.24.2 as the backup next hop.
<RouterB> system-view
14
[RouterB] ip route-static 1.1.1.1 32 gigabitethernet 2/0/2 13.13.13.1
backup-interface gigabitethernet 2/0/1 backup-nexthop 24.24.24.2
(Method 2.) Configure static route FRR to automatically select a backup next hop:
# Configure static routes on Router A, and enable static route FRR.
<RouterA> system-view
[RouterA] ip route-static 4.4.4.4 32 gigabitethernet 2/0/2 13.13.13.2
[RouterA] ip route-static 4.4.4.4 32 gigabitethernet 2/0/1 12.12.12.2 preference
70
[RouterA] ip route-static fast-reroute auto
# Configure static routes on Router B, and enable static route FRR.
<RouterB> system-view
[RouterB] ip route-static 1.1.1.1 32 gigabitethernet 2/0/2 13.13.13.1
[RouterB] ip route-static 1.1.1.1 32 gigabitethernet 2/0/1 24.24.24.2 preference
70
[RouterB] ip route-static fast-reroute auto
3. Configure static routes on Router C.
<RouterC> system-view
[RouterC] ip route-static 4.4.4.4 32 gigabitethernet 2/0/2 24.24.24.4
[RouterC] ip route-static 1.1.1.1 32 gigabitethernet 2/0/1 12.12.12.1
Summary Count : 1
Destination: 4.4.4.4/32
Protocol: Static
Process ID: 0
SubProtID: 0x0 Age: 04h20m37s
Cost: 0 Preference: 60
IpPre: N/A QosLocalID: N/A
Tag: 0 State: Active Adv
OrigTblID: 0x0 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 0
NibID: 0x26000002 LastAs: 0
AttrID: 0xffffffff Neighbor: 0.0.0.0
Flags: 0x1008c OrigNextHop: 13.13.13.2
Label: NULL RealNextHop: 13.13.13.2
BkLabel: NULL BkNextHop: 12.12.12.2
SRLabel: NULL BkSRLabel: NULL
Tunnel ID: Invalid Interface: GigabitEthernet2/0/2
BkTunnel ID: Invalid BkInterface: GigabitEthernet2/0/1
FtnIndex: 0x0 TrafficIndex: N/A
Connector: N/A
# Display route 1.1.1.1/32 on Router B to view the backup next hop information.
[RouterB] display ip routing-table 1.1.1.1 verbose
Summary Count : 1
15
Destination: 1.1.1.1/32
Protocol: Static
Process ID: 0
SubProtID: 0x0 Age: 04h20m37s
Cost: 0 Preference: 10
IpPre: N/A QosLocalID: N/A
Tag: 0 State: Active Adv
OrigTblID: 0x0 OrigVrf: default-vrf
TableID: 0x2 OrigAs: 0
NibID: 0x26000002 LastAs: 0
AttrID: 0xffffffff Neighbor: 0.0.0.0
Flags: 0x1008c OrigNextHop: 13.13.13.1
Label: NULL RealNextHop: 13.13.13.1
BkLabel: NULL BkNextHop: 24.24.24.2
SRLabel: NULL BkSRLabel: NULL
Tunnel ID: Invalid Interface: GigabitEthernet2/0/2
BkTunnel ID: Invalid BkInterface: GigabitEthernet2/0/1
FtnIndex: 0x0 TrafficIndex: N/A
Connector: N/A
16
Configuring a default route
A default route is used to forward packets that do not match any specific routing entry in the routing
table. Without a default route, packets that do not match any routing entries are discarded and an
ICMP destination-unreachable packet is sent to the source.
A default route can be configured in either of the following ways:
• The network administrator can configure a default route with both destination and mask being
0.0.0.0. For more information, see "Configuring static routing."
• Some dynamic routing protocols (such as OSPF, IS-IS, and RIP) can generate a default route.
For example, an upstream router running OSPF can generate a default route and advertise it to
other routers. These routers install the default route with the next hop being the upstream router.
For more information, see the respective chapters on these routing protocols in this
configuration guide.
17