IPv4 Addressing & Subnetting
IPv4 Addressing & Subnetting
๐ง COMPREHENSIVE NOTES ON IPv4 ADDRESSING & SUBNETTING
๐งฉ I. FUNDAMENTALS OF IP ADDRESSING
๐น A. Why IP Addresses Are Needed
- The Internet Protocol (IP) assigns unique identifiers to devices so they can exchange data.
- In a simple two-device (point-to-point) link, identifiers arenโt needed since data flows directly.
- In any network with three or more devices, unique addresses are essential for correct delivery.
๐น B. Address Function Across OSI Layers
| Layer | Type of Address | Description |
|---|---|---|
| Layer 2 (Data Link) | MAC Address | Unique per device; doesnโt indicate location (like a name). |
| Layer 3 (Network) | IP Address (IPv4 / IPv6) | Indicates both who and where a device is located. |
When data moves across a network, IP encapsulates it in a packet, tagging both:
- Source IP: Origin of the packet
- Destination IP: Target deviceโs address
๐ II. IPv4 ADDRESS STRUCTURE
- Total Length: 32 bits
- Human Representation: Four octets in dotted-decimal form (e.g.,
192.168.1.10) - Binary Division: 4 octets ร 8 bits = 32 bits
Each IPv4 address has:
- Network Portion: Identifies the network segment (shared by all devices in that subnet).
- Host Portion: Uniquely identifies the device within that network.
๐งฎ III. ROLE OF THE SUBNET MASK
๐น A. Function of a Subnet Mask
- Definition: A 32-bit number that determines which part of the IP address represents the network vs. the host.
- Display: Dotted-decimal form (e.g.,
255.255.255.0). - Rules of Comparison:
255โ Corresponding bits are network bits.0โ Corresponding bits are host bits.
๐น Routing Logic
- If the destination is within the same subnet, packets are sent directly.
- If outside, theyโre forwarded to the default gateway (router).
๐น B. IPv6 Comparison
| Feature | IPv4 | IPv6 |
|---|---|---|
| Address Length | 32 bits | 128 bits |
| Format | Dotted-decimal | Hexadecimal with colons |
| Subnet Notation | Mask or / slash (e.g., /24) | Always uses / notation (e.g., /64) |
| Parts | Network + Host | Prefix + Interface ID |
๐ IV. TYPES OF IPv4 ADDRESSES
๐น A. Public vs. Private
| Type | Purpose | Address Range |
|---|---|---|
| Public | Globally unique, routable on the Internet. Any address not in private range (1.0.0.0โ9.x.x.x, 11.x.x.xโ126.x.x.x, 128.x.x.xโ223.x.x.x). | โ |
| Private | Used only within local networks. Not Internet-routable. | 10.0.0.0 โ 10.255.255.255172.16.0.0 โ 172.31.255.255192.168.0.0 โ 192.168.255.255 |
๐น B. Reserved IPv4 Addresses
| Type | Rule | Example |
|---|---|---|
| Network Address | All host bits = 0 | 20.1.17.0/24 |
| Broadcast Address | All host bits = 1 | 20.1.17.255 |
| Limited Broadcast | Reaches all local devices; not routed beyond local network. | 255.255.255.255 |
โ ๏ธ Note: IPv6 does not use broadcast addresses.
๐ฅ๏ธ V. ADDRESS ASSIGNMENT METHODS
| Method | Description |
|---|---|
| DHCP (Dynamic) | Device requests IP, subnet mask, gateway, and DNS from DHCP server. |
| Static | Manually assigned and unchanging; common for servers and routers. |
| APIPA (Automatic Private IP Addressing) | Self-assigned IP (169.254.x.x) when DHCP fails โ indicates a connectivity issue. |
๐งฑ VI. SUBNETTING
๐น A. Why Subnetting Is Used
- To segment large networks for better security, management, and traffic control.
- Example: Separating HR, Finance, and Engineering into their own subnets.
๐น B. How Subnetting Works
- Subnetting involves extending the subnet mask by converting host bits into network bits.
- This allows multiple smaller subnets under one larger parent network.
๐น C. Subnet Calculation (The โFinger Methodโ)
- Determine the required number of subnets.
- Use powers of two to calculate how many bits to borrow:
- 1 bit โ 2 subnets
- 2 bits โ 4 subnets
- 3 bits โ 8 subnets
- 4 bits โ 16 subnets
- 5 bits โ 32 subnets
- Add the borrowed bits to the existing mask to find the new subnet mask.
๐น D. Special Case: /31 Subnet Mask
- Used for point-to-point links (two devices only).
- Leaves just 1 host bit, enabling exactly 2 usable addresses.
- Routers treat both addresses as valid (breaking the typical โno all-zeros/all-onesโ rule).
โ๏ธ VII. RELATED NETWORKING CONCEPTS
| Concept | Description |
|---|---|
| DNS (Domain Name System) | Translates human-readable names into IP addresses. Example: 8.8.8.8 (Google DNS). |
| Wireshark | Packet capture and analysis tool showing real-time source and destination IPs. |
| Wildcard Mask | Used mainly in ACLs (Access Control Lists). Reverse of a subnet mask: 0 = must match, 1 = ignore bit. Example: Subnet Mask 255.255.255.0 โ Wildcard Mask 0.0.0.255. |
๐ก QUICK RECAP: IPv4 Essentials for Interview & Revision
โ
IPv4 = 32-bit addressing system using dotted-decimal format.
โ
Subnet Mask determines Network vs. Host bits.
โ
Private IPs are for internal use only.
โ
Broadcast & Network addresses are reserved.
โ
Subnetting enhances efficiency, control, and security.
โ
/31 mask is optimized for router-to-router links.
โ
DHCP automates IP assignment; APIPA indicates DHCP failure.
โ
DNS resolves names; Wireshark inspects packets.
โ
Wildcard Masks are used for security filtering.
๐ Created for:
- Learners preparing for networking certifications (CCNA, CompTIA, etc.)
- Interviewers seeking precise technical evaluation points
- Engineers wanting quick refreshers on IPv4 and subnetting fundamentals
๐ Connect With Me
This post is licensed under CC BY 4.0 by the author.