The term “router”
in this document refers to a router in a generic sense or a Layer 3 switch.
1.1 Routing and Routing Table
Routing in the Internet is achieved through
routers. Upon receiving a packet, a router identifies an optimal route based on
the destination address and forwards the packet to the next router in the path
until the packet reaches the last router, which forwards the packet to the intended
destination host.
1.1.2 Routing
Through a Routing Table
I. Routing table
Routing table plays a key role in allowing
routers to forward packets. Each router maintains a routing table, and each
entry in the table specifies which physical interface a packet destined for a
certain destination should go out to reach the next hop (the next router) or
the directly connected destination.
Routes in a routing table can be divided
into three categories by origin:
l
Direct routes: Routes discovered by data link protocols,
also known as interface routes.
l
Static routes: Routes that are manually
configured.
l
Dynamic routes: Routes that are discovered
dynamically by routing protocols.
II. Contents of a routing table
A routing table includes the following key items:
l
Destination address: Indicates the destination
address or destination network of an IP packet.
l
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
255.255.0.0, the address of the destination network is 129.102.0.0. A network mask
is made of a certain number of consecutive 1s. It can be expressed in dotted
decimal format or by the number of the 1s.
l
Outbound interface: Specifies the interface
through which the IP packets are to be forwarded.
l
IP address of the next hop: Specifies the
address of the next router on the route.
l
Priority for the route. Multiple routes may
exist to the same destination, each of which has a different next hop and may be
generated by various routing protocols or be manually configured. The optimal
route is the one with the highest priority (with the smallest metric).
Routes can be divided into two categories
by destination:
l
Subnet routes: The destination is a subnet.
l
Host routes: The destination is a host.
Based on whether the destination is
directly connected to a given router, routes can be divided into:
l
Direct routes: The destination is directly
connected to the router.
l
Indirect routes: The destination is not directly
connected to the router.
To prevent the routing table from getting
too large, you can configure a default route. All packets with no matching
entry in the routing table will be forwarded through the default route.
In Figure 1-1, the IP address on each cloud represents the address of the network. Router R8 resides in three networks and therefore has three IP addresses for its three physical interfaces. Its routing table is shown on the
right of the network topology.

Figure 1-1 A sample routing table
1.2 Routing Protocol Overview
Static routing is easy to configure and requires
less system resources. It works well in small, stable networks with simple
topologies. Its major drawback is that you must perform routing configuration
again whenever the network topology changes; it cannot adjust to network
changes by itself.
Dynamic routing, on the other hand, is
based on dynamic routing protocols, which can detect network topology changes
and recalculate the routes accordingly. Therefore, dynamic routing is suitable
for large networks. Its disadvantages are that it is complicated to configure,
and that it not only imposes higher requirements on the system, but also eats
away a certain amount of network resources.
Dynamic routing protocols can be classified
based on the following standards:
I. Operational scope
l
Interior gateway protocols (IGPs): Work within
an autonomous system, typically includes RIP, OSPF, and IS-IS.
l
Exterior gateway protocols (EGPs): Work between
autonomous systems. The most popular one is BGP.
An autonomous
system refers to a group of routers that share the same routing policy and work
under the same administration.
II. Routing algorithm
l
Distance-vector protocols: Includes mainly RIP
and BGP. BGP is also considered a path-vector protocol.
l
Link-state protocols: Includes mainly OSPF and
IS-IS.
The main differences between the above two types
of routing algorithms lie in the way routes are discovered and calculated.
III. Type of the destination
address
l
Unicast routing protocols: Includes RIP, OSPF,
BGP, and IS-IS.
l
Multicast routing protocols: Includes PIM-SM and
PIM-DM.
This chapter focuses on unicast routing
protocols. For information on multicast routing protocols, refer to Multicast
Operation.
IV. Version of IP protocol
IPv4 routing protocols: RIP, OSPF, BGP and
IS-IS.
IPv6 routing protocols: RIPng, OSPFv3,
BGP4+, IPv6 IS-IS.
Different routing
protocols may find different routes to the same destination. However, not all
of those routes are optimal. In fact, at a particular moment, only one protocol
can uniquely determine the current optimal routing to the destination. For the
purpose of route selection, every route (including static routes) is assigned a
priority according to its origin. The route with the highest priority is
preferred.
The following table lists some routing
protocols and the default priorities for routes found by them:
|
Routing approach
|
Priority
|
|
DIRECT
|
0
|
|
OSPF
|
10
|
|
IS-IS
|
15
|
|
STATIC
|
60
|
|
RIP
|
100
|
|
OSPF ASE
|
150
|
|
OSPF NSSA
|
150
|
|
IBGP
|
255
|
|
EBGP
|
255
|
|
UNKNOWN
|
256
|
IPv4 and IPv6
routes have their own respective routing tables.
As different routing protocols use different algorithms to calculate
routes, they may find different routes. In a large network with multiple
routing protocols, it is required for routing protocols to share their routing
information. Each routing protocol has its own route redistribution mechanism.
1.3 Displaying and Maintaining a Routing
Table
|
To do…
|
Use the command…
|
Remarks
|
|
Display summary information about the
active routes in the routing table
|
display ip routing-table [ verbose | | { begin | exclude |
include } regular-expression ]
|
Available in any view
|
|
Display information about routes to the
specified destination
|
display ip routing-table ip-address [ mask-length | mask ] [ longer-match
] [ verbose ]
|
Available in any view
|
|
Display information about routes with destination
addresses in the specified range
|
display ip routing-table ip-address1 mask1 ip-address2 mask2 [
verbose ]
|
Available in any view
|
|
Display information about routes
permitted by a specified basic ACL
|
display ip routing-table acl acl-number [ verbose ]
|
Available in any view
|
|
Display information
about routes selected by a specified prefix list
|
display
ip routing-table ip-prefix ip-prefix-name
[ verbose ]
|
Available
in any view
|
|
Display protocol specific routes
|
display ip routing-table protocol protocol [ inactive | verbose
]
|
Available in any view
|
|
Display statistics
about the routing table
|
display
ip routing-table statistics
|
Available in any view
|
|
Clear statistics for the routing table
|
reset ip routing-table statistics
protocol { all | protocol }
|
Available in user view
|
|
Display brief IPv6 routing table
information
|
display ipv6 routing-table
|
Available in any view
|
|
Display verbose IPv6 routing table
information
|
display ipv6 routing-table verbose
|
Available in any view
|
|
Disply routing information for a specifed
destination IPv6 address
|
display ipv6 routing-table ipv6-address prefix-length [ longer-match ]
[ verbose ]
|
Available in any view
|
|
Display routing information permitted by
an IPv6 ACL
|
display ipv6 routing-table acl acl6-number [ verbose ]
|
Available in any view
|
|
Display routing information permitted by
an IPv6 prefix list
|
display ipv6 routing-table ipv6-prefix ipv6-prefix-name [ verbose ]
|
Available in any view
|
|
Display IPv6 routing information of a
routing protocol
|
display ipv6 routing-table protocol protocol [ inactive | verbose
]
|
Available in any view
|
|
Display IPv6 routing statistics
|
display ipv6 routing-table statistics
|
Available in any view
|
|
Display IPv6 routing information for an
IPv6 address range
|
display ipv6 routing-table ipv6-address1 prefix-length1 ipv6-address2
prefix-length2 [ verbose ]
|
Available in any view
|
|
Clear specified IPv6 routing table
statistics
|
reset ipv6 routing-table statistics
protocol { all | protocol }
|
Available in user view
|