0% found this document useful (0 votes)
27 views12 pages

Routing Protocols and Algorithms

The document discusses routing protocols and algorithms, focusing on the fundamentals of routing, including the roles of OSPF and BGP in network communication. It explains how routers use algorithms and protocols to determine the best paths for data packets, ensuring optimal performance and reliability through redundancy. Additionally, it contrasts static and dynamic routing, highlighting the advantages and disadvantages of each approach in network management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views12 pages

Routing Protocols and Algorithms

The document discusses routing protocols and algorithms, focusing on the fundamentals of routing, including the roles of OSPF and BGP in network communication. It explains how routers use algorithms and protocols to determine the best paths for data packets, ensuring optimal performance and reliability through redundancy. Additionally, it contrasts static and dynamic routing, highlighting the advantages and disadvantages of each approach in network management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Networking 1

Pre-Final

Routing Protocols and Algorithms

1. Routing Fundamentals

Routing is the process of selecting the best path for data packets to travel
across a network from a source to a destination. It is essential for efficient
communication in networks, including the internet and enterprise
infrastructures.

Key Concepts:

 What is Routing?

 Example: Routing in Action

 Scenario:

o Imagine you are in Manila and want to send a letter to a friend


in New York. You go to the post office, where workers decide the
best route for your letter to reach its destination.

 How This Relates to Routing:

 Routing Determines How Data is Forwarded Between


Networks:

o Your letter (data packet) needs to travel from Manila (your


network) to New York (destination network).

o The post office (router) decides the best route for your letter, just
like how routers forward data packets across different networks.

 Routers Use Algorithms and Protocols to Make Forwarding


Decisions:

o The post office follows predefined rules (routing algorithms) to


determine the fastest and most efficient route.

o If one route (e.g., via Hong Kong) is congested, an alternative


route (e.g., via Tokyo) might be chosen dynamically.

o Similarly, routers use protocols like OSPF or BGP to update and


select the best paths based on real-time conditions.

OSPF (Open Shortest Path First) and BGP (Border Gateway


Protocol) are routing protocols used by routers to determine
the best path for forwarding data in a network. Here’s a
breakdown of what each one is and how it works:

1. OSPF (Open Shortest Path First)

 Type: Interior Gateway Protocol (IGP)

 Purpose: OSPF is used within a single organization or network (i.e.,


autonomous systems) to dynamically route data.

 How It Works:

o OSPF uses a link-state algorithm to create a map of the


network topology. This map helps routers calculate the best path
to each destination.
Networking 1
Pre-Final

o Routers exchange information about their direct connections


(links) with other routers.

o The protocol calculates the shortest path to a destination using


algorithms like Dijkstra's algorithm.

Example:
If you're on a corporate network, OSPF might be used between
the routers to automatically discover the best paths for internal
traffic (e.g., between different departments' networks).

2. BGP (Border Gateway Protocol)

 Type: Exterior Gateway Protocol (EGP)

 Purpose: BGP is used to exchange routing information between


different autonomous systems (ASes), typically between ISPs
(Internet Service Providers) and large organizations. It’s the main
protocol that powers routing on the internet.

 How It Works:

o BGP uses a path vector protocol where each router keeps


track of the paths (series of networks) to reach other networks.

o BGP doesn't use metrics like hop count (as OSPF does) but uses
policy-based routing. This means BGP considers various
factors (such as network policies, the number of ASes involved,
and more) to determine the best path.

o BGP Peers (routers) exchange information about the routes they


know, helping the global internet choose the best routes for data.

Example:
When you access a website hosted in another country, BGP is
responsible for determining how data travels between different
networks to get you there. BGP helps ensure data gets routed
through the fastest or most reliable paths.

Summary:

 OSPF is used inside an organization’s network to find the best local


routes.

 BGP is used to exchange routing information between different


networks on the internet, helping data travel between ISPs and large
networks.

 Ensures Optimal Performance, Reliability, and Redundancy:

Scenario: Network Routing with Redundancy

Real-World Analogy:

o You are sending a letter (data) from New York to London, but
the main flight (network path) is delayed or canceled. The post
office (router) will immediately look for an alternative flight
Networking 1
Pre-Final

(another network path) to ensure that your letter reaches its


destination without significant delay.

 How This Relates to Networking (Redundant Paths in Routing):

o Network Path: Your data packets are sent from your computer
in New York to Google's server in London. Typically, this path
may go through several routers and network paths.

o Failure or Delay: Suppose a link in the network (e.g., a router


or cable) fails between two network segments, causing a delay or
failure to reach the destination.

o Redundancy in Action: Routers use dynamic routing


protocols (e.g., OSPF or BGP) to automatically detect this failure
and reroute the data via an alternative path.

Example Using OSPF (Dynamic Routing):

 Initial Path (Working Path):

o Your packet leaves New York and heads to Google’s server in


London via the network path:
Your Computer -> Router A -> Router B -> Router C -> Google
Server

o This path might involve several routers, and everything is


functioning normally.

 Path Failure (A Router or Link Down):

o Let's say Router B goes down due to a hardware failure or a link


failure between routers. Now, the data packet cannot pass
through Router B to reach the destination.

o Without a backup path, your data would not reach its destination,
causing a delay or loss of communication.

 Automatic Rerouting (Redundancy in Action):

o OSPF (or any dynamic routing protocol) detects that the path
through Router B is no longer available. It immediately
recalculates the network topology and finds an alternative route,
such as:
Your Computer -> Router A -> Router D -> Router C -> Google
Server

o This rerouting happens quickly and without any manual


intervention. The routers adjust their routing tables, ensuring
that data reaches its destination.

 Final Result:

o Even though the original route through Router B failed, the


packet still arrives at Google’s server via the new path through
Router D. The rerouting ensures optimal performance (data
still gets through), reliability (as it avoids the failed route), and
redundancy (there is a backup path).

 Key Takeaways:
Networking 1
Pre-Final

o Redundancy: Network paths are often built with multiple routes


to the destination. If one path fails, there is always another route
ready to carry the data.

o Dynamic Adjustment: Routers use protocols like OSPF, BGP,


and others to dynamically adjust to changes in the network and
ensure traffic continues flowing even in the face of failures.

o Optimal Performance and Reliability: These adjustments


ensure that data reaches its destination quickly and reliably,
without long delays or disruptions.

 Real-World Application (Internet Data Routing):

o When you visit www.google.com, your request travels through


multiple routers on the internet. Each router checks its routing
table and forwards your request through the best available path.
If a particular route is congested, the router dynamically selects
an alternative to ensure quick and reliable delivery.

 Introduction to Routing Tables and Path Determination:

o Routing Table: A data structure stored in a router that contains


information about available routes, including destination
networks, next-hop addresses, and metrics.

Simplified Routing Table Example:


Destination Metric Interfac
Next Hop
Network (Cost) e

192.168.1.0/2 Directly eth0


0
4 Connected (Local)

10.0.0.0/24 192.168.1.1 10 eth1

0.0.0.0/0
203.0.113.1 20 eth2
(default)

Routing Table Breakdown:

A routing table is like a list of directions that a router uses to figure


out where to send data. Each row in the table gives the router
information about how to reach a specific network.

Here’s what each column means:

1. Destination Network – This is the network the router is trying to


reach. It could be a local network or another network on the internet.

2. Next Hop – This is the next router or address the data should go to on
its way to the destination. It tells the router where to send the data
next.
Networking 1
Pre-Final

3. Metric (Cost) – This number tells the router how "expensive" it is to


take that route. Lower numbers usually mean better or faster paths.

4. Interface – This is the router's network port through which the data
will be sent. Routers can have multiple interfaces, like different "doors"
or connections to the network.

What Each Row Means:

1. 192.168.1.0/24 – Directly Connected – 0 – eth0 (Local):

o This is your local network. The router is directly connected to it


(no need to go through another router).

o The metric (cost) is 0, meaning it's the easiest and cheapest


path.

o The data will leave through the eth0 interface (which is the
router's local network port).

2. 10.0.0.0/24 – 192.168.1.1 – 10 – eth1:

o To reach the 10.0.0.0/24 network (e.g., another office or


building), the router needs to send the data to the next router,
which is 192.168.1.1.

o The metric (cost) is 10, meaning this path is more expensive


than the local path (i.e., it’s a further hop).

o The data will go through the eth1 interface (another port on the
router).

3. 0.0.0.0/0 (default) – 203.0.113.1 – 20 – eth2:

o The 0.0.0.0/0 is a catch-all rule. It means "any network that's


not listed above."

o If the router doesn't know where to send the data (i.e., it's not
part of the local network or the 10.0.0.0 network), it will send the
data to 203.0.113.1, which is another router, usually leading to
the internet.

o The metric (cost) is 20, meaning this is the least preferred path
(more expensive).

o The data will leave through the eth2 interface (yet another port
on the router).

How It Works in Practice:

 If a packet comes in (e.g., from your computer trying to reach


10.0.0.20), the router looks at its destination IP and checks the
routing table.

 The router will match 10.0.0.20 with 10.0.0.0/24 (the second row),
and know it needs to send the packet to the next router 192.168.1.1
through eth1.
Networking 1
Pre-Final

 If the packet doesn't match any specific network (e.g., it's going to a
different destination), the router will use the default route (the third
row), and send it to 203.0.113.1 through eth2.

Summary:

 The router uses this table to figure out the best path for any packet
based on its destination.

 "Next hop" is where the data goes next, and "metric" helps
determine how good that path is (lower is better).

 The router checks the destination, uses the routing table to find the
next hop, and forwards the data through the right interface.

 Difference Between Static and Dynamic Routing:

o Static Routing:

Scenario:

You are a network administrator at a small office. The network


consists of two routers and a few computers. The network
topology is simple and doesn't change often. You're tasked with
setting up static routing between these two routers so that
they can communicate with each other.

Static Routing Example:

Network Setup:

 Router 1: IP address: 192.168.1.1

 Router 2: IP address: 192.168.2.1

 Router 1’s network: 192.168.1.0/24

 Router 2’s network: 192.168.2.0/24

How Static Routing Works:

1. Manually Configuring Routes: As the network administrator, you


manually configure static routes on Router 1 and Router 2 to allow
them to communicate.

o On Router 1, you configure a static route to reach Router 2’s


network (192.168.2.0/24) via Router 2’s IP address
(192.168.2.1):

arduino
Networking 1
Pre-Final

CopyEdit

Router1(config)# ip route 192.168.2. | 0 255.255.255. | 0


192.168.2.1

This means: "To reach the 192.168.2.0/24 network, send


packets to 192.168.2.1."

o On Router 2, you configure a static route to reach Router 1’s


network (192.168.1.0/24) via Router 1’s IP address
(192.168.1.1):

Router2(config)# ip route 192.168.1.0 | 255.255.255.0 |


192.168.1.1

This means: "To reach the 192.168.1.0/24 network, send


packets to 192.168.1.1."

2. Why Static Routing is Suitable:

o Small Network: This setup is simple and efficient for a small,


stable network where changes don’t happen often. The two
routers always know exactly where to send data based on the
routes you configured.

o Manual Updates: If the network topology changes (for


example, you add another router or a new network), you must
manually update the static routes. For instance, if you add a
new router between Router 1 and Router 2, you would need to
modify the static routes on both routers to account for the new
hop.

3. Routing Behavior:

o When Router 1 receives a packet destined for the


192.168.2.0/24 network (i.e., a computer in Router 2’s
network), it looks at its routing table, sees the static route, and
forwards the packet to Router 2’s IP address (192.168.2.1).

o Similarly, Router 2 forwards packets to Router 1 using the


static route you configured.

Advantages of Static Routing:

 Simple: Easy to set up and manage in small networks.

 Low Overhead: There is no need for routing protocols, so


the routers do not have to exchange information
constantly.

 Predictable: The routes are fixed and don’t change unless


you manually update them.

Disadvantages of Static Routing:

 Manual Updates: If the network changes (like adding or


removing a router), you must manually update the routing
tables. This can become time-consuming in large networks.
Networking 1
Pre-Final

 Not Scalable: In larger networks with frequent changes,


managing static routes can become complex and error-
prone.

Real-World Example:

Let's say the small office has a server in Router 2’s network
(192.168.2.0/24), and Router 1 needs to reach it. You manually
configure the static route on Router 1 to direct traffic to Router
2. The route never changes unless you add or remove network
devices, and it is straightforward to manage because you know
exactly what is configured.

Summary of Static Routing:

 Manual Configuration: Routes are manually entered by


network administrators.

 Small, Stable Networks: Best suited for small networks


where the topology doesn’t change often.

 Manual Updates: When the network topology changes,


the administrator needs to manually update the routing
table.

The "/24" at the end of "192.168.1.0/24" represents the subnet


mask in CIDR (Classless Inter-Domain Routing) notation. It
specifies how many bits of the IP address are used to identify the
network part of the address and how many bits are available for the
host part.

Breakdown:

1. IP Address: 192.168.1.0

o This is the base IP address of the network.

2. Subnet Mask (/24):

o The "/24" means the first 24 bits of the IP address are used for
the network part, and the remaining bits (in this case, 8 bits)
are used for the host part.

o In a traditional IPv4 address, you have 32 bits (4 octets of 8


bits each). The /24 subnet mask means the first 24 bits are fixed
for identifying the network, and the remaining 8 bits are used to
identify individual devices (hosts) in that network.

How to Interpret /24:

 A /24 subnet mask is the same as the 255.255.255.0 subnet mask in


decimal form.

o 255.255.255.0 means the first 24 bits of the IP address are


used for the network part, and the last 8 bits are available for
hosts.
Networking 1
Pre-Final

Here's a visualization:

o Network part: 192.168.1 (the first 24 bits)

o Host part: The last 8 bits (used for devices in the network)

Example with a /24 Network:

 Network Address: 192.168.1.0/24

o This means 192.168.1.0 is the network address.

 Available Host Range: From 192.168.1.1 to 192.168.1.254.

o There are 256 addresses in total (from 192.168.1.0 to


192.168.1.255), but 192.168.1.0 is the network address and
192.168.1.255 is the broadcast address, so the usable
addresses for hosts range from 192.168.1.1 to 192.168.1.254.

In Summary:

 "/24" means the first 24 bits of the IP address are used for the
network, leaving 8 bits for hosts.

 192.168.1.0/24 represents a network that has IP addresses ranging


from 192.168.1.1 to 192.168.1.254, with a total of 256 possible
addresses (out of which 2 are reserved for the network and broadcast
addresses).

Dynamic Routing:

Scenario:

Imagine a large company with multiple office locations spread across


different cities. Each location is connected via different routes, and the
network is complex with many routers.

Dynamic Routing Example:

Network Setup:

 Router A connects to Router B and Router C.

 Router B connects to Router D, and Router C connects to Router


E.

 All routers are connected to different networks, and the company


wants them to communicate with each other without manual
intervention.

 Routers need to automatically adapt to network changes, such as if


a link goes down or if a new route is added.
Networking 1
Pre-Final

How Dynamic Routing Works:

With dynamic routing, routers use routing protocols like RIP, OSPF,
or BGP to automatically discover routes and adjust when network
conditions change.

Key Concepts:

 Routing Protocols: These are algorithms used by routers to


exchange routing information automatically.

 Network Conditions: Routers adjust routes based on factors like


network topology changes, traffic load, or link failures.

Example 1: Routing Information Protocol (RIP)

RIP is a simple dynamic routing protocol that uses hop count as its
metric.

How RIP Works:

 Router A is connected to Router B and Router C.

 Each router exchanges information about the best routes using


RIP.

 Initially, Router A knows it can reach Router C directly, but it


may also learn that it can reach Router D via Router B.

RIP Behavior:

 If Router A wants to send data to Router D, it will check its


routing table. If Router A learns that Router B has a better
route to Router D (via RIP), it will choose Router B as the next
hop.

 If the link between Router B and Router D goes down, Router


A will detect this change and update its routing table to route
traffic via Router C.

Example 2: Open Shortest Path First (OSPF)

OSPF is a more advanced dynamic routing protocol that uses link-


state information and is commonly used in larger, more complex
networks.

How OSPF Works:

 OSPF routers constantly share information about the state of


their links (interfaces).

 When a router learns that a link is down, it recalculates the best


route and shares this information with other routers.

OSPF Behavior:
Networking 1
Pre-Final

 If Router A loses connection to Router B, Router A will send


an update to all other routers in the network, saying that Router
B is no longer reachable.

 Router A will then use Router C as the next hop to reach


Router D, since it will have learned about the updated network
topology through OSPF.

This automatic adjustment and recalculation of routes are what make


OSPF a powerful tool for dynamic routing in large networks.

Example 3: Border Gateway Protocol (BGP)

BGP is used for inter-domain routing, meaning it is used between


different organizations or Autonomous Systems (AS). It is the protocol
that controls how data is routed across the internet.

How BGP Works:

 Router A at your company connects to an Internet Service


Provider (ISP) router via Router B.

 BGP enables routers to exchange routing information based on


policies, such as preferred routes, traffic capacity, and security
preferences.

BGP Behavior:

 If Router A cannot reach the internet via Router B due to a


failure or congestion, it can automatically adjust and use a
different route (through Router C).

 BGP will advertise the best route based on the AS path and
prefix of available routes, helping Router A make decisions on
the most efficient way to send data to external networks.

Summary of Dynamic Routing:

1. Dynamic Routing Protocols:

o RIP (Routing Information Protocol): Simple, uses hop


count, good for smaller networks.

o OSPF (Open Shortest Path First): More efficient, uses link-


state, works better for larger, more complex networks.

o BGP (Border Gateway Protocol): Used for routing between


different networks (Autonomous Systems), crucial for internet
routing.

2. How It Works:

o Routing protocols allow routers to automatically adjust their


paths based on network changes.

o For instance, if a router detects a link failure, it will find a new


route without needing manual configuration.

3. Use Cases:
Networking 1
Pre-Final

o RIP: Small networks where simplicity is preferred.

o OSPF: Larger networks requiring more efficient and faster


convergence.

o BGP: Connecting multiple networks, especially across the


internet.

Advantages of Dynamic Routing:

 Automatic Updates: If a link fails, routers automatically find a new


route.

 Scalability: Dynamic routing adapts to large, changing networks.

 Flexibility: Supports complex, multi-router networks and policy-


based routing.

You might also like