Roll NO 09
Roll NO 09
Roll NO 09
Network Layer
The Network Layer is the third layer of the OSI (Open Systems Interconnection) model,
responsible for facilitating data transfer between devices across multiple networks, as opposed to
a single network. Its main functions are:
1. Routing: Determines the optimal path for data packets from source to destination.
2. Forwarding: Transfers data packets through routers, determining the next device the
packet should be sent to.
3. Addressing: Each device on a network is assigned a unique address (such as an IP
address) to identify the packet’s destination and source.
4. Error Handling: Ensures packets are delivered without errors by managing error
detection and correction.
5. Packetization and Reassembly: Splits data into manageable packets at the sender side
and reassembles them at the receiver.
Packet Switching
Packet Switching is a method of transferring data across networks by breaking down the data
into smaller units called packets. Each packet contains a portion of the data, along with routing
information, and is transferred independently through the network. Packet switching is crucial to
efficient data transmission in the Network Layer, as it allows the network to use available paths
dynamically and improves the resilience and flexibility of data transfer.
● Setup Phase: Before data is sent, a route is established across the network from the sender to
the receiver.
● Data Transfer Phase: After the path is established, packets are sent along the same route in
sequential order, maintaining a fixed route until all data is transmitted.
● Teardown Phase: After the data transmission, the connection is terminated, freeing up network
resources.
Key Characteristics of Virtual Circuit Networks:
● Fixed Path: Once a virtual circuit is established, all packets follow the same path, simplifying
routing.
● Connection-Oriented: Like a phone call, it requires setup, data transfer, and teardown phases.
● Guaranteed Delivery Order: Packets arrive in order, minimizing the need for reordering.
● Reliability and Consistency: The route remains consistent, which is useful for applications that
require reliable, in-sequence delivery, such as voice over IP (VoIP).
2. Datagram Networks
In a Datagram Network, each packet (or datagram) is treated independently, with no
pre-established path. Each packet contains the complete destination address and may travel
through various paths to reach its destination.
● Dynamic Routing Paths: Routes can vary, offering flexibility and fault tolerance.
● Connectionless: No need for a setup or teardown phase.
● Best-Effort Delivery: No guarantee of packet order or delivery, making the system less reliable
for applications that require sequence order.
● The Internet Protocol (IP) is a common datagram network technology, where packets may take
different routes across the internet.
1. Data Plane
The Data Plane, also known as the Forwarding Plane, is responsible for the actual movement of
packets across the network devices (such as routers and switches).
Key Functions of the Data Plane:
● Forwarding Packets: The primary function of the Data Plane is to forward packets
based on the routing table. It decides, for each incoming packet, the correct output
interface based on the destination address.
● Packet Processing: Involves actions like encapsulation/decapsulation, packet filtering,
and network address translation (NAT).
● Fast Packet Switching: Operates at high speed since it handles each packet individually
as it arrives. Often uses hardware-based mechanisms (like ASICs in routers) to speed up
processing.
Types of Forwarding:
● Destination-Based Forwarding: Packets are forwarded solely based on the destination
IP address in the packet header. Each router forwards packets towards the destination
based on its routing table.
● Generalized Forwarding: Allows for more flexible forwarding decisions by examining
additional header fields, such as source address, protocol type, or port numbers. This is
often seen in Software-Defined Networking (SDN) environments.
Forwarding Table (or Forwarding Information Base, FIB):
● Contains mappings between IP addresses or address ranges and the router’s output interfaces.
● The Data Plane refers to the forwarding table to make real-time forwarding decisions for
incoming packets.
● In typical IP-based networks, this table is derived from the routing table maintained by the
Control Plane.
2. Control Plane
The Control Plane is responsible for determining the best paths through the network. It manages
and updates the Routing Table or Routing Information Base (RIB) by running various routing
algorithms and protocols.
Figure . The Planes separated and typical packet logic into these information bases.
Key Functions of the Control Plane:
● Routing: Builds a global view of the network topology and determines optimal paths.
This information is used to populate the forwarding tables used by the Data Plane.
● Path Selection: Decides on the path based on metrics such as distance, bandwidth,
latency, or cost.
● Routing Protocols: Uses algorithms and protocols to update and maintain routing
information across the network. Common protocols include:
o OSPF (Open Shortest Path First): A link-state routing protocol used in IP networks, which
calculates the shortest path based on link metrics.
o RIP (Routing Information Protocol): A distance-vector protocol that routes based on hop
counts, typically used in smaller networks.
o BGP (Border Gateway Protocol): A path-vector protocol used between autonomous
systems (AS) on the internet.
o IS-IS (Intermediate System to Intermediate System): Another link-state protocol, similar
to OSPF, used primarily in large service provider networks.
● Network Topology Management: Continuously monitors the network to adjust routing
in case of changes or failures, ensuring that the forwarding tables remain accurate.
Centralized vs. Distributed Control Planes:
● Centralized Control Plane: A single, centralized controller makes routing decisions for
the network. This model is commonly found in SDN (Software-Defined Networking)
where the control plane is separated from the data plane, allowing centralized control and
programmability.
● Distributed Control Plane: Traditional networks use distributed control planes where
each router makes independent routing decisions based on shared protocols. Each router
maintains its own control and data planes, exchanging routing information with other
routers.
1. Version (4 bits): Specifies the IP version. For IPv4, this field is set to 4.
2. Header Length (IHL - 4 bits): Indicates the length of the header in 32-bit words (typically 5, as
the standard header length is 20 bytes).
3. Type of Service (TOS - 8 bits): Also known as Differentiated Services, this field can specify
priority and quality of service requirements.
4. Total Length (16 bits): Indicates the total length of the IP datagram, including the header and
payload, in bytes. The maximum size of an IPv4 datagram is 65,535 bytes.
5. Identification (16 bits): A unique identifier for each packet, used during fragmentation and
reassembly.
6. Flags (3 bits): Controls fragmentation. Key flags include:
o DF (Don't Fragment): Instructs routers not to fragment the datagram.
o MF (More Fragments): Indicates if there are more fragments of this packet.
7. Fragment Offset (13 bits): Specifies the position of the fragment in the original datagram,
allowing reassembly at the destination.
8. Time to Live (TTL - 8 bits): Limits the lifetime of a packet, helping to prevent endless looping.
Each router reduces the TTL by one, and when it reaches zero, the packet is discarded.
9. Protocol (8 bits): Identifies the protocol of the encapsulated data (e.g., TCP, UDP).
10. Header Checksum (16 bits): Provides error checking for the header.
11. Source IP Address (32 bits): The IP address of the packet’s origin.
12. Destination IP Address (32 bits): The IP address of the packet’s destination.
13. Options (Variable Length): An optional field used for additional functionalities, such as security,
routing, or timestamping.
Payload
The payload is the data carried by the IP datagram. This typically consists of the higher-layer
data, such as TCP or UDP segments, and represents the main data to be delivered.
IPv4 Fragmentation
IP fragmentation occurs when a packet is too large to be transmitted over a network link. Each
link in the network has a Maximum Transmission Unit (MTU), which defines the largest
packet size that can be sent in a single frame. If an IPv4 packet exceeds the MTU of the network
link, it is divided into smaller fragments to ensu re successful transmission.
Fragmentation Process
1. Packet Size Check: When an IP packet arrives at a router, the router checks if its size is greater
than the MTU of the outgoing link.
2. Fragmentation Trigger: If the packet size exceeds the MTU, the packet is fragmented.
3. Fragment Creation: The original IP datagram is divided into smaller fragments. Each fragment
becomes an independent IP datagram, carrying part of the original payload and a fragment
header with specific fragmentation information.
4. Fragment Fields:
o Identification: All fragments of a packet carry the same Identification number, helping
the receiving device to recognize and reassemble fragments that belong to the same
original packet.
o Flags: The MF (More Fragments) flag is set in all fragments except the last one. The DF
(Don’t Fragment) flag prevents routers from fragmenting the packet.
o Fragment Offset: Indicates the position of the fragment in the original datagram,
enabling reassembly in the correct order.
Fragmentation Example
● Suppose the MTU of a link is 1500 bytes, but an IP datagram is 4000 bytes.
● The router fragments the datagram into smaller packets (fragments), each less than or equal to
the MTU.
● Each fragment includes the same source and destination addresses, Identification number, and
appropriate MF flags and offsets.
Reassembly of Fragments
Reassembly occurs only at the destination, not at intermediate routers. The destination device
collects all fragments, using the Identification field, MF flag, and Fragment Offset to reconstruct
the original datagram.
Fragmentation Challenges
● Increased Overhead: Each fragment carries an IP header, adding overhead to the overall
transmission.
● Potential Loss: If a single fragment is lost, the entire datagram must be resent, as reassembly
cannot proceed without all fragments.
● Processing Delay: Fragmentation and reassembly add processing delays, especially in networks
with multiple hops.
For example, in the IP address 192.168.1.1/24, 192.168.1 is the network portion, and 1 is the
host portion. The /24 denotes the subnet mask (24 bits for the network portion), which is crucial
for routing and subnetting.
Classes of IPv4 Addresses
IPv4 addresses were originally divided into classes (Class A, B, C, D, and E), a system known as
Classful Addressing. However, Classful Addressing is largely outdated, and most modern
networks use Classless Inter-Domain Routing (CIDR) for more flexible and efficient
addressing.
Classful Addressing Classes:
CIDR (Classless Inter-Domain Routing)
CIDR is an addressing method that replaces the rigid structure of Classful Addressing. Instead of
fixed classes, CIDR allows more flexible allocation of IP addresses using prefix lengths, which
specify the number of bits used for the network portion. CIDR is expressed as an IP address
followed by a slash and the number of bits in the network portion (e.g., 192.168.1.0/24).
● Benefits of CIDR:
o Efficient IP Allocation: By using variable-length subnetting, CIDR minimizes the wastage
of IP addresses.
o Route Aggregation: CIDR allows for the aggregation of multiple IP networks into a single
routing table entry, reducing the size of routing tables and improving performance.
1. Unicast: An address assigned to a single device. Data sent to a unicast address is delivered to the
specific host.
2. Broadcast: An address used to send data to all devices on a network. The broadcast address for a
subnet is the highest address in that subnet (e.g., 192.168.1.255 in the 192.168.1.0/24
network).
3. Multicast: An address used to deliver data to multiple hosts that have joined a multicast group.
Multicast addresses range from 224.0.0.0 to 239.255.255.255.
● Public Addresses: Globally unique addresses routable on the public internet, assigned by IANA
(Internet Assigned Numbers Authority).
● Private Addresses: Reserved for internal network use, not routable on the public internet, which
conserves IPv4 addresses.
Route Aggregation
Route Aggregation, also known as Route Summarization, is a technique that allows multiple IP
networks to be represented by a single, summarized address in routing tables. This process
reduces the number of routing entries, conserves router resources, and improves efficiency,
especially in large-scale networks like the internet.
How Route Aggregation Works
1. Identifying Subnets for Aggregation: Multiple contiguous IP subnets with a common prefix are
identified.
2. Summarizing the Prefix: These subnets are aggregated under a single, broader network prefix
that can represent all the individual networks. This summarized address can then be advertised
to neighboring routers instead of each individual route.
3. Updating Routing Tables: The summarized route reduces the number of entries in the routing
table, as a single entry can now cover multiple IP addresses.
Example:
Consider the following networks:
● 192.168.1.0/24
● 192.168.2.0/24
● 192.168.3.0/24
● 192.168.4.0/24
These can be aggregated into a single route 192.168.0.0/22, reducing four entries into one.
Advantages of Route Aggregation
1. Reduced Routing Table Size: Fewer entries in the routing table decrease memory requirements
and processing time on routers, enhancing performance.
2. Improved Scalability: Aggregation makes large networks easier to manage by simplifying
routing.
3. Decreased Network Traffic: Summarized routes reduce the frequency of routing updates
required when changes occur in individual subnets.
4. Better Network Performance: Fewer routes mean faster route lookup and reduced latency.
Limitations of Route Aggregation
1. Loss of Specificity: Aggregation can sometimes hide specific network paths, which might result
in suboptimal routing in certain cases.
2. Requirement of Contiguous Addresses: Only contiguous IP address ranges can be aggregated, so
non-contiguous networks cannot benefit directly.
3. Risk of Black Holes: Incorrect aggregation can lead to “black holes,” where packets are dropped
if they are sent to destinations within the summarized range that do not actually exist in the
network.
Supernetting
Supernetting is a form of route aggregation used when multiple smaller networks are combined
into a single, larger block of addresses. This is achieved by adjusting the subnet mask to allow
for fewer network bits, creating a "supernet."
For example, two networks 192.168.0.0/24 and 192.168.1.0/24 can be combined into a
supernet with address 192.168.0.0/23.
Subnetting
Subnetting is the process of dividing a larger IP network into smaller, more manageable
subnetworks or subnets. It is used to improve network organization, security, and efficiency, as
well as to optimize address allocation, especially in large networks.
Purpose of Subnetting
1. Efficient IP Address Usage: Subnetting helps allocate IP addresses more effectively, especially in
larger networks with varied numbers of devices.
2. Network Segmentation: Dividing a network into smaller subnets improves traffic management
and reduces congestion.
3. Improved Security and Management: Subnetting allows the isolation of network segments,
making it easier to manage and secure specific areas of the network.
4. Reduced Broadcast Traffic: Smaller subnets contain broadcast traffic within each subnet,
reducing unnecessary network load on other parts of the network.
Subnet Masks
A Subnet Mask is a 32-bit value that separates the network portion from the host portion of an
IP address. Each network bit is represented by a 1 in binary, and each host bit is represented by a
0.
For example:
● Subnet Mask 255.255.255.0 (or /24): The first 24 bits represent the network portion, and the
remaining 8 bits represent the host portion.
Subnetting Calculation
To create subnets, you "borrow" bits from the host portion of the IP address to define additional
networks. The number of bits borrowed determines the number of subnets and hosts per subnet.
Formulae for Subnetting:
● A /24 network has a subnet mask of 255.255.255.0, allowing 256 addresses (from 192.168.1.0
to 192.168.1.255).
● By borrowing 2 bits for subnetting (making the subnet mask /26), the network is divided into 4
subnets (2^2 = 4).
● Each subnet now has 64 addresses (2^6 - 2 = 62 usable addresses).
Subnetting Examples
1. 192.168.1.0/24:
o Original network, no subnetting: 256 IP addresses with a host range of 192.168.1.1 -
192.168.1.254.
2. 192.168.1.0/26:
o Two bits borrowed, creating four subnets:
▪ Subnet 1: 192.168.1.0/26, range 192.168.1.1 - 192.168.1.62
▪ Subnet 2: 192.168.1.64/26, range 192.168.1.65 - 192.168.1.126
▪ Subnet 3: 192.168.1.128/26, range 192.168.1.129 - 192.168.1.190
▪ Subnet 4: 192.168.1.192/26, range 192.168.1.193 - 192.168.1.254
1. Flexible Addressing: CIDR enables the use of arbitrary-sized networks rather than fixed classes,
making it more adaptable to real-world network requirements.
2. Efficient Address Allocation: By using variable-length subnet masks, CIDR conserves IP addresses
and avoids wastage.
3. Route Aggregation: CIDR allows multiple networks to be summarized into a single route,
reducing the number of entries in routing tables.
CIDR Notation
In CIDR notation, the IP address is represented with the network prefix. For instance:
● 192.168.0.0/16: Here, the /16 indicates that the first 16 bits are the network portion, with the
remaining 16 bits available for hosts.
● 192.168.1.0/24: The /24 prefix means the first 24 bits are for the network, and the last 8 bits are
for hosts, giving 256 addresses in total.
● 192.168.1.0/24
● 192.168.2.0/24
● 192.168.3.0/24
● 192.168.4.0/24
Instead of announcing four different routes, the network can use CIDR to aggregate these
addresses into 192.168.0.0/22, covering all four networks in a single route. This reduces the
number of routing entries and conserves resources.
Variable Length Subnet Masking (VLSM)
CIDR also introduced the concept of Variable Length Subnet Masking (VLSM), which allows
different subnets to have different subnet masks within the same network. This helps maximize
address usage, especially in networks with diverse needs.
Example: A company with an IP address block of 192.168.1.0/24 could:
VLSM enables efficient IP address allocation by matching address size to each subnet's specific
requirements.
CIDR and IPv4 Exhaustion
With IPv4 nearing exhaustion, CIDR has been instrumental in slowing this process by allowing:
● Efficient Utilization: Small networks receive only the necessary number of IP addresses.
● Address Conservation: ISPs can allocate smaller, custom-sized blocks, avoiding the
need for a whole Class B or C network when fewer addresses are sufficient.
Despite CIDR, IPv4 limitations have led to the development and adoption of IPv6, which
supports a vastly larger address space.
Types of NAT
There are several types of NAT, each designed to handle specific networking scenarios:
1. Static NAT:
o Maps a private IP address to any available public IP address from a pool of public IP
addresses.
o Useful for networks where there is a need to map multiple internal hosts to a pool of
public IPs.
o Dynamic NAT assigns IPs temporarily, and the IP mapping changes with each session.
3. Port Address Translation (PAT) (also called NAT Overload):
1. The private IP address is replaced with a public IP address as the packet leaves the network.
2. The router or NAT device keeps a translation table to track which private IP and port correspond
to each public IP and port.
3. When a response is received, the NAT device uses the translation table to map the packet back
to the correct private IP and port.
For example, if an internal device with IP 192.168.1.5 initiates a connection to a web server,
NAT would:
Advantages of NAT
1. Conserves IPv4 Addresses: NAT allows multiple devices to share a single public IP, reducing the
need for additional public IP addresses.
2. Improves Security: NAT hides internal IP addresses from external networks, reducing the
exposure of the internal network to potential attacks.
3. Enables Private IP Addressing: Internal networks can use private IP addresses (e.g.,
192.168.x.x or 10.x.x.x), which are non-routable on the public internet.
Disadvantages of NAT
1. Breaks End-to-End Connectivity: NAT modifies IP addresses and port numbers, which can
interfere with applications that require specific IP information (e.g., VoIP, online gaming).
2. Incompatibility with Some Protocols: Certain protocols, especially those that embed IP
information within data packets (like FTP, SIP), require special handling with NAT.
3. Complex Configuration for Inbound Connections: NAT complicates scenarios where an external
client needs to initiate a connection with an internal device, requiring special configurations like
port forwarding.
● For example, if a web server inside the network has an IP address of 192.168.1.20 and needs
to be accessible on port 80:
o The router can be configured to forward external traffic on port 80 (e.g.,
203.0.113.10:80) to 192.168.1.20:80.
NAT Traversal
NAT Traversal refers to methods that allow devices behind NAT to establish and maintain
connections across NAT devices, commonly used in VPNs, VoIP, and peer-to-peer applications.
Examples include:
● STUN (Session Traversal Utilities for NAT): Helps devices behind NAT discover their public IP
address and port.
● TURN (Traversal Using Relay NAT): Used when direct peer-to-peer communication is not
possible; a relay server is used to route the traffic.
● UPnP (Universal Plug and Play): Allows applications to request port forwarding on a router
dynamically, used in applications like gaming and streaming.
● Subnet Mask: Defines the network and host portions of the IP address.
● Default Gateway: Specifies the router through which the client can reach other networks.
● DNS Servers: Provides the IP addresses of DNS servers that the client can use to resolve domain
names.
● Domain Name: Specifies the domain name suffix used by the client.
Benefits of DHCP
1. Automates IP Address Management: DHCP eliminates the need for manual IP configuration,
making it easier to add new devices to a network.
2. Reduces IP Address Conflicts: By managing IP address allocation, DHCP minimizes the chance of
IP address conflicts.
3. Improves Network Flexibility: Devices can easily move between subnets or networks without
requiring manual reconfiguration.
4. Centralized Management: DHCP centralizes the management of IP configuration, making it
easier for network administrators to maintain network settings.
DHCP Relay Agent
In larger networks, DHCP clients may not be on the same subnet as the DHCP server. In this
case, a DHCP Relay Agent is used. The relay agent forwards DHCP requests from clients in a
subnet to a DHCP server on a different subnet. The DHCP relay agent's IP address helps the
DHCP server know where to send its replies.
Static vs. Dynamic IP Allocation
DHCP supports two main types of IP address allocation:
● Dynamic Allocation: IP addresses are assigned dynamically for a limited time (lease) and
returned to the pool when no longer needed.
● Static Allocation: The DHCP server reserves specific IP addresses for specific devices based on
their MAC addresses. This is useful for devices requiring a fixed IP, such as printers or servers.
1. Error Reporting: ICMP notifies devices of issues in packet delivery, such as unreachable
destinations or network congestion.
2. Diagnostics: Tools like ping and traceroute use ICMP to test network connectivity and trace
packet paths.
3. Network Management: ICMP helps manage network efficiency by alerting routers and devices
about issues affecting packet delivery.
ICMP Message Types
ICMP messages are categorized into two main types: error messages and informational
messages. Each message type has a unique code and format for specifying the issue.
1. Error Messages:
o Destination Unreachable: Indicates that a packet cannot reach its destination. This error
could be due to network congestion, an unavailable host, or restricted access.
o Time Exceeded: Occurs when a packet's Time-to-Live (TTL) value reaches zero before
reaching its destination, often due to routing loops.
o Source Quench (Deprecated): Used to indicate network congestion and request the
sender to slow down transmission. It’s rarely used in modern networks.
o Redirect: Informs a host of a more optimal route for reaching a specific destination.
2. Informational Messages:
o Echo Request and Echo Reply: Used by the ping command to check network
connectivity between devices.
o Timestamp Request and Timestamp Reply: Used to measure the time delay (round-trip
time) between devices, though this is rarely used compared to other methods.
● When a router cannot forward a packet because the destination is unreachable, it sends an
ICMP Destination Unreachable message back to the sender, indicating that the packet could not
be delivered.
o Uses ICMP Echo Request and Echo Reply messages to test connectivity.
o The sender sends an ICMP Echo Request to the target, and if the target is reachable, it
responds with an ICMP Echo Reply.
o Useful for checking if a device is reachable and for measuring latency or round-trip time
(RTT).
2. Traceroute:
o Uses ICMP Time Exceeded messages to trace the path a packet takes to reach its
destination.
o Traceroute sends packets with gradually increasing TTL values. Each router along the
path decrements the TTL by 1; if TTL reaches 0, the router sends back a Time Exceeded
message.
o This process allows the sender to discover the route and any potential bottlenecks in the
path.
1. Ping Flood (ICMP Flood): Overwhelms a target by sending a flood of ICMP Echo Requests,
leading to resource exhaustion.
2. Smurf Attack: Involves sending ICMP requests with a spoofed source IP, causing devices to flood
a target with responses.
3. ICMP Tunneling: Uses ICMP to create covert channels, often to bypass firewalls or other security
mechanisms.
Because of these risks, administrators may limit ICMP traffic to reduce the attack surface while
still allowing essential ICMP functionality for network diagnostics.
References
Books
1. Kurose, J. F., & Ross, K. W. (2017). Computer Networking: A Top-Down
Approach. Pearson Education.
2. Stallings, W. (2017). Data and Computer Communications. Pearson Education.
3. Forouzan, B. A. (2013). Data Communications and Networking. McGraw-Hill
Education.
4. Tanenbaum, A. S., & Wetherall, D. J. (2011). Computer Networks. Pearson
Education.
Online Resources
5. RFC 791 - Internet Protocol. (1981). Internet Engineering Task Force (IETF).
6. Cisco Networking Academy. (2023). Introduction to Networks v7 Course Material.
Cisco Systems.
IT ISA 4 ROLL NO - 09