Lecture9 Routing Concepts
Lecture9 Routing Concepts
Lecture9 Routing Concepts
Chapter 9
Routing Concepts
Module Objectives
Module Title: Routing Concepts
Module Objective: Explain how routers use information in packets to make forwarding decisions.
Static and Dynamic Routing Compare static and dynamic routing concepts.
9.1 Path Determination
Path Determination
Two Functions of a Router
When a router receives an IP packet on one interface, it determines which interface to
use to forward the packet to the destination. This is known as routing. The interface that
the router uses to forward the packet may be the final destination, or it may be a network
connected to another router that is used to reach the destination network. Each network
that a router connects to typically requires a separate interface, but this may not always
be the case.
The primary functions of a router are to determine the best path to forward packets based
on the information in its routing table, and to forward packets toward their destination.
Path Determination
Router Functions Example
Note: The term prefix length will be used to refer to the network portion of both IPv4 and
IPv6 addresses.
Path Determination
IPv4 Longest Match Example
In the table, an IPv4 packet has the destination IPv4 address 172.16.0.10. The router has
three route entries in its IPv4 routing table that match this packet: 172.16.0.0/12,
172.16.0.0/18, and 172.16.0.0/26. Of the three routes, 172.16.0.0/26 has the longest
match and would be chosen to forward the packet. For any of these routes to be
considered a match there must be at least the number of matching bits indicated by the
subnet mask of the route.
Destination IPv4 Address Address in Binary
172.16.0.10 10101100.00010000.00000000.00001010
1 172.16.0.0/12 10101100.00010000.00000000.00001010
2 172.16.0.0/18 10101100.00010000.00000000.00001010
3 172.16.0.0/26 10101100.00010000.00000000.00001010
Path Determination
IPv6 Longest Match Example
An IPv6 packet has the destination IPv6 address 2001:db8:c000::99. This example shows
three route entries, but only two of them are a valid match, with one of those being the
longest match. The first two route entries have prefix lengths that have the required
number of matching bits as indicated by the prefix length. The third route entry is not a
match because its /64 prefix requires 64 matching bits.
Destination 2001:db8:c000::99/48
Remote Networks: Networks that are not directly connected to the router. Routers learn
about remote networks in two ways:
• Static routes - Added to the routing table when a route is manually configured.
• Dynamic routing protocols - Added to the routing table when routing protocols dynamically learn
about the remote network.
Default Route: Specifies a next-hop router to use when the routing table does not contain a
specific route that matches the destination IP address. The default route can be entered
manually as a static route, or learned automatically from a dynamic routing protocol.
• A default route has a /0 prefix length. This means that no bits need to match the destination IP address
for this route entry to be used. If there are no routes with a match longer than 0 bits, the default route is
used to forward the packet. The default route is sometimes referred to as a gateway of last resort.
9.2 Packet Forwarding
Packet Forwarding
Packet Forwarding Decision Process
1. The data link frame with an
encapsulated IP packet arrives on
the ingress interface.
2. The router examines the
destination IP address in the
packet header and consults its IP
routing table.
3. The router finds the longest
matching prefix in the routing table.
4. The router encapsulates the
packet in a data link frame and
forwards it out the egress interface.
The destination could be a device
connected to the network or a next-
hop router.
5. However, if there is no matching
route entry the packet is dropped.
Packet Forwarding
Packet Forwarding Decision Process (Cont.)
After a router has determined the best path, it could do the following:
Note: This process will vary for other types of Layer 2 networks.
Packet Forwarding
Packet Forwarding Decision Process (Cont.)
After a router has determined the best path, it could do the following:
The filtering parameters that can be configured after the pipe include:
• section - This displays the entire section that starts with the filtering expression.
• include - This includes all output lines that match the filtering expression.
• exclude - This excludes all output lines that match the filtering expression.
• begin - This displays all the output lines from a certain point, starting with the line
that matches the filtering expression.
Note: Output filters can be used in combination with any show command.
Basic Router Configuration Review
Packet Tracer - Basic Router Configuration Review
In this Packet Tracer, you will do the following:
• Configure Devices and Verify Connectivity
• Display Router Information
9.4 IP Routing Table
IP Routing Table
Route Sources
A routing table contains a list of routes to known networks (prefixes and prefix lengths).
The source of this information is derived from the following:
• Directly connected networks
• Static routes
• Dynamic routing protocols
The source for each route in the routing table is identified by a code. Common codes
include the following:
• L - Identifies the address assigned to a router interface.
• C - Identifies a directly connected network.
• S - Identifies a static route created to reach a specific network.
• O - Identifies a dynamically learned network from another router using the OSPF routing protocol.
• * - This route is a candidate for a default route.
IP Routing Table
Routing Table Principles
There are three routing table principles as described in the table. These are issues that
are addressed by the proper configuration of dynamic routing protocols or static routes on
all the routers between the source and destination devices.
Routing Table Principle Example
Every router makes its decision alone, •R1 can only forward packets using its own routing table.
based on the information it has in its own •R1 does not know what routes are in the routing tables of other routers
routing table. (e.g., R2).
The information in a routing table of one Just because R1 has route in its routing table to a network in the
router does not necessarily match the internet via R2, that does not mean that R2 knows about that same
routing table of another router. network.
R1 receives a packet with the destination IP address of PC1 and the
source IP address of PC3. Just because R1 knows to forward the
Routing information about a path does not
packet out its G0/0/0 interface, doesn’t necessarily mean that it knows
provide return routing information.
how to forward packets originating from PC1 back to the remote
network of PC3
IP Routing Table
Routing Table Entries
In the figure, the numbers identify the following information:
• Route source - This identifies how the route was
learned.
• Destination network (prefix and prefix length) - This
identifies the address of the remote network.
• Administrative distance - This identifies the
trustworthiness of the route source. Lower values indicate
preferred route source.
• Metric - This identifies the value assigned to reach the
remote network. Lower values indicate preferred routes.
• Next-hop - This identifies the IP address of the next
router to which the packet would be forwarded. Note: The prefix length of the destination
• Route timestamp - This identifies how much time has network specifies the minimum number of far-
passed since the route was learned. left bits that must match between the IP
• Exit interface - This identifies the egress interface to use address of the packet and the destination
for outgoing packets to reach their final destination. network (prefix) for this route to be used.
IP Routing Table
Directly Connected Networks
To learn about any remote networks, the router must have at least one active interface
configured with an IP address and subnet mask (prefix length). This is known as a directly
connected network or a directly connected route. Routers add a directly connected route
to its routing table when an interface is configured with an IP address and is activated.
• A directly connected network is denoted by a status code of C in the routing table. The
route contains a network prefix and prefix length.
• The routing table also contains a local route for each of its directly connected
networks, indicated by the status code of L.
• For IPv4 local routes the prefix length is /32 and for IPv6 local routes the prefix length
is /128. This means the destination IP address of the packet must match all the bits in
the local route for this route to be a match. The purpose of the local route is to
efficiently determine when it receives a packet for the interface instead of a packet
that needs to be forwarded.
IP Routing Table
Static Routes
After directly connected interfaces are configured and added to the routing table, static or
dynamic routing can be implemented for accessing remote networks. Static routes are
manually configured. They define an explicit path between two networking devices. They
are not automatically updated and must be manually reconfigured if the network topology
changes.
An indented entry is known as a child route. A route entry is indented if it is the subnet of
a classful address (class A, B or C network). Directly connected networks will always be
indented (child routes) because the local address of the interface is always entered in the
routing table as a /32. The child route will include the route source and all the forwarding
information such as the next-hop address. The classful network address of this subnet will
be shown above the route entry, less indented, and without a source code. That route is
known as a parent route.
IP Routing Table
Structure of an IPv4 Routing Table
• An indented entry is known as a child route. A Router# show ip route
route entry is indented if it is the subnet of a classful (Output omitted)
address (class A, B or C network). 192.168.1.0/24 is variably..
C 192.168.1.0/24 is direct..
• Directly connected networks will always be indented L 192.168.1.1/32 is direct..
(child routes) because the local address of the O 192.168.2.0/24 [110/65]..
interface is always entered in the routing table as a O 192.168.3.0/24 [110/65]..
/32. 192.168.12.0/24 is variab..
C 192.168.12.0/30 is direct..
• The child route will include the route source and all L 192.168.12.1/32 is direct..
the forwarding information such as the next-hop 192.168.13.0/24 is variably..
address. C 192.168.13.0/30 is direct..
• The classful network address of this subnet will be L 192.168.13.1/32 is direct..
192.168.23.0/30 is subnette..
shown above the route entry, less indented, and O 192.168.23.0/30 [110/128]..
without a source code. That route is known as a Router#
parent route.
IP Routing Table
Structure of an IPv6 Routing Table
R1# show ipv6 route
The concept of classful addressing (output omitted for brevity)
OE2 ::/0 [110/1], tag 2
was never part of IPv6, so the via FE80::2:C, Serial0/0/1
structure of an IPv6 routing table is C 2001:DB8:ACAD:1::/64 [0/0]
via GigabitEthernet0/0/0, directly connected
very straight forward. Every IPv6 L 2001:DB8:ACAD:1::1/128 [0/0]
route entry is formatted and aligned via GigabitEthernet0/0/0, receive
C 2001:DB8:ACAD:2::/64 [0/0]
the same way. via GigabitEthernet0/0/1, directly connected
L 2001:DB8:ACAD:2::1/128 [0/0]
via GigabitEthernet0/0/1, receive
C 2001:DB8:ACAD:3::/64 [0/0]
via Serial0/1/1, directly connected
L 2001:DB8:ACAD:3::1/128 [0/0]
via Serial0/1/1, receive
O 2001:DB8:ACAD:4::/64 [110/50]
via FE80::2:C, Serial0/1/1
O 2001:DB8:ACAD:5::/64 [110/50]
via FE80::2:C, Serial0/1/1
L FF00::/8 [0/0]
via Null0, receive
R1#
IP Routing Table
Administrative Distance
A route entry for a specific network address (prefix and prefix length) can only appear
once in the routing table. However, it is possible that the routing table learns about the
same network address from more than one routing source. Except for very specific
circumstances, only one dynamic routing protocol should be implemented on a router.
Each routing protocol may decide on a different path to reach the destination based on
the metric of that routing protocol.
Cisco IOS uses what is known as the administrative distance (AD) to determine the route
to install into the IP routing table. The AD represents the "trustworthiness" of the route.
The lower the AD, the more trustworthy the route source.
IP Routing Table
Administrative Distance (Cont.)
Static routes are useful for smaller networks with only one path to an outside network.
They also provide security in a larger network for certain types of traffic, or links to other
networks that need more control.
Static and Dynamic Routing
Static or Dynamic? (Cont.)
Dynamic routing protocols are implemented in any type of network consisting of more
than just a few routers. Dynamic routing protocols are scalable and automatically
determine better routes if there is a change in the topology.
Routing protocols determine the best path, or route, to each network. That route is then
offered to the routing table. The route will be installed in the routing table if there is not
another routing source with a lower AD.
Static and Dynamic Routing
Best Path
The best path is selected by a routing protocol based on the value or metric it uses to
determine the distance to reach a network. A metric is the quantitative value used to
measure the distance to a given network. The best path to a network is the path with the
lowest metric.
Dynamic routing protocols typically use their own rules and metrics to build and update
routing tables. The following table lists common dynamic protocols and their metrics.