IPv4 Protocol Analysis

An interactive virtual laboratory to understand the structure, addressing, and subnetting mechanisms of the Internet Protocol version 4 (IPv4).

IPv4
32-bit Addressing

Theoretical Background

1. Introduction to IPv4

Internet Protocol version 4 (IPv4) is the fourth version of the Internet Protocol (IP). It is one of the core protocols of standards-based internetworking methods in the Internet and other packet-switched networks. IPv4 was the first version deployed for production on SATNET in 1982 and on the ARPANET in January 1983.

Key Characteristics
  • Connectionless protocol (No prior connection setup).
  • Best-effort delivery (No guaranteed delivery).
  • Media Independent (Operates on any underlying hardware).

2. Packet Header Structure

The IPv4 packet header consists of 14 fields, of which 13 are required. The 14th field is optional. The header length is typically 20 bytes (without options).

Version (4)
IHL (4)
TOS (8)
Total Length (16)
Identification (16)
Flags (3)
Fragment Offset (13)
TTL (8)
Protocol (8)
Header Checksum (16)
Source IP Address (32)
Destination IP Address (32)

3. IPv4 Addressing & Classes

An IPv4 address is a 32-bit number that uniquely identifies a network interface on a machine. It is typically written in human-readable notation (Dotted Decimal).

Class A 1.0.0.0 to 127.255.255.255
Default Mask: 255.0.0.0 (/8)
Used for very large networks.
Class B 128.0.0.0 to 191.255.255.255
Default Mask: 255.255.0.0 (/16)
Used for medium-sized networks.
Class C 192.0.0.0 to 223.255.255.255
Default Mask: 255.255.255.0 (/24)
Used for small LANs.
Class D & E Multicast & Experimental.
Not for general host assignment.

4. Subnetting

Subnetting is the practice of dividing a network into two or more smaller networks. It increases routing efficiency and enhances network security.

Term Formula
Number of Subnets 2n (n = borrowed bits)
Hosts per Subnet 2h - 2 (h = host bits)

Interactive Simulation

Subnet Calculator

/24

Packet Header Lab

Construct a packet and visualize its binary representation.

Ready to Simulate

Use the controls on the left to calculate subnet details or construct a binary packet.

Lab Procedure

1

Understanding IPv4 Addressing

Start by examining the different classes of IPv4 addresses. Use the Subnet Calculator to input addresses from different classes (e.g., 10.0.0.1, 172.16.0.1, 192.168.1.1).

  • Observe how the default subnet mask changes based on the class.
  • Verify the binary representation of the first octet.
2

Subnetting Analysis

Select a Class C network (e.g., 192.168.1.0/24). Use the slider to change the CIDR prefix from /24 to /26.

  • Record the new Subnet Mask.
  • Calculate manually how many subnets are created (22 = 4).
  • Verify the results in the simulation: Network Address, Broadcast, and Host Range.
3

Packet Construction

Navigate to the Packet Builder. Construct a packet from a local host (192.168.1.10) to a remote server (8.8.8.8).

  • Set the protocol to TCP.
  • Set the TTL to 64.
  • Click "Build Packet" and observe the Header structure.
  • Hover over the binary blocks in the visualization to identify fields.

Report Writing Guidelines

Structure of the Lab Report

Follow this standard format to document your findings.

1. Aim & Objectives

State the purpose: To understand the structure of the IPv4 packet header and the mechanism of subnetting.

2. Theory

Summarize the key concepts of IPv4 addressing, classes (A, B, C), and the function of the Header fields (Version, IHL, TTL, Protocol, Checksum).

3. Procedure & Simulation Data

Document the steps taken. Include tables for your subnetting calculations. Example table columns:

IP Address CIDR Subnet Mask Network Addr Broadcast Addr Usable Hosts
192.168.1.0 /26 ... ... ... ...

4. Analysis & Conclusion

Explain the relationship between the CIDR prefix and the number of available hosts. Discuss why the Network and Broadcast addresses are reserved. Conclude with your understanding of how IPv4 facilitates internetworking.