Master the Basics of IP: From Addresses to Subnetting and Beyond
This comprehensive guide demystifies IP fundamentals, covering the role of IP in the network layer, IPv4 address structure, classful and classless addressing, subnet masks, public and private ranges, routing, loopback, fragmentation, IPv6 differences, and essential protocols like DNS, ARP, DHCP, NAT, ICMP, and IGMP.
Introduction
This article provides a concise technical tutorial on IP address classification, subnetting, and related networking concepts.
IP Basics – Appetizer
Network‑Layer Role
In the TCP/IP model, IP resides in the third layer, the network layer . Its primary function is to enable end‑to‑end communication between hosts across different networks.
How does the network layer relate to the data‑link layer?
IP vs. MAC
IP addresses identify hosts across separate networks, while MAC addresses operate only on a single link. An IP address remains constant for a packet’s entire journey, whereas MAC addresses may change at each hop.
IP Address Fundamentals – Main Dish
IPv4 Representation
An IPv4 address is a 32‑bit unsigned integer. Humans typically write it in dotted‑decimal notation, splitting the 32 bits into four 8‑bit octets separated by periods.
The address space contains roughly 4.3 billion possible host addresses.
Classful Addressing
Early IPv4 design defined five classes (A–E). Classes A, B, and C contain a network number and a host number . The table below (image) shows the address ranges and maximum host counts for each class.
Why are the maximum host numbers reduced by two?
Two addresses in each subnet are reserved: the all‑zeros host address (network identifier) and the all‑ones host address (broadcast).
The all‑zeros address identifies the subnet itself.
The all‑ones address is used for broadcasting to every host in the subnet.
Classless Inter‑Domain Routing (CIDR)
Classful addressing wastes address space. CIDR replaces it with a.b.c.d/x notation, where /x specifies the number of leading bits that form the network prefix (0–32).
Example: 10.100.122.2/24 – the first 24 bits are the network part, the remaining 8 bits are the host part.
Subnet Masks and Subnetting
A subnet mask isolates the network portion of an IP address. Performing a bitwise AND between the mask and the IP address yields the network address.
Example: For the C‑class network 192.168.1.0 with mask 255.255.255.192, two host bits are borrowed to create four subnets, each with 62 usable hosts.
Public vs. Private IP Addresses
Within each class, specific ranges are reserved for private use (e.g., 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16). Private addresses are managed internally and can be reused across organizations. Public addresses are allocated globally by IANA under the authority of ICANN.
Routing and Loopback
Routers use the network portion of an IP address to make forwarding decisions, applying longest‑prefix matching.
Host A sends a packet to 10.1.2.10 but finds no matching route, so it forwards the packet to its default router (router 1).
Router 1 matches the destination network and forwards the packet to router 2.
Router 2 delivers the packet to the target host.
The loopback address 127.0.0.1 (hostname localhost) is used for intra‑host communication and never leaves the machine.
Fragmentation and Reassembly
Each link layer defines a maximum transmission unit (MTU). If an IP packet exceeds the MTU, it is fragmented. Only the destination host reassembles fragments; routers forward fragments unchanged. TCP mitigates fragmentation by limiting segment size to the path MTU (Maximum Segment Size, MSS).
IPv6 Overview – Dessert
Address Size and Notation
IPv6 uses 128‑bit addresses, written as eight 16‑bit hexadecimal groups separated by colons. Consecutive groups of zeros can be compressed to :: (allowed only once per address).
Header Improvements
IPv6 headers are fixed at 40 bytes, omit the checksum field, and do not support in‑router fragmentation. Options are moved to extension headers, simplifying processing.
Checksum removed – link‑layer and transport‑layer already verify data.
Fragmentation handled only by endpoints.
Extension headers carry optional information.
Related Protocols
DNS – Domain Name System
DNS translates human‑readable domain names into IP addresses. Resolution follows a hierarchical tree: root → top‑level domain (e.g., .com) → authoritative server.
ARP and RARP
When a host knows the destination IP but not the MAC, it broadcasts an ARP request. The owner of the IP replies with its MAC address. RARP works the opposite way: a device knows its MAC and asks a RARP server for its IP.
DHCP – Dynamic Host Configuration Protocol
DHCP automates IP configuration in four steps: DISCOVER (broadcast), OFFER (server response), REQUEST (client selects an offer), and ACK (server confirms). DHCP clients listen on UDP port 68; servers listen on port 67. DHCP relay agents allow a single server to serve multiple subnets.
NAT and NAPT
Network Address Translation (NAT) enables many private hosts to share a single public IP. NAPT (Port‑Address Translation) also maps source ports, allowing multiple simultaneous connections from the same public address.
ICMP – Internet Control Message Protocol
ICMP reports errors and diagnostics (e.g., destination unreachable). Routers generate ICMP messages when they cannot forward a packet, informing the source host of the failure reason.
IGMP – Internet Group Management Protocol
IGMP manages multicast group membership between hosts and the last‑hop router. Hosts send IGMP join/leave messages; routers use these to decide whether to forward multicast traffic.
References
[1] Computer Networks – A Top‑Down Approach, Chen Ming (translated), Mechanical Industry Press.
[2] TCP/IP Illustrated, Volume 1, Fen Jianhua (translated), Mechanical Industry Press.
[3] Illustrated TCP/IP, Takehiko Takei, People's Posts and Telecommunications Press.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
