Explain the use of IP addresses in the transmission of data over the internet

2.1 Networks – The Internet

Learning objective

Explain how IP addresses are used to transmit data over the Internet, covering:

  • address format (IPv4 & IPv6)
  • identification, routing and TTL
  • subnetting and CIDR notation
  • network address translation (static & dynamic/PAT)
  • IPv4 exhaustion, IPv6 adoption and dual‑stack operation
  • basic security implications (IP spoofing, firewall ACLs)

1 What is an IP address?

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

VersionLengthNotationTypical use
IPv432 bits (≈ 4.3 × 10⁹ addresses)Decimal dotted‑quad, e.g. 192.168.1.10Current Internet backbone, legacy devices
IPv6128 bits (≈ 3.4 × 10³⁸ addresses)Hexadecimal groups, e.g. 2001:0db8:85a3:0000:0000:8a2e:0370:7334Future‑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.

RangeCIDR notationNumber of possible hosts
10.0.0.0 – 10.255.255.25510.0.0.0/816 777 214
172.16.0.0 – 172.31.255.255172.16.0.0/121 048 574
192.168.0.0 – 192.168.255.255192.168.0.0/1665 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:

  1. Application layer – creates the data to be sent.
  2. Transport layer (TCP/UDP) – encapsulates the data in a segment and adds source & destination port numbers.
  3. 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.

  4. 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:

  1. Performs a bitwise AND between the destination IP address and each entry’s subnet mask.
  2. Selects the entry with the longest matching prefix (most 1‑bits) – this is the “longest‑prefix match” rule.
  3. 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.

3.3 Worked example – /24 prefix

Address: 192.168.12.45/24

  • Network prefix: first 24 bits → 192.168.12.0
  • Subnet mask: 255.255.255.0 (binary 11111111 11111111 11111111 00000000)
  • Host identifier: last 8 bits → 45

3.4 Worked example – non‑/24 prefix (/27)

Address: 10.0.5.130/27

  • Prefix length = 27 bits → subnet mask 255.255.255.224 (binary 11111111 11111111 11111111 11100000)
  • 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)

  1. Host 192.168.1.25 sends a packet to 203.0.113.10 (a web server).
  2. 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.
  3. Internet routers forward the packet based on the destination address 203.0.113.10.
  4. 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.
  • Transition mechanisms (e.g., tunnelling, NAT64/DNS64) allow gradual migration.

6 Key differences between IPv4 and IPv6

AspectIPv4IPv6
Address length32 bits128 bits
NotationDecimal dotted‑quadHexadecimal groups
Header sizeFixed 20 bytes (minimum)Base 40 bytes, optional extensions
Built‑in securityNone (IPsec optional)IPsec mandatory
FragmentationRouters and hosts may fragmentOnly the source host fragments
NAT requirementCommonly neededRarely needed (large address space)

7 Security considerations linked to IP addressing

  • IP spoofing – an attacker forges the source IP address to hide identity or to launch a denial‑of‑service attack.
  • Firewall ACLs (Access Control Lists) – rules that permit or deny traffic based on source/destination IP addresses, ports and protocols.
  • Distinguishing public from private addresses helps prevent accidental exposure of internal services to the Internet.
  • IPv6’s built‑in IPsec encourages encrypted traffic, reducing the risk of eavesdropping.

8 Diagram suggestions

Flow of an IP packet: private host → NAT router → Internet backbone routers → destination server → reply → NAT router → private host.

TCP/IP stack showing where the IP header sits (Network layer) and the relationship to Transport (TCP/UDP) and Application layers.

9 Key points to remember

  • IP addresses uniquely identify devices and guide packet routing.
  • IPv4 uses 32‑bit dotted‑quad addresses; IPv6 uses 128‑bit hexadecimal groups.
  • 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.