0% found this document useful (0 votes)
13 views9 pages

Understanding IPv4 Header and Addressing

The document provides detailed notes on various networking concepts, including the IPv4 header format, classful and classless addressing, shortest path routing algorithms like Dijkstra's Algorithm and Link State Routing, subnetting and supernetting, and congestion control policies. It covers the structure and fields of the IPv4 header, compares IPv4 and IPv6, explains routing algorithms with examples, and discusses the importance of efficient IP address allocation. Additionally, it addresses network traffic congestion, its causes, effects, and various control policies.

Uploaded by

asw.atharva67
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)
13 views9 pages

Understanding IPv4 Header and Addressing

The document provides detailed notes on various networking concepts, including the IPv4 header format, classful and classless addressing, shortest path routing algorithms like Dijkstra's Algorithm and Link State Routing, subnetting and supernetting, and congestion control policies. It covers the structure and fields of the IPv4 header, compares IPv4 and IPv6, explains routing algorithms with examples, and discusses the importance of efficient IP address allocation. Additionally, it addresses network traffic congestion, its causes, effects, and various control policies.

Uploaded by

asw.atharva67
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

CN Module 4 Notes

1. Explain the IPv4 header format with a diagram.

Answer:

Introduction
The Internet Protocol version 4 (IPv4) is a network layer protocol used to identify devices on a network
through unique addresses and to route data packets between them.
Each IPv4 packet consists of two parts: Header and Data.
The header carries important control information required for packet delivery and routing.

1. IPv4 Packet Structure


+--------------------+-------------------+
| Header | Data |
+--------------------+-------------------+
• Header: Contains addressing and control fields (usually 20 to 60 bytes).
• Data: Carries the actual payload from upper layers.

2. IPv4 Header Format (Diagram)

3. Fields of IPv4 Header (20–60 Bytes)


(1) Version (4 bits)
• Indicates IP version.
• For IPv4, the value = 4.
(2) Internet Header Length (IHL) (4 bits)
• Specifies the length of the header in 32-bit words.
• Minimum = 5 (20 bytes), Maximum = 15 (60 bytes).
(3) Type of Service (ToS) / Differentiated Services (8 bits)
• Indicates the priority and quality of service (QoS).
• Includes precedence, delay, throughput, and reliability parameters.
(4) Total Length (16 bits)
• Defines the total size of the IP packet (header + data) in bytes.
• Maximum value = 65,535 bytes.
(5) Identification (16 bits)
• Used to uniquely identify fragments of an original IP datagram during fragmentation and
reassembly.
(6) Flags (3 bits)
• Controls and identifies fragments.
o Bit 0: Reserved (must be 0)
o Bit 1 (DF): Don’t Fragment
o Bit 2 (MF): More Fragments
(7) Fragment Offset (13 bits)
• Indicates the position of the fragment in the original datagram.
• Measured in units of 8 bytes.
(8) Time to Live (TTL) (8 bits)
• Specifies the maximum number of hops a packet can traverse.
• Decremented by one at each router.
• Prevents packets from looping indefinitely.
(9) Protocol (8 bits)
• Indicates the next level protocol used in the data portion.
o Example: ICMP = 1, TCP = 6, UDP = 17.
(10) Header Checksum (16 bits)
• Used for error detection of the header.
• Recalculated at every router hop.
(11) Source IP Address (32 bits)
• The IPv4 address of the sender (e.g., [Link]).
(12) Destination IP Address (32 bits)
• The IPv4 address of the receiver (e.g., [Link]).
(13) Options (Variable length)
• Used for network testing, debugging, and security features.
• Optional field; increases header length beyond 20 bytes.
(14) Padding
• Ensures that the header is a multiple of 32 bits (adds zero bits if necessary).

4. Example of Header Size Calculation


If IHL = 5 →
Header Length = 5 × 32 bits = 160 bits = 20 bytes
This is the minimum IPv4 header size.

5. Important Characteristics
• Header length: 20 to 60 bytes
• Address size: 32 bits (4 bytes)
• Supports fragmentation and reassembly
• No error correction (only detection through checksum)

Conclusion
The IPv4 header is the backbone of IP packet delivery, carrying all necessary information for addressing,
routing, and fragmentation. Its flexible design, with optional fields and checksum verification, enables
efficient and reliable communication across diverse networks.
2. Explain Classful and Classless IPv4 addressing, and compare IPv4 and IPv6

Answer:

Introduction
Internet Protocol (IP) addressing is the fundamental method used to identify devices on a network. There are
two main approaches to IPv4 addressing — Classful and Classless — and an advanced version of the IP
protocol called IPv6 that overcomes the limitations of IPv4.

1. Classful IPv4 Addressing (5 Marks)


1.1 Definition
Classful addressing divides the entire IPv4 address space (32 bits) into fixed-size classes (A, B, C, D, and
E). Each class has a predefined network and host portion.

1.2 Structure of IPv4 Address


+-----------------+-----------------+
| Network Portion | Host Portion |
+-----------------+-----------------+
(varies by class)

1.3 Classes of IPv4


Range (First Default Subnet No. of No. of
Class Usage
Octet) Mask Networks Hosts/Network
Very large
A 0 – 127 [Link] 128 16,777,214
networks
B 128 – 191 [Link] 16,384 65,534 Medium networks
C 192 – 223 [Link] 2,097,152 254 Small networks
D 224 – 239 – – – Multicasting
E 240 – 255 – – – Experimental

1.4 Drawback
• Wastage of IP addresses (fixed network sizes).
• No efficient subnetting or supernetting.
• Rapid exhaustion of IPv4 space.

2. Classless IPv4 Addressing (CIDR – Classless Inter-Domain Routing) (2 Marks)


2.1 Definition
Classless addressing allows variable-length subnet masking (VLSM). It does not rely on predefined
classes but uses prefix notation (e.g., [Link]/27) to specify how many bits belong to the network.

2.2 Example
IP: [Link]/27
→ Network bits: 27
→ Host bits: 5
→ Total hosts: 2⁵ - 2 = 30

2.3 Advantages
• Efficient IP utilization.
• Enables subnetting and supernetting.
• Simplifies routing with route aggregation.
3. Comparison Between IPv4 and IPv6 (3 Marks)
Feature IPv4 IPv6
Address length 32 bits 128 bits
Address format Decimal (e.g., [Link]) Hexadecimal (e.g., 2001:0db8::1)
Address space ~4.3 billion addresses ~3.4 × 10³⁸ addresses
Header size 20–60 bytes Fixed 40 bytes
Configuration Manual or DHCP Auto-configuration supported
Security Optional (via IPSec) Built-in IPSec support
Checksum Present Removed (for faster processing)
Broadcast Supported Replaced by multicast
QoS Support Limited Improved with Flow Label field

Conclusion
Classful addressing was the original, rigid structure of IPv4, but it led to IP wastage. Classless (CIDR)
addressing solved this issue through flexible subnetting. However, with internet growth, even IPv4’s
expanded usage was insufficient—hence IPv6 was introduced, offering vast address space, better
performance, and integrated security.

3. Explain shortest path routing algorithms like Dijkstra's Algorithm and Link State Routing, with
examples

Answer:

Introduction
In computer networks, routing algorithms are used to determine the most efficient path for data packets to
travel from a source to a destination. Among these, shortest path algorithms like Dijkstra’s Algorithm
and Link State Routing (LSR) are widely used to ensure fast, reliable, and loop-free routing.

1. Dijkstra’s Algorithm (Shortest Path First Algorithm) – 5 Marks


1.1 Definition
Dijkstra’s Algorithm, proposed by Edsger Dijkstra, is used to find the shortest path from a single source
node to all other nodes in a weighted graph (network).
It is the foundation for Link State Routing protocols like OSPF (Open Shortest Path First).

1.2 Working Principle


It maintains two sets of nodes:
• Visited set (S): Nodes with known shortest path.
• Unvisited set (Q): Nodes whose shortest distance is not finalized.

1.3 Steps of the Algorithm


1. Initialize all node distances as infinity (∞), except the source node (0).
2. Select the node with the minimum distance value not yet visited.
3. Update the distance to its neighbors if a shorter path is found.
4. Mark the selected node as visited.
5. Repeat steps 2–4 until all nodes are visited.

1.4 Example
Graph:
(2)
A ------ B
|\ |
(1)| \ (4)|
| \ |
C----D---E
(5) (3)
Find shortest path from A:
Node Initial Distance Final Distance Path
A 0 0 A
B ∞→2 2 A→B
C ∞→1 1 A→C
D ∞→5 5 A→C→D
E ∞→6 6 A→B→E
Shortest paths from A:
A→C (1), A→B (2), A→C→D (5), A→B→E (6)

1.5 Advantages
• Finds shortest path efficiently.
• Guarantees loop-free routes.
• Suitable for large and stable networks.

2. Link State Routing (LSR) – 4 Marks


2.1 Definition
Link State Routing is a dynamic routing algorithm that uses complete network topology knowledge to
compute shortest paths. Each router builds a Link State Database (LSDB) and uses Dijkstra’s Algorithm
to determine optimal routes.

2.2 Steps in Link State Routing


1. Discover neighbors: Each router identifies directly connected routers.
2. Measure link cost: Each link’s delay, bandwidth, or distance is calculated.
3. Generate Link State Packets (LSP): Each router prepares an LSP describing its links.
4. Flooding: LSPs are shared with all routers in the network.
5. Shortest Path Calculation: Each router applies Dijkstra’s Algorithm to compute the best routes.

2.3 Example
Suppose:
Router A has neighbors B and C.
• A–B = 2
• A–C = 3
• B–C = 1
After exchanging LSPs, all routers know the entire topology and independently compute shortest
paths using Dijkstra’s Algorithm.

2.4 Advantages
• Provides fast convergence.
• Minimizes routing loops.
• Each router has a complete and updated view of the network.
Conclusion
Dijkstra’s Algorithm forms the mathematical base of Link State Routing, ensuring optimal path selection.
While Dijkstra focuses on path calculation, Link State Routing handles real-time route updates and topology
management. Together, they enable efficient and intelligent routing in modern IP networks like OSPF and
IS-IS.

4. Explain subnetting, super netting, and solve problems related to IP address allocation and subnet
creation

Answer:

Introduction
Efficient use of IP addresses is essential in networking. Subnetting and Supernetting are two major
techniques used to optimize IP address allocation, improve routing efficiency, and enhance network
performance.
• Subnetting divides a large network into smaller sub-networks.
• Supernetting combines smaller networks into a larger one.

1. Subnetting (5 Marks)
1.1 Definition
Subnetting is the process of dividing a single IP network into multiple smaller networks (subnets) by
borrowing bits from the host portion of an IP address.

1.2 Purpose
• Efficient utilization of IP addresses.
• Improved network management and security.
• Reduces network congestion and broadcast traffic.

1.3 Subnet Mask


A subnet mask determines which portion of an IP address represents the network and which part represents
the host.
Example:
IP Address: [Link]
Default Mask: [Link] (/24)
If we borrow 2 bits from host part:
New Mask = [Link] (/26)
→ 4 Subnets created (2² = 4)

1.4 Formulae
Parameter Formula
No. of Subnets 2ⁿ (where n = bits borrowed)
No. of Hosts/Subnet 2ʰ – 2 (where h = remaining host bits)

1.5 Example Problem (Subnetting)


Given:
IP = [Link]/24
Need 4 subnets.
Solution:
• Required bits to borrow: n = 2 (since 2² = 4)
• New subnet mask: /24 + 2 = /26 → [Link]
Subnet No Network Address First Host Last Host Broadcast Address
1 [Link] [Link] [Link] [Link]
2 [Link] [Link] [Link] [Link]
3 [Link] [Link] [Link] [Link]
4 [Link] [Link] [Link] [Link]
Each subnet has 62 usable hosts.

1.6 Diagram (Text Representation)


Original Network: [Link]/24
↓ (Subnetting)
[Link]/26 | [Link]/26 | [Link]/26 | [Link]/26

2. Supernetting (3 Marks)
2.1 Definition
Supernetting is the reverse of subnetting. It combines multiple smaller networks into a single larger
network.
Also known as Route Aggregation or CIDR (Classless Inter-Domain Routing).

2.2 Purpose
• Reduces size of routing tables.
• Simplifies management of multiple networks.
• Used by ISPs for efficient IP allocation.

2.3 Example Problem (Supernetting)


Given:
Four Class C networks need to be combined:
[Link], [Link], [Link], [Link]
Each has a default mask of /24 ([Link]).
To combine them:
• Number of networks = 4 → needs 2 bits (since 2² = 4).
• Subtract from default mask: 24 – 2 = /22
→ Supernet Address = [Link]/22
Covers range:
[Link] – [Link]

3. Comparison Table (Subnetting vs Supernetting) – 1 Mark


Feature Subnetting Supernetting
Operation Divide network Combine networks
Purpose Efficient internal management Reduce routing table entries
Used by LAN administrators ISPs, backbone routers
Mask change Increases prefix (/24 → /26) Decreases prefix (/24 → /22)
Example [Link]/24 → /26 [Link]/24 × 4 → /22

Conclusion
Subnetting enhances internal network efficiency by dividing a large network into manageable segments,
while supernetting reduces routing complexity by merging adjacent networks. Both are essential IP
addressing techniques ensuring scalability, flexibility, and optimal use of limited IPv4 space.
5. Discuss network traffic congestion and various congestion control policies (open loop and closed
loop)

Answer:

Introduction
In computer networks, congestion occurs when the demand for network resources (like bandwidth and
buffer space) exceeds the available capacity, leading to packet loss, delay, and degraded performance.
To manage this, congestion control mechanisms are used — broadly classified as Open-Loop (preventive)
and Closed-Loop (reactive) policies.

1. Network Traffic Congestion (3 Marks)


1.1 Definition
Network congestion is a condition where excessive packet load on the network causes queue buildup,
increased delay, packet drops, and reduced throughput.

1.2 Causes of Congestion


1. High data transmission rate from multiple sources.
2. Slow processing at routers and switches.
3. Insufficient buffer capacity at intermediate nodes.
4. Retransmissions due to timeouts and packet loss.
5. Unbalanced traffic load (some links overloaded, others idle).

1.3 Effects of Congestion


Parameter Effect of Congestion
Throughput Decreases after optimal load is exceeded.
Delay Increases exponentially as load grows.
Packet Loss Increases due to buffer overflow.
Quality of Service (QoS) Degrades drastically.

2. Congestion Control Policies (7 Marks)


Congestion control ensures the network operates efficiently even during heavy load conditions.
It can be categorized into two main approaches:

2.1 Open-Loop Congestion Control (Preventive Approach)


Definition
In open-loop control, congestion is prevented before it happens.
Decisions are made without feedback from the network — i.e., it’s a proactive method.
Characteristics
• Static approach (design-time control).
• No dynamic feedback from routers.
• Policies are applied during connection setup and data transmission.
Open-Loop Policies
Policy Type Description
Retransmission Policy Avoids unnecessary retransmissions; uses timers and acknowledgments.
Window Policy Controls the number of outstanding packets (e.g., sliding window in TCP).
Acknowledgment Policy Uses delayed or cumulative ACKs to reduce congestion.
Discard Policy Routers may drop low-priority packets during congestion.
Admission Policy Rejects new connections when resources are insufficient (used in virtual circuits).
Example
TCP uses window-based flow control to prevent excessive packet sending, reducing the chance of
congestion.

2.2 Closed-Loop Congestion Control (Reactive Approach)


Definition
In closed-loop control, congestion is detected and resolved dynamically by using feedback mechanisms
from the network.
It’s a run-time adaptive method.
Phases of Closed-Loop Control
1. Monitor the system: Detect congestion using delay, packet loss, or queue length.
2. Pass feedback: Send signals from congested nodes to sources.
3. Adjust the system: The sender adjusts transmission rate based on feedback.
Closed-Loop Techniques
Technique Description
Backpressure Intermediate nodes signal upstream nodes to stop transmission when buffers fill.
Choke Packet Routers send a “choke” packet to the sender, asking it to reduce sending rate.
Implicit
Sender infers congestion through increased delay or packet loss (used in TCP).
Signaling
Explicit Routers explicitly mark packets to notify congestion (e.g., ECN – Explicit Congestion
Signaling Notification).

2.3 Comparison Between Open and Closed Loop Control


Feature Open-Loop Control Closed-Loop Control
Nature Preventive Reactive
Feedback Not used Required
Timing Before congestion After congestion occurs
Complexity Simple More complex
Example Window policy, admission control Choke packet, ECN, TCP congestion control

Conclusion
Congestion severely impacts network efficiency and QoS.
Open-loop control focuses on prevention, while Closed-loop control emphasizes detection and
correction.
Modern protocols like TCP use a combination of both to ensure smooth, stable, and efficient data
transmission across networks.

You might also like