Routing Protocols and Algorithms
Routing Protocols and Algorithms
Pre-Final
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?
Scenario:
o The post office (router) decides the best route for your letter, just
like how routers forward data packets across different networks.
How It Works:
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).
How It Works:
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.
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:
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
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 Without a backup path, your data would not reach its destination,
causing a delay or loss of communication.
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
Final Result:
Key Takeaways:
Networking 1
Pre-Final
0.0.0.0/0
203.0.113.1 20 eth2
(default)
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
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.
o The data will leave through the eth0 interface (which is the
router's local network port).
o The data will go through the eth1 interface (another port on the
router).
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).
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.
o Static Routing:
Scenario:
Network Setup:
arduino
Networking 1
Pre-Final
CopyEdit
3. Routing Behavior:
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.
Breakdown:
1. IP Address: 192.168.1.0
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.
Here's a visualization:
o Host part: The last 8 bits (used for devices in the network)
In Summary:
"/24" means the first 24 bits of the IP address are used for the
network, leaving 8 bits for hosts.
Dynamic Routing:
Scenario:
Network Setup:
With dynamic routing, routers use routing protocols like RIP, OSPF,
or BGP to automatically discover routes and adjust when network
conditions change.
Key Concepts:
RIP is a simple dynamic routing protocol that uses hop count as its
metric.
RIP Behavior:
OSPF Behavior:
Networking 1
Pre-Final
BGP Behavior:
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.
2. How It Works:
3. Use Cases:
Networking 1
Pre-Final