0% found this document useful (0 votes)
21 views26 pages

HCIA Domain 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views26 pages

HCIA Domain 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

4.

Network Layer Protocol and


IP Addressing

1. Overview of the Network Layer


The Network Layer, also referred to as the IP layer, is a fundamental layer
in the TCP/IP and OSI models responsible for routing packets from the
source to the destination across different networks.

Its main protocol is the Internet Protocol (IP), which is divided into two
versions: IPv4 and IPv6.

IPv4 (Internet Protocol version 4) is the most widely used, but the transition
to IPv6 (Internet Protocol version 6) is ongoing due to IPv4 address
exhaustion.

Unless specified otherwise, discussions on IP addresses usually refer to


IPv4.

2. Functions of the Internet Protocol (IP)


The Internet Protocol provides:

Logical Addresses: Assigns logical addresses (IP addresses) to devices at


the network layer, allowing devices to communicate across networks.

Packet Forwarding: Routes and forwards data packets from the source to
the destination.

3. Data Encapsulation Process


Data sent over a network must be encapsulated through various layers of
the TCP/IP stack.

Each layer adds its own header to form a Protocol Data Unit (PDU):

At the Transport Layer, a TCP header is added, and the PDU is called a
segment.

At the Network Layer, an IP header is added, creating an IP packet.

4. Network Layer Protocol and IP Addressing 1


At the Data Link Layer, a frame header and trailer are added, resulting in a
frame.

Finally, the frame is converted to bits for transmission over the physical
network.

This encapsulation process ensures that the data is correctly formatted for
transmission and reception through the network.

4. IPv4 Packet Format


An IPv4 packet header contains several fields with specific purposes:

1. Version: Indicates the IP version (4 for IPv4 or 6 for IPv6). It is 4 bits


long.

2. Header Length: Specifies the length of the header. If no options are


present, the default length is 20 bytes, with a maximum of 60 bytes.

3. Type of Service (ToS): An 8-bit field that specifies the quality of service
(QoS) for differentiated services, used in prioritizing traffic.

4. Total Length: A 16-bit field representing the total length of the IP packet,
including both the header and data.

5. Identification: Used for reassembling fragmented packets; it’s 16 bits


long.

6. Flags: 3 bits used for fragment control:

Reserved Fragment: 0 (reserved).

Don't Fragment (DF): Value 1 indicates that fragmentation is not


allowed; 0 indicates fragmentation is allowed.

More Fragment (MF): Value 1 indicates more fragments are


following; 0 indicates it’s the last fragment.

7. Fragment Offset: A 12-bit field indicating the relative position of a


fragment in the original packet. This helps the receiver reassemble
fragmented packets.

8. Time to Live (TTL): Specifies how many hops (routers) a packet can
pass through before being discarded. Each router reduces the TTL value
by 1. When the TTL reaches 0, the packet is discarded to prevent routing
loops.

4. Network Layer Protocol and IP Addressing 2


4.1 Data Packet Fragmentation
When an IP packet’s size exceeds the maximum transmission unit (MTU) of
a network segment, it must be fragmented to fit within the allowed size.

The fragmentation fields in the IP header help identify and reassemble


these fragments:

Identification: Each packet is assigned a unique ID by the sender to


help reassemble fragments at the destination.

Flags: Control fragmentation behaviour:

DF (Don’t Fragment): If set, fragmentation is not allowed.

MF (More Fragments): If set, indicates more fragments are


expected.

Fragment Offset: Indicates the position of each fragment relative to the


original packet.

4.2 Time to Live (TTL)


TTL is an 8-bit field in the IP header that specifies the maximum number of
hops a packet can traverse through routers before it gets discarded:

Each router the packet passes through reduces the TTL value by 1.

If TTL reaches 0, the packet is dropped, and an ICMP (Internet Control


Message Protocol) error message is sent back to the source (unless ICMP
is disabled).

This mechanism prevents routing loops and network congestion.

4.3 Protocol Field


The Protocol field in the IP header indicates which upper-layer protocol
should handle the packet once it reaches its destination.

Examples of protocol values include:

TCP (0x06): Transmission Control Protocol.

UDP (0x11): User Datagram Protocol.

ICMP (0x01): Internet Control Message Protocol.

The destination device uses this field to determine how to process the packet
at the network layer.

4. Network Layer Protocol and IP Addressing 3


5. What Is an IP Address?
An IP address (Internet Protocol address) is a numerical label assigned to
each device connected to a computer network that uses the Internet
Protocol for communication.

It serves two primary functions:

Identification: Identifies a device (or interface) on a network.

Location Addressing: Helps route and forward data packets across


networks.

When connecting a device (like a computer) to the Internet, an IP address is


assigned to the device’s interface to enable global communication.

Each interface on a device (e.g., router or computer) requires its own IP


address, meaning a device with multiple interfaces (like a router) will have
multiple IP addresses.

6. IPv4 Address Notation


IPv4 addresses are 32 bits long and are usually written in dotted decimal
notation for ease of reading and configuration. Here's what that means:

An IPv4 address consists of 4 bytes (8 bits each) separated by dots, e.g.,


192.168.0.1.

The address range for IPv4 is 0.0.0.0 to 255.255.255.255.

7. IPv4 Address Structure


An IPv4 address is divided into two parts:

Network Part (Network ID): Identifies the specific network to which a host
belongs. Devices with the same network ID are part of the same network,
regardless of their physical location.

Host Part (Host ID): Differentiates devices within the same network.

7.1 Network Mask (Subnet Mask)


A network mask (or subnet mask) is also a 32-bit number that divides the
network and host parts of an IP address.

4. Network Layer Protocol and IP Addressing 4


It is also written in dotted decimal notation, similar to an IP address (e.g.,
255.255.255.0).

It consists of consecutive 1s (network part) followed by consecutive 0s


(host part). For example:

255.255.255.0 (binary: 11111111.11111111.11111111.00000000) represents


24 bits for the network and 8 bits for the host.

The number of 1s indicates the network portion, while the number of 0s


represents the host portion.

7.2 IP Addressing
The Network ID specifies the network segment (similar to a neighbourhood
address), while the Host ID specifies the individual device within that
segment.

Devices on the same network segment share the same network ID but have
different host IDs.

7.3 Gateways
Gateway: A gateway is a network device (usually a router) that forwards
data packets between different network segments. If the source and
destination devices are on different network segments, the gateway
forwards the packets to the appropriate segment.

8. IP Address Classification (Classful Addressing)


IPv4 addresses are divided into classes for easier management and allocation:

Class A: Network ID is 8 bits, allowing for a few large networks with many
hosts (0.0.0.0–127.255.255.255).

Class B: Network ID is 16 bits, allowing for medium-sized networks


(128.0.0.0–191.255.255.255).

Class C: Network ID is 24 bits, supporting a large number of smaller


networks (192.0.0.0–223.255.255.255).

Class D: Reserved for multicast addresses (224.0.0.0–239.255.255.255).

Class E: Reserved for experimental purposes (240.0.0.0–255.255.255.255).

Classes A, B, and C are the primary classes used for unicast addresses.

4. Network Layer Protocol and IP Addressing 5


9. IP Address Types
Network Address: Identifies the network segment (e.g., 192.168.1.0 for a
network with a subnet mask of 255.255.255.0).

Broadcast Address: A special address that targets all hosts in the network
segment (e.g., 192.168.1.255).

Available Addresses: IP addresses within a network that can be assigned


to devices. To calculate these:

If there are n bits for the host part, the number of IP addresses is 2^n.

The number of available IP addresses is 2^n - 2, as the network address


and broadcast address are not assignable.

9.1 Private vs. Public IP Addresses


Public IP Address: Assigned by the Internet Assigned Numbers Authority
(IANA) and used for devices that connect directly to the Internet.

Private IP Address: Reserved for internal networks that do not connect


directly to the Internet. These addresses allow multiple devices within a
private network to use the same range without conflicts.

Examples:

Class A: 10.0.0.0/8

Class B: 172.16.0.0–172.31.255.255/12

Class C: 192.168.0.0–192.168.255.255/16

Network Address Translation (NAT): A method to allow devices with


private IP addresses to communicate with the Internet by translating private
addresses to public ones.

9.2 Special IP Addresses


255.255.255.255: Limited broadcast address; routers do not forward
packets with this address.

0.0.0.0: Represents any network; used by devices that don’t yet have an IP
address to send DHCP requests.

4. Network Layer Protocol and IP Addressing 6


127.0.0.0/8: Loopback address; used for testing and diagnostics within a
device. Packets sent to a loopback address never leave the device.

169.254.0.0/16: APIPA (Automatic Private IP Addressing) range; used when


a device cannot obtain an IP address through DHCP.

10. IPv4 vs. IPv6


IPv4:

Address Length: 32 bits.

Address Types: Unicast, broadcast, and multicast.

Characteristics: Limited address space, ARP dependency, and


inefficient header design.

IPv6:

Address Length: 128 bits.

Address Types: Unicast, multicast, and anycast (no broadcast).

Characteristics: Vast address space, simplified headers, and automatic


address configuration.

11. Subnetting
Classful Addressing Limitations:

In classful addressing (Classes A, B, C), the division of IP addresses is


rigid and often too large for many networks.

This results in wasted IP addresses because the number of host IDs


exceeds the requirements of the network.

Subnetting:

To solve this problem, subnetting is used.

It allows dividing a larger network into smaller sub-networks (subnets)


using a Variable Length Subnet Mask (VLSM).

This makes IP address usage more efficient:

IP addresses are allocated precisely according to the number of hosts


needed.

4. Network Layer Protocol and IP Addressing 7


Each subnet forms a separate broadcast domain, which reduces
network congestion and makes network planning more flexible.

11.1 Subnetting - Analyzing the Original Network Segment


Let’s take an example of a Class C network: 192.168.10.0. By default, the
subnet mask for a Class C network is 255.255.255.0, which is /24 in CIDR
(Classless Inter-Domain Routing) notation. This means:

The first 24 bits are for the network part.

The remaining 8 bits are for the host part.

With 8 host bits, the network can accommodate 2^8 = 256 IP addresses
(including the network address and broadcast address).

11.2 Subnetting - Taking Bits from the Host Part


How Subnetting Works:

Subnetting involves borrowing bits from the host part of the address to
create additional subnets.

By borrowing these bits, the network portion of the IP address is


expanded, and the number of hosts per subnet is reduced.

Example:

If we take 1 bit from the host part of the Class C network (originally 24
network bits), the network part becomes 25 bits, and the host part is
reduced to 7 bits.

The new subnet mask is 255.255.255.128 (or /25). This indicates that
the network part now has 25 bits.

With this 1-bit split, we get:

2 subnets because the borrowed bit can either be 0 or 1.

The two subnets are:

Subnet 1: 192.168.10.0/25 (subnet bit = 0)

Subnet 2: 192.168.10.128/25 (subnet bit = 1)

Each subnet has 128 addresses (2^7 = 128) because there are now 7 host bits.

11.3 Calculating the Subnet Network Address

4. Network Layer Protocol and IP Addressing 8


The network address of each subnet is determined by setting all host bits
to 0.

For Subnet 1 (subnet bit = 0):

Network address: 192.168.10.0/25.

For Subnet 2 (subnet bit = 1):

Network address: 192.168.10.128/25.

11.4 Calculating the Subnet Broadcast Address


The broadcast address of each subnet is found by setting all the host bits
to 1.

For Subnet 1 (subnet bit = 0):

Broadcast address: 192.168.10.127/25.

For Subnet 2 (subnet bit = 1):

Broadcast address: 192.168.10.255/25.

12. ICMP
ICMP is a protocol used in the Network Layer of the IP suite.

It is designed to assist the IP protocol by providing error reporting and


control messaging capabilities between network devices (routers, hosts,
etc.).

It is not used for carrying user data but for providing feedback about issues
encountered in the network during packet transmission. This feedback
helps improve packet forwarding efficiency.

12.1 ICMP Messages


ICMP messages are encapsulated within IP packets.

When the Protocol field in an IP packet header has a value of 1, it indicates


an ICMP message.

ICMP messages vary in format based on their Type and Code fields:

Type: Indicates the type of ICMP message (e.g., Echo Request,


Destination Unreachable).

4. Network Layer Protocol and IP Addressing 9


Code: Provides additional information relevant to the message type
(e.g., reason for a Destination Unreachable message).

Checksum: Ensures message integrity. It verifies that the message has not
been corrupted during transmission.

Variable Field: A 32-bit field used for additional information:

In Redirect messages, it indicates the IP address of the gateway to


which the host should send packets.

In Echo Request/Reply messages, it contains identifiers and sequence


numbers to match replies to requests.

12.2 ICMP Redirection


ICMP Redirect messages are control messages used when a better route
exists for the packet’s destination.

ICMP Redirection Process:

1. Host A wants to communicate with Server A and sends packets to its


default gateway, RTB.

2. RTB checks the routing table and realizes that a better route exists
through another router, RTA, which is on the same network segment as
Host A.

3. RTB sends an ICMP Redirect message to Host A, instructing it to send


future packets directly to RTA instead of RTB.

4. Host A updates its routing information and sends subsequent packets to


RTA, which then forwards the packets to Server A.

This process helps optimize routing paths and reduces unnecessary hops
in the network.

12.3 ICMP Echo Messages (Ping)


ICMP Echo and Echo Reply messages are used to check network
connectivity. A common application using ICMP Echo messages is ping.

Ping is a utility that sends ICMP Echo Request messages to a target host
and waits for Echo Reply messages. It measures:

Connectivity: Confirms if the target host is reachable.

4. Network Layer Protocol and IP Addressing 10


Round-Trip Time (RTT): Calculates the time it takes for packets to travel
from the source to the destination and back.

Parameters in a ping command include:

The size of ICMP messages.

The number of ICMP messages to be sent.

Timeout duration (time to wait for a reply).

12.4 ICMP Error Reporting


ICMP defines several types of error messages to help diagnose network
connectivity issues. Examples include:

Destination Unreachable: Indicates that the network or host is


unreachable. This message has several codes, such as:

Network Unreachable: The network is not accessible.

Host Unreachable: The host on the target network cannot be


reached.

TTL Exceeded (Time-to-Live): Sent when a packet’s TTL value reaches


0, indicating the packet has looped or travelled too far in the network.

Traceroute (Tracert) is another application using ICMP to check the


reachability of each hop in a network path.

It works by:

1. Setting the TTL value to 1 in the IP packet and sending it to the


destination.

2. The first router decrements the TTL, finds it has reached 0, and sends
an ICMP TTL Timeout message back to the source.

3. The source increments the TTL to 2 and sends another packet, and the
process repeats, revealing each hop along the path.

4. By analyzing the returned ICMP messages, the source can map out the
path to the destination and calculate the round-trip time for each hop.

4. Network Layer Protocol and IP Addressing 11


5. IP Routing Basics

1. Inter-Subnet Communication and IP Addressing


IP Address: It uniquely identifies a node (like a computer or network
device) on a network.

Each IP address is associated with a specific subnet, and these subnets


may be spread across different areas of a network or even globally.

Subnets and Communication: For different subnets to communicate,


network devices must forward IP packets between them. This is essential
for global networks where subnets are distributed widely.

2. Routes and Routing Devices


Routes: Routes are the paths or information that guide how packets should
be forwarded across a network.

Routing Devices: These are network devices, such as routers, that use
routing information to forward packets to the correct destination subnet.

IP Routing Table: Routers maintain a table (IP routing table) that stores all
the necessary routes and determines how packets are forwarded. It
includes information like the destination subnet, outbound interface, and
next-hop address.

3. Routing Information Components


A route contains several pieces of information:

Destination: Specifies the destination subnet.

Mask: Identifies the subnet when combined with the destination IP


address.

Outbound Interface: The router’s interface through which the packet will
exit.

Next Hop: The address of the next device the packet should be
forwarded to.

5. IP Routing Basics 1
4. IP Routing Table and Route-Based Forwarding
IP Routing Table: It’s a collection of routing entries that the router uses to
forward packets. The table contains only the best or optimal routes, not all
possible routes.

Route-Based Forwarding: When a router receives an IP packet, it looks at


the destination IP address and matches it to a route in its table to determine
the next hop and outbound interface.

5. Types of Routes
Direct Routes: Automatically generated by the router for subnets directly
connected to its interfaces. When an IP packet matches a direct route, the
router directly forwards the packet to the destination host using ARP entries
(Address Resolution Protocol) to resolve the MAC address.

Static Routes: Manually configured by network administrators for more


control over traffic paths.

Dynamic Routes: Learned through dynamic routing protocols like OSPF


(Open Shortest Path First), IS-IS (Intermediate System to Intermediate
System), or BGP (Border Gateway Protocol).

6. Optimal Route Selection


The router selects the optimal route based on the following:

Preference: Each routing protocol has a default preference value. A


lower value indicates a higher preference.

Cost (Metric): When multiple routes from the same protocol exist, the
router uses the route with the lowest cost as the optimal one.

For example, a static route may have a preference value of 60, while an
OSPF route may have a preference of 10. If both routes exist for the same
destination, the router will prefer the OSPF route due to its higher
preference (lower value).

7. Longest Matching Route Mechanism

5. IP Routing Basics 2
When a router receives an IP packet, it uses the longest matching
mechanism.

It compares the packet's destination IP address with all entries in the


routing table and selects the entry that matches the longest bit pattern.

This ensures that the router chooses the most specific route available for
forwarding.

8. Direct Route Details


Direct routes point to subnets that are directly connected to a router’s
interface.

When using a direct route, the router checks its ARP table to find the MAC
address corresponding to the destination IP address and forwards the
packet directly.

Not all direct routes are installed in the routing table; only those interfaces
that are physically and protocol-wise up are included.

9. Routing Table Fields


Each entry in the routing table includes:

Destination/Mask: Specifies the network address and subnet mask.

Protocol: Indicates the protocol that discovered the route (e.g., OSPF, BGP).

Preference: The preference value for selecting among routes from different
protocols.

Cost (Metric): The cost associated with the route for selecting among
routes from the same protocol.

Next Hop: The IP address of the next device to which the packet should be
forwarded.

Interface: The router’s outbound interface used to send the packet.

10. Default Routes


Definition: A default route is used when a router doesn’t have a specific
route for a destination in its IP routing table. It acts as a "catch-all" route for

5. IP Routing Basics 3
any IP packets that don’t match any other routing entries.

Format: The default route is represented as 0.0.0.0/0 in IPv4. It means that


if no other route matches, this route is used.

Application Scenarios: Default routes are typically used at the egress (exit)
points of networks, such as the edge routers of an enterprise network. For
instance, an egress router in an enterprise might have a default route
pointing to the ISP, allowing the router to forward traffic destined for any
external network.

11. Dynamic Routing Overview


Static Routes: These are manually configured and do not adapt
automatically to network changes. Any change in the network topology
requires manual updates, which is not feasible for large networks.

Dynamic Routing: Dynamic routing protocols automatically adjust to


changes in the network topology, making them suitable for networks with
many routers and subnets.

12. Classification of Dynamic Routing Protocols


Dynamic routing protocols are classified based on their algorithm and
application scope:

A. By Algorithm
Distance-Vector Routing Protocols: These use distance (hop count) and
direction (next hop) to determine the best route. Examples:

RIP (Routing Information Protocol): Uses hop count as the metric.

Link-State Routing Protocols: These maintain a map of the network’s


topology and determine the shortest path based on various metrics.
Examples:

OSPF (Open Shortest Path First)

IS-IS (Intermediate System to Intermediate System)

Path-Vector Protocol: BGP (Border Gateway Protocol) uses this algorithm.


It’s a modification of distance-vector and is used for inter-AS (Autonomous
System) routing.

5. IP Routing Basics 4
B. By Application Scope
Interior Gateway Protocols (IGPs): Operate within a single AS. Examples
include RIP, OSPF, and IS-IS.

Exterior Gateway Protocols (EGPs): Operate between different ASes. BGP


is the most commonly used EGP.

13. Advanced Routing Features


A. Route Recursion
Route recursion involves determining the next-hop address based on the
routing table until the final destination subnet is reached. It allows routers to
resolve a route recursively when it points to another route in the table.

B. Equal-Cost Multi-Path (ECMP) Routing


Equal-Cost Routes: When multiple routes to the same destination have the
same cost, routers can use all valid routes simultaneously to balance the
load across these paths. This is called load balancing and improves
network performance and redundancy.

C. Floating Routes
Floating Routes: These are backup routes that only become active when
the primary route fails. They are configured with a higher preference value
(lower priority) than the primary route.

5. Route Summarization and CIDR


A. CIDR (Classless Inter-Domain Routing)
Concept: CIDR uses variable-length subnet masks (VLSM) instead of the
fixed class-based addressing (Class A, B, C). CIDR allows more efficient
use of IP addresses and enables route summarization, reducing the number
of routing entries in the table.

Application: CIDR is used to group continuous IP addresses into


summarized routes, minimizing the IP routing table size.

B. Route Summarization

5. IP Routing Basics 5
Overview: It is a technique where specific routes with the same prefix are
aggregated into a single summarized route. This reduces the number of
entries in the routing table and improves device resource utilization.

Example: If a router has routes to 10.1.1.0/24 , 10.1.2.0/24 , and 10.1.3.0/24


with the same next hop, these routes can be summarized into one entry
(e.g., 10.1.0.0/22 ), reducing the table size.

6. Problems and Considerations in Route


Summarization
A. Routing Loops
Route summarization, if not done accurately, can cause routing loops.
Routing loops occur when packets are forwarded in circles due to incorrect
or ambiguous route information.

B. Black-Hole Routes
When summarizing routes, the router might use a Null0 interface as the
outbound interface. The Null0 interface is a logical interface that discards
packets, preventing them from being forwarded further. This is used to
prevent routing loops by acting as a "black hole" where packets are
dropped.

C. Accurate Route Summarization


To avoid issues like routing loops or traffic misdirection:

Ensure that the summary route covers only the intended specific routes
and does not include any unrelated routes.

Example: If summarizing routes from 172.16.1.0/24 to 172.16.31.0/24 ,


make sure the summarized route only includes these segments and not
extra ones.

By ensuring accurate summarization, you can optimize the routing table without
causing packet loss or misrouting.

5. IP Routing Basics 6
6. OSPF Basics

1. Dynamic Routing Protocols Classification


Dynamic routing protocols are categorized based on how they operate, and
they can be broadly classified into three categories:

1. Distance-Vector Routing Protocols (e.g., RIP, EIGRP)

2. Link-State Routing Protocols (e.g., OSPF, IS-IS)

3. Path-Vector Routing Protocols (e.g., BGP)

1.1 Distance-Vector Routing Protocols


Operation:

Routers periodically share information (routing tables) with their directly


connected neighbours.

The information typically includes the destination network and the cost
(usually measured in hops or another metric) to reach it.

Routers only know the direction (vector) and distance (cost) to a


destination, not the entire network topology.

Drawbacks:

Convergence (the time it takes for routers to update their routing tables)
can be slow.

Prone to routing loops; protocols like RIP use techniques such as split
horizon and count to infinity to mitigate these problems.

1.2 Link-State Routing Protocols


Operation:

Instead of broadcasting the entire routing table, routers running link-


state protocols (e.g., OSPF and IS-IS) send information about the status
of their directly connected links and interfaces, known as Link-State
Advertisements (LSAs).

Each router generates its LSAs, which include details such as:

6. OSPF Basics 1
The cost associated with the interface.

Neighbor relationships.

These LSAs are flooded throughout the network, ensuring that every
router in the network has the same view of the network topology.

1.3 Path-Vector Routing Protocols (e.g., BGP)


Operation:

BGP uses a modified form of distance-vector known as the path-vector


algorithm.

Instead of just sharing distance information, BGP also includes the path
(i.e., the sequence of AS hops) to reach a destination network.

This information helps prevent routing loops in large, diverse networks


like the internet.

2. Link-State Routing Protocol Process:


1. Neighbor Establishment:

Routers first establish neighbor relationships with directly connected


routers. This allows them to exchange and synchronize link-state
information.

2. LSA Flooding:

Routers exchange LSAs with their neighbours to build a consistent view


of the network.

All routers maintain a database called the Link-State Database (LSDB),


which stores these LSAs and describes the entire network topology.

3. Shortest Path First (SPF) Calculation:

Routers use the LSDB to calculate the shortest paths to each


destination. The algorithm used for this is Dijkstra's Shortest Path First
(SPF) algorithm.

The SPF algorithm calculates a loop-free tree with the router itself as
the root, ensuring the most efficient routes are identified.

4. Routing Table Generation:

6. OSPF Basics 2
Based on the SPF calculation, each router generates and updates its
routing table, installing the best routes to all networks within the
topology.

Advantages:

Fast convergence: Because routers have a complete view of the


network topology, they can quickly react to changes.

Scalability: Link-state protocols are more efficient and scalable in larger


networks.

3. Introduction to OSPF (Open Shortest Path First)


OSPF is a widely used link-state routing protocol and a standard Interior
Gateway Protocol (IGP) in the industry.
It exists in two main versions:

OSPFv2 (RFC 2328) for IPv4

OSPFv3 (RFC 2740) for IPv6

OSPF routers exchange link status information rather than routes, which is
crucial for building the network topology and calculating optimal paths.

3.1 Key Concepts of OSPF:


1. Link Status Information:

OSPF routers collect and store link status information in the Link-State
Database (LSDB).

Routers use this information to understand the topology of their area


and calculate loop-free paths using the SPF (Shortest Path First)
algorithm.

2. Areas:

An area is a logical grouping of networks and routers, identified by an


Area ID.

OSPF areas help divide a large network into smaller, manageable


segments.

OSPF supports a multi-area design, allowing for scalability and efficient


routing in larger networks.

6. OSPF Basics 3
3. Router ID:

The Router ID uniquely identifies a router within an OSPF area. It can be


manually configured or automatically assigned based on the IP address
of a router’s interface, typically a Loopback interface.

It's important to ensure that each OSPF router within an area has a
unique Router ID.

4. Cost Values:

OSPF uses cost as a metric to determine the best route. The cost is
calculated based on the interface bandwidth:

DefaultCost = (100Mbit/s)/(InterfaceBandwidth)

The reference value of 100 Mbps is configurable. Each OSPF-enabled


interface calculates its cost based on the bandwidth.

3.2 OSPF Packet Types


OSPF uses five different packet types for interaction between routers:

1. Hello: Periodically sent to discover and maintain neighbor relationships.

2. Database Description (DD): Provides a summary of the router's local


LSDB, used to synchronize LSDBs between neighbours.

3. Link State Request (LSR): Requests specific LSAs from a neighbor after
DD packets have been exchanged.

4. Link State Update (LSU): Sends requested LSAs to a neighbor.

5. Link State Acknowledgment (LSAck): Acknowledges the receipt of


LSAs.

3.3 OSPF Tables


OSPF maintains three key tables:

1. OSPF Neighbor Table:

This table stores information about OSPF neighbor relationships


established using Hello packets.

You can view the neighbor table using the display ospf peer command,
which shows router IDs and interface addresses of neighbours.

6. OSPF Basics 4
2. Link-State Database (LSDB):

The LSDB contains LSAs generated by the router itself and received
from neighbours.

It provides detailed information about the network’s topology, including


LSA types and the router that advertised each LSA.

The command display ospf lsdb allows you to query the LSDB and view
these details.

3. OSPF Routing Table:

This table is separate from the overall router's routing table and
contains OSPF-specific routes.

It includes details like the destination IP address, cost, and next-hop IP


address for routing decisions.

The command display ospf routing displays the OSPF routing table,
showing routes learned through OSPF.

3.4 OSPF Multi-Area Design


OSPF’s multi-area design divides a large network into smaller, more
manageable segments, known as areas.

This enhances scalability and reduces the amount of routing information


exchanged between routers.

Routers within the same area maintain a consistent view of the topology,
while routers in different areas communicate through Area Border Routers
(ABRs).

4. OSPF Working
4.1 OSPF Router Relationships
OSPF routers form two key types of relationships:

1. Neighbor Relationship:

Established when two OSPF-enabled routers on the same network


exchange Hello packets.

6. OSPF Basics 5
This is the initial step where routers recognize each other’s
presence and form a neighbor relationship.

2. Adjacency:

Adjacency goes beyond a simple neighbor relationship. Routers


exchange additional packet types (DD, LSR, LSU, and LSAck) and
synchronize their LSDBs (Link-State Databases).

Once synchronization is complete, and routers calculate routes


independently, an adjacency is established.

4.2 OSPF Adjacency Establishment Process


The process involves four main steps:

1. Neighbor Establishment:

When a router receives a Hello packet from another, it transitions


from the Down state to the Init state.

If the Hello packet lists the router's ID, it moves to the 2-way state,
indicating that bidirectional communication is established.

2. Master/Slave Negotiation:

The state changes from 2-way to Exstart, where the routers


determine their roles (master or slave) based on their router IDs (the
one with the higher ID becomes the master).

They exchange Database Description (DD) packets to describe the


LSDB.

3. LSDB Exchange:

Routers continue exchanging DD packets containing LSDB


descriptions until they agree on the content.

The slave acknowledges each packet sent by the master, ensuring


synchronization.

4. LSA Exchange:

Routers send Link State Requests (LSRs) to request any missing


LSAs.

Link State Updates (LSUs) containing the LSAs are sent in


response, followed by Link State Acknowledgments (LSAcks).

6. OSPF Basics 6
Once both routers have identical LSDBs, the state changes to Full,
completing the adjacency establishment.

4.3 Reviewing the OSPF Neighbor Table


The display ospf peer command provides key information about neighbor
relationships:

OSPF Process ID and Router ID

Area ID of the neighboring router

Neighbor Interface Address

Neighbor State (e.g., Init, 2-way, Full)

DR and BDR Roles

MTU, Priority, and other information like the retransmission interval and
authentication sequence.

4.4 OSPF Network Types


OSPF supports four network types:

1. Point-to-Point (P2P):

Only two devices are connected (e.g., PPP links). Default for
interfaces using PPP encapsulation.

2. Broadcast Multiple Access (BMA):

Supports multiple devices and broadcast (e.g., Ethernet networks).


Default for Ethernet interfaces.

3. Non-Broadcast Multiple Access (NBMA):

Allows multiple devices but does not support broadcast (e.g., Frame
Relay networks).

4. Point-to-Multipoint (P2MP):

Bundles multiple P2P links. Must be manually configured.

5. Designated Router (DR) and Backup Designated


Router (BDR) Roles

6. OSPF Basics 7
In multi-access (MA) networks, such as Ethernet, the number of OSPF
adjacencies can become excessive if each router forms an adjacency with
every other router. This can increase LSA flooding and overload devices.

To manage this, OSPF elects a Designated Router (DR) and a Backup


Designated Router (BDR):

Only the DR and BDR form adjacencies with all routers in the network
segment.

Other routers (DRothers) maintain a 2-way state with each other but do
not form full adjacencies.

The BDR monitors the DR and takes over if the DR fails.

Election rules:

The router with the highest priority becomes the DR.

If priorities are equal, the router with the higher router ID is elected.
The election is non-preemptive (once elected, DR/BDR do not
change unless they fail).

6. OSPF Domain and Area Design


1. OSPF Domain:

An OSPF domain consists of routers that use OSPF to exchange


information and apply the same policies.

Within an area, routers flood LSAs to ensure consistent topology


understanding.

2. Single-Area OSPF:

Suitable for small networks. All routers reside in the same area, meaning
LSDB synchronization occurs network wide.

Issues with a single-area design include:

Larger LSDBs and routing tables as the network grows.

More router resources are consumed, affecting performance.

3. Multi-Area OSPF:

Divides the OSPF domain into multiple areas to optimize performance


and scalability.

6. OSPF Basics 8
The backbone area (Area 0) connects all other areas, preventing inter-
area loops.

Advantages:

Reduces LSA flooding scope and simplifies route calculation.

Supports route summarization at Area Border Routers (ABRs) to


reduce routing table size.

7. Types of OSPF Routers


OSPF routers are classified based on their roles and locations:

1. Internal Router: All interfaces belong to a single area.

2. Area Border Router (ABR): Interfaces span multiple areas, with at least
one interface in the backbone area.

3. Backbone Router: Has at least one interface in the backbone area (Area
0).

4. AS Boundary Router (ASBR): Connects OSPF to other Autonomous


Systems (ASs) and exchanges routes with external networks.

OSPF Area Types


Backbone Area (Area 0): The central area to which all other areas connect.

Non-Backbone Areas: All other areas that must connect to the backbone
area.

Single-Area vs. Multi-Area Deployment


Single-Area Deployment: Suitable for small networks where all routers and
devices can be managed within the same area.

Multi-Area Deployment: Recommended for larger, hierarchical networks,


enhancing scalability and reducing LSA flooding impact.

6. OSPF Basics 9

You might also like