CCNA
IP Routing
Ali Mohammad Masoomi
ICT Department
ATVI
Routing
• Routing is the process that a router uses to forward
packets toward the destination network.
• A router makes this decision based on the destination
IP address
• There are two types of routing
• Static routing
• Dynamic routing
Ali Mohammad Masoomi
Static Routing
• In static routing the Administrator must add the
remote networks into the routing table of each router
manually.
• If any changes occurs in the network (a new network
is added or a network is removed) then the
administrator must update all the changes in all the
routers by hand.
• In large organization both static and dynamic routing
is used
Ali Mohammad Masoomi
Advantages of Static Routing
There is no overhead on the router CPU, which means you
could possibly buy a cheaper router than you would use if
you were using dynamic routing.
It adds security because the administrator can choose to
allow routing access to certain networks only.
It does not use more bandwidth between Routers
Ali Mohammad Masoomi
Disadvantages of Static Routing
The administrator must really understand the internetwork
and how each router is connected in order to configure routes
correctly.
If a network is added to the internetwork, the administrator
has to add a route to it on all routers—by hand.
Its not suitable for large networks.
Ali Mohammad Masoomi
Configuring Static Routes
• Routers do not need to configure static routes for their
own directly connected networks.
• We need to configure static routes for networks this
router needs to reach.
• We will need to configure static routes for the other
routers as well, as “routing information about a path
from one network to another does not provide routing
information about the reverse, or return path.”
Ali Mohammad Masoomi
6
Command for static routing
R(config)# ip route <destination-network> <subnet mask>
<next-hop IP address>
Or:
R(config)# ip route <destination-network> <subnet-mask>
<out going interface >
Ex:
R(config)# ip route 192.168.10.0 255.255.255.0 192.168.20.1
Or
R(config)# ip route 192.168.10.0 255.255.255.0 serial 2/0
Ali Mohammad Masoomi
Next hop
• Next hop IP address is the next device nearest IP address.
• For example in the below diagram when PC1 sends a message to PC2,
when the message reaches to Router1, Router1 has to forward it to
the next Router. The next router is Router2 and the nearest interface
of Router2 for the Router1 is F0/1 of Rotuer2 with ip address of
172.16.10.1. to forward packets Router1 sends the packet to
172.16.10.1. So 172.16.10.1 is the Next hop ip address when Router1
forwards packets toward 192.168.10.0 network.
PC1 PC2
Ali Mohammad Masoomi
Static Default Routes
This default route routes packets with destinations that do not
match any of the other routes in the routing table
It is a “gateway of last resort” that allows the router to forward
“destination unknown” packets out a particular interface
The default route is used only on stub routers.
Stub routers are those with only one exit path out of the
network.
R(config)# ip route 0.0.0.0 0.0.0.0 [next-hop ip address or Exit
interface]
Ali Mohammad Masoomi
Static Default Routes
Stub Router
Ali Mohammad Masoomi
Static Default Routes
Ali Mohammad Masoomi
Verifying a static route
• To verify a default route, use the following commands:
oshow run to make sure you typed it correctly
oshow ip route to make sure the router placed it in
the routing table.
R# show run
R# show ip route
Note: Show ip route command shows the routing table of
a router.
Ali Mohammad Masoomi
Demo / Task
Ali Mohammad Masoomi
• Considering below diagram configure static routing in R1, R2 and R3
such that communications between networks 192.168.1.0 ,
192.168.3.0 and 192.168.5.0 can take place.
• To make sure that the configurations are correctly done, ping PC1,
PC2 and PC3 from each other.
Ali Mohammad Masoomi
Solution:
first we configure R1:
• Two networks (192.168.1.0 and 192.168.2.0) are directly connected
to R1 (directly connected networks are known to a router and do not
need to be added in routing table manually) .
• In R1 we need to add 192.168.3.0, 192.168.5.0 and better to add
192.168.4.0 as well.
Ali Mohammad Masoomi
Solution:
R1:
R1> enable
R1# conf t
R1(config)# ip route 192.168.3.0 255.255.255.0 192.168.2.2
R1(config)# ip route 192.168.4.0 255.255.255.0 192.168.2.2
R1(config)# ip route 192.168.5.0 255.255.255.0 192.168.2.2
Ali Mohammad Masoomi
Solution:
R2:
• In R2 there are 3 networks directly connected which do need be
added to the routing table these are 192.168.2.0, 192.168.3.0 and
192.168.4.0
• In R2 two remote networks should be added in routing table they are
192.168.1.0 and 192.168.5.0.
R2> enable
R2# conf t
R2(config)# ip route 192.168.1.0 255.255.255.0 192.168.2.1
R2(config)# ip route 192.168.5.0 255.255.255.0 192.168.4.2
Ali Mohammad Masoomi
Outgoing interface.
In order for the router to forward
packets it should know whether the
Solution: next hop IP address or outgoing
interface.
R3: Here we specified outgoing interface for
R3> enable the specific network
R3# conf t
R3(config)# ip route 192.168.1.0 255.255.255.0 fa0/1
R3(config)# ip route 192.168.2.0 255.255.255.0 fa0/1
R3(config)# ip route 192.168.3.0 255.255.255.0 fa0/1
Ali Mohammad Masoomi
Troubleshooting static route
configuration
•Ping and traceroute should be used to test basic
connectivity.
•But before using ping and traceroute, it is a good idea
just to see if the physical interface is “up”.
•show interfaces
•show interface s1/0
•show interface fa0/0
•show ip interface brief
Version 3.1 Ali Mohammad Masoomi
Common uses for Static Routes
Static routes in the real-world
• Soon we will learn about dynamic routing protocols (RIP, etc.), where
routers can learn automatically about networks, without the manual
configuration of static routes.
• Does this mean that static routes are never used in the real-world?
• No! Static routes are used in conjunction with dynamic routing
protocols.
• It is common to use a static route where using a dynamic routing
protocols would have disadvantages or where it just not needed.
Ali Mohammad Masoomi
Common uses for Static Routes
10.1.1.1/24
ISP
ip route 172.16.0.0 255.255.0.0 10.1.1.2
10.1.1.2/24
ATVI
172.16.0.0/16
Static routes in the real-world (continued)
• In the example above, there is only one route, link, between ATVI’s network
and the ISP.
• When there is only a single route to a network, this is known as a stub
network.
• It is very common for the ISP to have a static route pointing to it’s customers’
networks, in this case ATVI Institute. Ali Mohammad Masoomi
Common uses for Static Routes
Default
10.1.1.1/24
ISP
ip route 172.16.0.0 255.255.0.0 10.1.1.2
10.1.1.2/24
ATVI
ip route 0.0.0.0 0.0.0.0 10.1.1.1 172.16.0.0/16
Static routes in the real-world (continued)
• What about ATVI and sending packets to the ISP – packets going to the
Internet?
• It is also common for customer networks to use a special kind of static route,
known as a default static route.
• for now we specify the network and mask as “0.0.0.0 0.0.0.0” (pronounced
“quad-zero”).
• This tells the router to forward all packets to this next-hop address (or exit
interface) that do not have an explicit route in the routing table.
Ali Mohammad Masoomi
Dynamic Routing
• Dynamic routing is when protocols are used to find networks
and update routing tables on routers. Though this is easier
than using static or default routing, but it’ll cost you in terms
of router CPU processes and bandwidth on the network links.
• Functions of routing protocols:
• Dynamically share information between routers.
• Automatically update routing table when topology changes.
• Determine best path to a destination
• The goal of a routing protocol is to build and maintain
the routing table.
Ali Mohammad Masoomi
Components of Routing Protocol
• Algorithm
• In the case of a routing protocol, algorithms are
used for facilitating routing information and best
path determination
• Routing protocol messages
• These are messages for discovering neighbors and
exchange of routing information
Ali Mohammad Masoomi
Classification of Routing Protocols
Routing
Protocols
IGP EGP
Distance
Link State Hybrid Ex: BGP
Vector
Ex: RIP, Ex: Ex:
IGRP OSPF EIGRP
Ali Mohammad Masoomi
Distance Vector Protocols
• They find the best path to remote network by judging
distance
• Each time a packet goes through Router, its called a HOP
• The route with the less number of HOP is called to be the
best path.
• They send the entire routing table to the directly
connected neighbors (called routing by Rumor).
• Both RIP and IGRP are distance vector protocols
• In RIP, If there are more than one link with the same HOP
count, then it does Load Balancing.
• RIP can Load Balance up to 6 Equal cost Links
Ali Mohammad Masoomi
Topology Changes (Distance Vector)
• Routing table updates take place when the topology
changes.
• Router to router (neighbor tells neighbor)
• Distance vector – each router sends its entire routing
table to neighbor table
Ali Mohammad Masoomi
Distance Vector Protocols
• The problem with such load balancing is:
Ali Mohammad Masoomi
Ali Mohammad Masoomi
Ali Mohammad Masoomi
Link-State Protocols
• Also called Shortest-Path-First (SPF), in which the
Router create three separate tables:
• One keeps track of directly connected neighbors
• One determines the topology of the entire internetwork
• One is used as the Routing table
• Link State sends updates containing the state of their
own link to all the routers in the internetwork.
• They Analyze incoming routing update messages, If the
message indicates that a network change has occurred,
the routing software recalculates routes and sends out
new routing update messages
• OSPF is pure link state protocol
Ali Mohammad Masoomi
Hybrid Protocol
• Hybrid uses the aspects of both link state and distance
vector
• EIGRP is an example for hybrid protocol
Ali Mohammad Masoomi
Comparison of Distance victor and
link state
• Distance vector
– incomplete view of network topology.
– Generally, periodic updates.
• Link state
– complete view of network topology is created.
– updates are not periodic.
Ali Mohammad Masoomi
Classification of Routing Protocols
• The IGP can also be classified into two categories as
follows:
• Class full routing protocols
– All networks have the same subnet mask
• Classless routing protocols
– All networks can have different subnet masks
Ali Mohammad Masoomi
Autonomous System
An autonomous system (AS) is a collection of routers
under a common administration such as a company or
an organization.
An AS is also known as a routing domain.
Autonomous Systems have an identifying number.
Version 3.1 Ali Mohammad Masoomi
Convergence
When all routers in an Internetwork are operating with the
same knowledge, the Internetwork is said to have
converged.
Fast convergence is desirable because it reduces the period
of time in which routers would continue to make incorrect
routing decisions.
In routers that use dynamic routing protocols, it is important
to have fast convergence because routers could make
incorrect forwarding decisions until the network has fully
converged.
A network has converged when the routers in the network
are operating with consistent routing knowledge and proper
packet forwarding can take place.
Version 3.1 Ali Mohammad Masoomi
Metric
• A numerical value used by a routing protocol to determine the
best path to a destination.
• It’s a calculated value used to determine the best path to a
destination
• The smaller the metric the better the path.
• Metric used for each routing protocol
– RIP - hop count
– IGRP & EIGRP - Bandwidth (used by default), Delay (used
by default), Load, Reliability and MTU
– OSPF – Cost, Bandwidth (Cisco’s implementation)
Ali Mohammad Masoomi
Metric
– Hop count - is the number of routers a packet
must travel through to get to its destination
– Bandwidth - is the data capacity of a link
Ali Mohammad Masoomi
Metric
Equal cost metric:
• Equal cost metric is a condition where a router has multiple paths to the
same destination that all have the same metric.
• To solve this situation, a router will use Equal Cost Load Balancing. This
means the router sends packets over the multiple exit interfaces listed in
the routing table.
Ali Mohammad Masoomi
Administrative Distance (AD)
• AD shows the trustworthiness (quality of being reliable) of
the routing information.
• Lower the administrative distance the more trustworthy the
information.
• If the router hears about a route to the same network from
more than one source it will use the administrative distance
to decide which route to put in the routing table.
• AD is a value between 0 and 255
Ali Mohammad Masoomi
Administrative Distance (AD)
Route Source Default AD Value
• Connected interface 0
• Static route 1
• EIGRP 90
• IGRP 100
• OSPF 110
• RIP 120
• External EIGRP 170
• Unknown 255 (this route will never be used)
Ali Mohammad Masoomi
Administrative Distance (AD)
• AD can be changed, what you saw in previous slide was the
default administrative, but you can change it.
• Lower numbers are preferred, just make it higher if you want
it to be a “backup” route.
• For example static route has AD of 1 by default. You change it
by specifying a value at the end of the entry as
R(config)# ip route 192.168.2.0 255.255.255.0 192.168.4.1 120
AD
Ali Mohammad Masoomi
Summary
• Routing Types:
Ali Mohammad Masoomi
43
k s
a n
T h
Ali Mohammad Masoomi 44