Post

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

LayerType of AddressDescription
Layer 2 (Data Link)MAC AddressUnique 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:

  1. Network Portion: Identifies the network segment (shared by all devices in that subnet).
  2. 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

FeatureIPv4IPv6
Address Length32 bits128 bits
FormatDotted-decimalHexadecimal with colons
Subnet NotationMask or / slash (e.g., /24)Always uses / notation (e.g., /64)
PartsNetwork + HostPrefix + Interface ID

๐ŸŒ IV. TYPES OF IPv4 ADDRESSES

๐Ÿ”น A. Public vs. Private

TypePurposeAddress Range
PublicGlobally 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).โ€”
PrivateUsed only within local networks. Not Internet-routable.10.0.0.0 โ€“ 10.255.255.255
172.16.0.0 โ€“ 172.31.255.255
192.168.0.0 โ€“ 192.168.255.255

๐Ÿ”น B. Reserved IPv4 Addresses

TypeRuleExample
Network AddressAll host bits = 020.1.17.0/24
Broadcast AddressAll host bits = 120.1.17.255
Limited BroadcastReaches all local devices; not routed beyond local network.255.255.255.255

โš ๏ธ Note: IPv6 does not use broadcast addresses.

๐Ÿ–ฅ๏ธ V. ADDRESS ASSIGNMENT METHODS

MethodDescription
DHCP (Dynamic)Device requests IP, subnet mask, gateway, and DNS from DHCP server.
StaticManually 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โ€)

  1. Determine the required number of subnets.
  2. 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
  3. 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).
ConceptDescription
DNS (Domain Name System)Translates human-readable names into IP addresses. Example: 8.8.8.8 (Google DNS).
WiresharkPacket capture and analysis tool showing real-time source and destination IPs.
Wildcard MaskUsed 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

GitHub LinkedIn YouTube Gmail

This post is licensed under CC BY 4.0 by the author.