An Internet Protocol (IP) address is a numerical label that uniquely identifies a network interface on a TCP/IP network. It serves two essential purposes:
Identification – tells which host the packet belongs to.
Location addressing – tells routers where to forward the packet.
1.1 IP‑address formats
Version
Length
Notation
Typical use
IPv4
32 bits (≈ 4.3 × 10⁹ addresses)
Decimal dotted‑quad, e.g. 192.168.1.10
Current Internet backbone, legacy devices
IPv6
128 bits (≈ 3.4 × 10³⁸ addresses)
Hexadecimal groups, e.g. 2001:0db8:85a3:0000:0000:8a2e:0370:7334
Future‑proofing, built‑in security, minimal NAT
1.2 Binary‑decimal conversion (IPv4 example)
Convert 192.168.1.10 to binary to see how the address is stored:
192 → 11000000
168 → 10101000
1 → 00000001
10 → 00001010
Result: 11000000 10101000 00000001 00001010
1.3 Public vs. private address ranges (IPv4)
Public – routable on the global Internet.
Private (non‑routable) – used inside local networks; must be translated by NAT before reaching the public Internet.
Range
CIDR notation
Number of possible hosts
10.0.0.0 – 10.255.255.255
10.0.0.0/8
16 777 214
172.16.0.0 – 172.31.255.255
172.16.0.0/12
1 048 574
192.168.0.0 – 192.168.255.255
192.168.0.0/16
65 534
2 How IP addresses enable data transmission
2.1 TCP/IP model (four layers)
Placeholder for a diagram of the TCP/IP stack showing Application → Transport → Network (IP) → Link layers.
When an application sends data, the layers add their own headers as follows:
Application layer – creates the data to be sent.
Transport layer (TCP/UDP) – encapsulates the data in a segment and adds source & destination port numbers.
Network layer (IP) – wraps the segment in an IP packet. The header contains:
Source IP address
Destination IP address
TTL (Time‑to‑Live) – initial value (commonly 64 or 128) that is decremented by each router; when it reaches 0 the packet is discarded with an ICMP “Time Exceeded” message.
Link layer – adds a frame header (MAC addresses) for the local network segment.
2.2 Routing tables and the longest‑prefix match
Every router stores a routing table containing entries of the form:
Network prefix | Subnet mask | Next‑hop interface
When a packet arrives, the router:
Performs a bitwise AND between the destination IP address and each entry’s subnet mask.
Selects the entry with the longest matching prefix (most 1‑bits) – this is the “longest‑prefix match” rule.
Forwards the packet to the indicated next‑hop.
2.3 TTL – why it exists
TTL prevents mis‑routed packets from circulating indefinitely. Each router decrements TTL by 1; if TTL reaches 0 the packet is dropped and an ICMP “Time Exceeded” message is sent back to the source.
3 Subnetting and CIDR notation
3.1 Subnet mask definition
A subnet mask is a 32‑bit binary pattern that separates the network portion from the host portion of an IPv4 address. In decimal form it appears as four octets (e.g., 255.255.255.0).
3.2 CIDR notation
Classless Inter‑Domain Routing (CIDR) expresses the size of the network prefix with a “/n” suffix, where n is the number of high‑order bits set to 1 in the mask.
Network identifier: 10.0.5.128 (bits 0‑26 are fixed)
Host range: 10.0.5.129 – 10.0.5.158
Broadcast address: 10.0.5.159
3.5 How a router uses the mask
For each routing‑table entry the router computes Destination IP AND Mask. The entry with the longest matching prefix determines the next hop (the “longest‑prefix match”).
4 Network Address Translation (NAT)
4.1 Definition
NAT is performed by a border router to map one or more private IP addresses to a public IP address when traffic leaves a local network.
4.2 Types of NAT
Static NAT – a one‑to‑one mapping between a private and a public address. Useful for servers that must be reachable from the Internet.
Dynamic NAT / Port‑Address Translation (PAT) – many private addresses share a single public address; the router distinguishes flows by using different source ports.
4.3 Typical PAT operation (step‑by‑step)
Host 192.168.1.25 sends a packet to 203.0.113.10 (a web server).
The home router replaces the source address with its public IP, e.g. 198.51.100.5, and records the original 192.168.1.25:#### in its NAT table.
Internet routers forward the packet based on the destination address 203.0.113.10.
The server replies to 198.51.100.5. The router looks up the NAT entry, restores the original private address and port, and forwards the packet to the laptop.
4.4 Why NAT is less needed with IPv6
IPv6 provides an enormous address space, allowing every device to have a globally routable address. Consequently, the primary motivation for NAT (address shortage) disappears, although NAT may still be used for privacy or policy reasons.
5 IPv4 exhaustion and the transition to IPv6
All 32‑bit IPv4 blocks have been allocated; many organisations now rely on NAT and address‑sharing techniques.
IPv6 (128‑bit) solves the shortage and adds mandatory IPsec support.
Dual‑stack operation – devices run both IPv4 and IPv6 simultaneously, choosing the appropriate protocol based on the destination.
A subnet mask (or CIDR “/n”) separates the network and host portions of an address.
Private address ranges (10/8, 172.16/12, 192.168/16) are not routable on the public Internet and require NAT.
Routers forward packets by performing a longest‑prefix match on their routing tables.
TTL limits the number of hops a packet can travel, preventing endless loops.
Static NAT provides a one‑to‑one mapping; dynamic NAT/PAT allows many private hosts to share a single public address.
IPv6’s huge address space removes the need for NAT and includes mandatory IPsec.
Security measures such as ACLs and IPsec rely on correct use of IP addressing; spoofing attacks exploit the lack of authentication in IPv4.
Dual‑stack devices can communicate over both IPv4 and IPv6, easing the transition.
Support e-Consult Kenya
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources,
past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.