Lecture 02 (a)
Lecture 02 (a)
ROUTING
Routing Basics
• Routing is used for taking a packet from one device and sending it through the
network to another device on a different network
• It operates at Layer 3 (Network Layer) of the OSI model.
• Routers don’t really care about hosts, they only care about networks and the best
path to each network
• To be able to route packets, a router must know, at minimum, the following
i. Destination address
ii. Neighbor routers from which it can learn about remote networks
iii. Possible routes to all remote networks
iv. The best route to each remote network
v. How to maintain and verify routing information
Routing Basics
Role of Routers in Networking
i. Path Determination: Finds the best path to forward packets based on metrics
such as hop count, bandwidth, or delay.
ii. Packet Forwarding: Uses the routing table to determine the next hop for a
packet.
iii. Network Segmentation: Divides a network into multiple broadcast domains.
Routing Table
• A router maintains a routing table with the following information:
i. Destination Network: The network that the packet needs to reach.
ii. Next Hop: The next device to which the packet is sent.
iii. Metric: Value to measure the cost of the route (e.g., hop count).
iv. Administrative Distance (AD): Reliability of the route source.
Routing Basics
• The router learns about remote networks from neighbor routers or from an administrator.
• The router then builds a routing table that describes how to find the remote networks. If a
network is directly connected, then the router already knows how to get to it. If a network
isn’t connected, the router must learn how to get to the remote network in two ways:
i. Static Routing: meaning that someone must hand-type all network locations into the
routing table
ii. Dynamic Routing: a protocol on one router communicates with the same protocol running
on neighbor routers. The routers then update each other about all the networks they
know about and place this information into the routing table. If a change occurs in the
network, the dynamic routing protocols automatically inform all routers about the event.
• Typically, in a large network, a combination of both dynamic and static routing is used.
We also have, default routing which is used to send packets with a remote destination
network not in the routing table to the next-hop router. You can only use default routing on
stub networks—those with only one exit path out of the network .
Static Routing
• Static routing has the following benefits:
i. There is no overhead on the router CPU, which means you could possibly buy a cheaper
router than if you were using dynamic routing
ii. There is no bandwidth usage between routers, which means you could possibly save
money on WAN links
iii. It adds security, because the administrator can choose to allow routing access to certain
networks Only
• Static routing has the following disadvantages:
i. The administrator must really understand the internetwork and how each router is
connected in order to configure routes correctly
ii. If a network is added to the internetwork, the administrator has to add a route to it on
all routers—by hand
iii. It’s not feasible in large networks because maintaining it would be a full-time job in
itself
Static Routing
• here’s the command syntax you use to add a static route to a routing table:
ip route [destination_network] [mask] [next-hop_address or exitinterface]
[administrative_distance] [permanent]
• This list describes each command in the string:
• ip route The command used to create the static route.
• destination_network The network you’re placing in the routing table.
• mask The subnet mask being used on the network.
• next-hop_address The address of the next-hop router that will receive the packet and
forward it to the remote network. This is a router interface that’s on a directly connected
network.
• You must be able to ping the router interface before you add the route. If you type in the
wrong next-hop address, or the interface to that router is down, the static route will
show up in the router’s configuration, but not in the routing table.
Static Routing
• exitinterface You can use it in place of the next-hop address if you want, but it’s got to be on a
point-to-point link, such as a WAN. This command won’t work on a LAN such as Ethernet.
• administrative_distance By default, static routes have an administrative distance of 1 (or even 0 if
you use an exit interface instead of a next-hop address). You can change the default value by
adding an administrative weight at the end of the command. We’ll talk a lot more about this
subject later in the chapter when we get to the section on dynamic routing.
• permanent If the interface is shut down, or the router can’t communicate to the next-hop router,
the route will automatically be discarded from the routing table. Choosing the permanent option
keeps the entry in the routing table no matter what happens.
• Example: Router(config)#ip route 172.16.3.0 255.255.255.0 192.168.2.4
The ip route command tells us simply that it is a static route
172.16.3.0 is the remote network we want to send packets to
255.255.255.0 is the mask of the remote network
192.168.2.4 is the next hop, or router, we will send packets to
Default Routing
• When a router receives a packet for a destination subnet that’s not in the routing
table, it will drop the packet by default.
• If you’re using default routing, you must use the ip classless command because it
is possible that no remote subnets will be in the routing table
Dynamic Routing
• A routing protocol defines the set of rules used by a router when it
communicates routing information between neighbor routers
ROUTING PROTOCOLS
• There are three classes of routing protocols:
i) Distance vector: The distance-vector protocols find the best path to a remote
network by judging distance. Each time a packet goes through a router, that’s
called a hop.
• The route with the least number of hops to the network is determined to be the
best route.
• The vector indicates the direction to the remote network.
• Both RIP(Routing Information Protocol) and IGRP(Interior Gateway Routing
Protocol) are distance-vector routing protocols. They send the entire routing
table to directly connected neighbors.
Routing Protocols
• Distance-vector routing protocols keep track of any changes to the internetwork by broadcasting
periodic routing updates out all active interfaces
• Routing loops can occur because every router isn’t updated simultaneously, or even close to it
• One way of solving this problem is to define a maximum hop count. RIP permits a hop count of
up to 15, so anything that requires 16 hops is deemed unreachable
• Though this is a workable solution, it won’t remove the routing loop itself. Packets will still go into
the loop, but instead of traveling on unchecked, they’ll just whirl around for 16 bounces and die
• Another solution to the routing loop problem is called split horizon which reduces incorrect
routing information and routing overhead in a distance-vector network by enforcing the rule that
routing information cannot be sent back in the direction from which it was received
• Another way to avoid problems caused by inconsistent updates and stop network loops is route
poisoning which prevents routers from sending data packets over invalid routes
• When a router detects an invalid route, it informs other routers that the route is unreachable by
assigning it an infinite metric. For example, if the maximum hop count for a route is 15, the router
would change the hop count to 16.
Routing Protocols
• A hold-down prevents regular update messages from reinstating a route that is
going up and down (called flapping)
• Hold-downs prevent routes from changing too rapidly by allowing time for either
the downed route to come back up or the network to stabilize somewhat before
changing to the next best route.
Routing Information Protocol (RIP)
• Routing Information Protocol (RIP) is a true distance-vector routing protocol
• It sends the complete routing table out to all active interfaces every 30 seconds
• RIP version 1 uses only classful routing, which means that all devices in the
network must use the same subnet mask. This is because RIP version 1 doesn’t
send updates with subnet mask information in tow.
• RIP version 2 provides something called prefix routing, and does send subnet
mask information with the route updates. This is called classless routing
Routing Protocols
Interior Gateway Routing Protocol
• Interior Gateway Routing Protocol (IGRP) is a Cisco-proprietary distance-vector
routing protocol.
• This means that to use IGRP in your network, all your routers must be Cisco
routers.
• Cisco created this routing protocol to overcome the problems associated with RIP.
• IGRP has a maximum hop count of 255 with a default of 100. This is helpful in
larger networks and solves the problem of 15 hops being the maximum possible
in a RIP network.
• IGRP also uses a different metric than RIP.
• IGRP uses bandwidth and delay of the line by default as a metric for determining
the best route to an internetwork. This is called a composite metric.
Routing Protocols
Using Both RIP and IGRP?
• If you have both RIP (either version 1 or 2) and IGRP running in your network,
what you’re really accomplishing is wasting a bunch of bandwidth, CPU
processing, and router memory!
• There’s absolutely no benefit to running more than one routing protocol
Routing Protocols
ii) Link State: In link-state protocols, also called shortest-path-first protocols, the routers each create
three separate tables.
• One of these tables keeps track of directly attached neighbors, one determines the topology of
the entire internetwork, and one is used as the routing table.
• Link state routers know more about the internetwork than any distance-vector routing protocol.
• OSPF(Open Shortest Path First) is an IP routing protocol that is completely link state. Link state
protocols send updates containing the state of their own links to all other routers on the network.
iii) Hybrid: Hybrid protocols use aspects of both distance vector and link state—for example, EIGRP
(Enhanced Interior Gateway Routing Protocol)
There’s no set way of configuring routing protocols for use with every business. This is something
you really have to do on a case-by-case basis. If you understand how the different routing protocols
work, you can make good, solid decisions that truly meet the individual needs of any business
Routing Process
1.Packet Encapsulation: Data is encapsulated with a Layer 3 header containing the
source and destination IP.
2.Routing Decision: The router examines the destination IP and consults the
routing table.
3.Forwarding: Packet is sent to the next hop based on the best path.
Benefits of Routing
• Enables communication between different networks.
• Optimizes data transfer with the best available paths.
• Supports network scalability.
END