- Table of Contents
-
- 07-Layer 3 - IP Routing Configuration Guide
- 00-Preface
- 01-IP Routing Basics
- 02-Static Routing Configuration
- 03-RIP Configuration
- 04-OSPF Configuration
- 05-IS-IS Configuration
- 06-BGP Configuration
- 07-Policy-Based Routing Configuration
- 08-Guard Route Configuration
- 09-IPv6 Static Routing Configuration
- 10-RIPng Configuration
- 11-OSPFv3 Configuration
- 12-IPv6 IS-IS Configuration
- 13-IPv6 BGP Configuration
- 14-IPv6 Policy-Based Routing Configuration
- 15-Routing Policy Configuration
- 16-Tunnel End Packets Policy Routing Configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
01-IP Routing Basics | 91.71 KB |
IP routing basics
IP routing overview
Upon receiving a packet, a router determines the optimal route based on the destination address and forwards the packet to the next router in the path. When the packet reaches the last router, it then forwards the packet to the destination host.
Routing provides the path information that guides the forwarding of packets.
Routes can be divided into the following categories by destination:
· Network route—The destination is a network. The subnet mask is less than 32 bits.
· Host route—The destination is a host. The subnet mask is 32 bits.
Routes can be divided into the following types based on whether the destination is directly connected to a given router:
· Direct routes—The destination is directly connected to the router.
· Indirect routes—The destination is not directly connected to the router.
Routing table
A router selects optimal routes from the routing table, and sends them to the forwarding information base (FIB) table to guide packet forwarding. Each router maintains a routing table and a FIB table.
Routes in a routing table can be divided into the following categories by origin:
· Direct routes—Routes discovered by data link protocols, also known as “interface routes.”
· Static routes—Manually configured routes. Static routes are easy to configure and require fewer system resources. They work well in small and stable networks, but cannot adjust to network changes, so you must manually configure the routes again whenever the network topology changes.
· Dynamic routes—Routes discovered dynamically by routing protocols.
Each entry in the FIB table specifies a physical interface that packets destined for a certain address should go out to reach the next hop—the next router—or the directly connected destination.
|
NOTE: For more information about the FIB table, see the Layer 3—IP Services Configuration Guide. |
Display the brief information of a routing table by using the display ip routing-table command.
For example:
<Sysname> display ip routing-table
Routing Tables: Public
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.0/24 Direct 0 0 1.1.1.1 GE3/0/1
2.2.2.0/24 Static 60 0 12.2.2.2 GE3/0/2
80.1.1.0/24 OSPF 10 2 80.1.1.1 GE3/0/3
…(Part of the output information is omitted)
A route entry includes the following key items:
· Destination—Destination IP address or destination network
· Mask—The network mask specifies, in company with the destination address, the address of the destination network. A logical AND operation between the destination address and the network mask yields the address of the destination network. For example, if the destination address is 129.102.8.10 and the mask is 255.255.0.0, then the address of the destination network is 129.102.0.0. A network mask is made up of a certain number of consecutive 1s. It can be expressed in dotted decimal format or by the number of the 1s.
· Pre—Preference of the route. Among routes to the same destination, the one with the highest preference is optimal.
· Cost—When multiple routes to a destination have the same preference, the one with the smallest cost becomes the optimal route.
· NextHop—Specifies the IP address of the next hop
· Interface—Specifies the interface through which a matching IP packet is to be forwarded
Dynamic routing protocols
Based on dynamic routing protocols, dynamic routing can detect network topology changes and recalculate the routes, so it is suitable for large networks. However, dynamic routing is difficult to configure, imposes higher requirements on the system, and consumes a certain amount of network resources.
Dynamic routing protocols can be classified based on different criteria, as shown in Table 1:
Table 1 Dynamic routing protocols
Criterion |
Categories |
Optional scope |
· Interior gateway protocols (IGPs)—Work within an autonomous system (AS). Examples include RIP, OSPF, and IS-IS. · Exterior gateway protocols (EGPs)—Work between ASs. The most popular one is BGP. |
Routing algorithm |
· Distance-vector protocols—RIP and BGP. BGP is also considered a path-vector protocol. · Link-state protocols—OSPF and IS-IS |
Destination address type |
· Unicast routing protocols—RIP, OSPF, BGP, and IS-IS · Multicast routing protocols—PIM-SM and PIM-DM |
IP version |
· IPv4 routing protocols—RIP, OSPF, BGP, and IS-IS · IPv6 routing protocols—RIPng, OSPFv3, IPv6 BGP, and IPv6 IS-IS |
|
NOTE: · An AS refers to a group of routers that share the same routing policy and work under the same administration. · This chapter focuses on unicast routing protocols. For more information about multicast routing protocols, see IP Multicast Configuration Guide. |
Routing preference
Different routing protocols can find different routes to the same destination. However, not all of those routes are optimal. For route selection, routing protocols, direct routes, and static routes are assigned different preferences. The route with the highest preference is preferred.
The preference of a direct route is always 0, which cannot be changed. You can manually configure preferences for any other route types. Each static route can be configured with a different preference. The following table lists the types of routes and the default preferences. The smaller the preference value, the higher the preference.
Routing approach |
Preference |
Direct route |
0 |
OSPF |
10 |
IS-IS |
15 |
Static route |
60 |
RIP |
100 |
OSPF ASE |
150 |
OSPF NSSA |
150 |
IBGP |
255 |
EBGP |
255 |
Unknown (route from an untrusted source) |
256 |
Load balancing
A routing protocol can be configured with multiple equal-cost routes to the same destination. These routes have the same preference and will all be used to accomplish load balancing if there is no route with a higher preference available.
Route backup
Route backup can help improve network reliability. With route backup, you can configure multiple routes to the same destination, expecting the one with the highest preference to be the main route and all the rest backup routes.
Under normal circumstances, packets are forwarded through the main route. When the link fails, the route with the highest preference among the backup routes is selected to forward packets. When the link recovers, the route selection process is performed again and the main route is selected again to forward packets.
Route recursion
The next hops of some BGP routes (except EBGP routes) and static routes configured with next hops may not be directly connected. The outgoing interface to reach the next hop must be available. Route recursion is used to find the outgoing interface based on the next hop information of the route. Link-state routing protocols, such as OSPF and IS-IS, do not need route recursion because they obtain next hop information through route calculation.
Route redistribution
Different routing protocols running on a network learn route information from each other through route redistribution. Each routing protocol can redistribute routes from other protocols, direct routes, and static routes. For more information, see relevant protocols in this configuration guide.
Displaying and maintaining a routing table
Task |
Command |
Remarks |
Display information about the routing table. |
display ip routing-table [ vpn-instance vpn-instance-name ] [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display information about routes permitted by an IPv4 basic ACL. |
display ip routing-table [ vpn-instance vpn-instance-name ] acl acl-number [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display information about routes to the specified destination. |
display ip routing-table [ vpn-instance vpn-instance-name ] ip-address [ mask | mask-length ] [ longer-match ] [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display information about routes with destination addresses in the specified range. |
display ip routing-table [ vpn-instance vpn-instance-name ] ip-address1 { mask | mask-length } ip-address2 { mask | mask-length } [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display routing information permitted by an IPv4 prefix list. |
display ip routing-table [ vpn-instance vpn-instance-name ] ip-prefix ip-prefix-name [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display routes of a routing protocol. |
display ip routing-table [ vpn-instance vpn-instance-name ] protocol protocol [ inactive | verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display statistics about the routing table. |
display ip routing-table [ vpn-instance vpn-instance-name ] statistics [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Clear statistics for the routing table. |
reset ip routing-table statistics protocol [ vpn-instance vpn-instance-name ] { all | protocol } |
Available in user view |
Display IPv6 routing table information. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display routing information permitted by an IPv6 ACL. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] acl acl6-number [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display routing information for a specified destination IPv6 address. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] ipv6-address prefix-length [ longer-match ] [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display IPv6 routing information for an IPv6 address range. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] ipv6-address1 prefix-length1 ipv6-address2 prefix-length2 [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display routing information permitted by an IPv6 prefix list. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] ipv6-prefix ipv6-prefix-name [ verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display IPv6 routing information of a routing protocol. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] protocol protocol [ inactive | verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display IPv6 routing statistics. |
display ipv6 routing-table [ vpn-instance vpn-instance-name ] statistics [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Clear specified IPv6 routing statistics. |
reset ipv6 routing-table statistics protocol [ vpn-instance vpn-instance-name ] { protocol | all } |
Available in user view |