A-Level Computer Science / Unit 2: Networks, Connectivity and the Internet

2.1.10 IP Addressing, Subnetting and Assignment

πŸ”’ Lesson slides are available to signed-in users. Sign in

2.1.10 IP Addressing, Subnetting and Assignment

Internet Protocol addresses identify network interfaces and help packets travel from a source network to a destination network. The address format, network prefix, assignment method and public or private status all affect how the address is used.

This section focuses on the syllabus requirements rather than the history of classful addressing. It explains IPv4 and IPv6 notation, subnetting, device association, public and private addressing, NAT, and static and dynamic allocation.

By the end of this section, you should be able to:

  • explain how source and destination IP addresses support packet delivery;
  • explain why an IP address is associated with a network interface;
  • describe IPv4 and IPv6 formats;
  • explain how a network prefix separates network and interface information;
  • describe the purpose of subnetting;
  • compare public and private IP addresses and discuss security implications;
  • explain the role of NAT;
  • distinguish static addressing from dynamic addressing.

How IP addresses are used during transmission

An IP packet carries a source IP address and a destination IP address in its header.

Header field Purpose
Source IP address Identifies the interface from which the packet originated and provides an address for replies.
Destination IP address Identifies the interface that should ultimately receive the packet.

From one network to another

  1. The sender compares the destination with its own network prefix.
  2. If the destination is local, the packet can be delivered within the LAN.
  3. If the destination is on another network, the sender passes the packet to its default gateway.
  4. Routers examine the destination IP address and match its network prefix against routing information.
  5. Each router forwards the packet towards the next network on the path.
  6. On the final network, the complete address identifies the destination interface.
Network prefix: the leading part of an IP address used to identify a network or subnet.
Interface identifier: the remaining part used to distinguish an interface within that network.

Common mistake

An IP address does not describe a physical route. Routers interpret the destination address and use their current routing information to choose each next step.

How an IP address becomes associated with a device

More precisely, an IP address is assigned to a network interface. A laptop may have one address on its WiFi interface and a different address on its wired interface. A router has several interfaces, so it normally has several IP addresses.

Network interface: the connection point through which a device communicates with a particular network.

Two common assignment methods

Method How the association is created Typical use
Manual configuration An administrator enters the address, prefix, gateway and other settings. Servers, routers, printers or other infrastructure that should remain predictable.
Automatic configuration A DHCP server offers an address and related settings for a limited lease period. Student laptops, phones and ordinary client devices.
DHCP: a network service that automatically supplies IP configuration to a client, usually for a defined lease period.

Typical DHCP exchange

  1. A newly connected client requests configuration.
  2. The DHCP service selects an available address from its pool.
  3. The service supplies the address, prefix or mask, default gateway and lease time.
  4. The client applies the settings to the relevant network interface.
  5. The address can later be renewed or returned for reuse.

Common mistake

An IP address is not permanently manufactured into the device. It can change when the device joins another network, changes interface or receives a new dynamic lease.

IPv4 format

An IPv4 address contains 32 bits. For human use, the bits are divided into four 8-bit groups called octets. Each octet is written in denary and separated by a dot.

IPv4: a 32-bit IP addressing format usually written as four denary octets.
Dotted decimal notation: the four octet values written with dots between them.

Original example

Binary octet 10101101 00110010 00001100 11000100
Denary value 173 50 12 196

10101101 00110010 00001100 11000100
becomes
173.50.12.196

Each octet must represent a value from 0 to 255.

Prefix length

A suffix such as /24 states how many leading bits form the network prefix. In 10.44.8.37/24, the first 24 bits identify the network and the final 8 bits identify an interface within it.

Common mistake

The number after the slash gives the number of prefix bits, not the number of remaining interface bits.

Exam tip

Convert each 8-bit octet separately. Do not treat the complete 32-bit address as one large denary value.

IPv6 format

IPv6 uses 128-bit addresses, providing a vastly larger address space than IPv4. The address is divided into eight groups of 16 bits. Each group is written using hexadecimal digits, with colons between groups.

IPv6: a 128-bit IP addressing format normally written as eight colon-separated hexadecimal groups.

Full and shortened forms

2001:0DB8:4A10:0000:0000:0000:0025:00B7

Leading zeros within a group may be removed, and one consecutive run of all-zero groups may be replaced by :::

2001:db8:4a10::25:b7

Comparison IPv4 IPv6
Length 32 bits 128 bits
Grouping Four 8-bit octets Eight 16-bit groups
Common notation Dotted denary Colon hexadecimal
Address-space implication Limited and heavily conserved Extremely large

Common mistake

IPv6 is not simply a 32-bit IPv4 address rewritten in hexadecimal. It uses a different 128-bit format.

Using subnetting inside a network

Subnetting divides one allocated network into smaller logical networks. The organisation borrows some interface bits and uses them as additional subnet-prefix bits.

Subnet: a smaller logical network created within a larger allocated address range.
Subnetting: extending the network prefix so that one address block can identify several internal networks.

Original example: dividing a /24 block

A campus has the private block 10.44.8.0/24 and wants four separate networks for administration, teaching, laboratories and guest devices.

Borrowing two interface bits creates four /26 subnets:

Department Subnet Address block begins at
Administration 10.44.8.0/26 10.44.8.0
Teaching 10.44.8.64/26 10.44.8.64
Laboratories 10.44.8.128/26 10.44.8.128
Guest devices 10.44.8.192/26 10.44.8.192

Why subnet?

  • Separate departments or device groups logically.
  • Control which traffic may pass between groups.
  • Reduce the size of local broadcast domains.
  • Apply different security or management policies.
  • Use one allocated address block in a structured way.

Common mistake

Subnetting does not create extra bits or increase the total size of the original block. It divides the existing address space into smaller ranges.

Public and private IP addresses

Comparison Public IP address Private IP address
Where it is used On Internet-facing interfaces and globally routed networks. Inside private IPv4 networks.
Uniqueness Must be globally unique while assigned. May be reused by unrelated private networks.
Internet routing Can be routed across the public Internet. Is not routed across the public Internet.
Typical assignment Allocated by an ISP or address authority. Allocated by the local organisation or its DHCP service.

Common private IPv4 ranges

  • 10.0.0.0/8
  • 172.16.0.0/12
  • 192.168.0.0/16

Security implications

  • A private address is not directly reachable through normal public Internet routing.
  • A public address may be reachable from outside if firewall rules and services allow it.
  • Using private addresses can reduce direct exposure of individual internal interfaces.
  • Private addressing does not encrypt traffic or remove malware, weak-password or configuration risks.
  • A firewall is still needed to enforce an inbound and outbound security policy.

Common mistake

A private IP address does not automatically make a device secure. It limits direct public routing, but security still depends on firewalls, updates, authentication and configuration.

Exam tip

Avoid writing only β€œprivate is safer”. State the mechanism: private addresses are not publicly routed, so outside devices cannot normally initiate direct communication to them without translation or an explicitly configured forwarding rule.

Network Address Translation

Private IPv4 devices normally need translation when communicating with the public Internet. A router or firewall performs Network Address Translation (NAT).

NAT: a process that replaces private and public address information as packets cross the boundary between a private network and the Internet.
  1. An internal device sends a packet using its private source address.
  2. The NAT device records the connection and replaces the private source with its public address.
  3. The Internet server sends the reply to the public address.
  4. The NAT device uses its recorded mapping to deliver the reply to the correct private interface.

What NAT contributes

  • Many internal devices can share a smaller number of public IPv4 addresses.
  • Internal address choices are hidden from normal public routing.
  • Unsolicited inbound packets have no existing translation mapping unless forwarding is configured.

Common mistake

NAT is not a complete security system. A firewall decides which communication is allowed; NAT primarily translates addressing information.

Static and dynamic IP addresses

Comparison Static address Dynamic address
Change over time Intended to remain fixed. Can be changed or reassigned.
How it is configured Manually or through a reserved assignment. Usually allocated automatically by DHCP or an ISP.
Typical use Servers, routers, printers and services that must be found predictably. Ordinary client devices and consumer Internet connections.
Administration Requires planning to avoid duplicates and incorrect settings. Reduces manual configuration and allows address reuse.
Security implication A stable public address can make a hosted service consistently reachable and consistently targetable. Changing an address provides little protection by itself and should not be treated as a security control.
Static IP address: an address intended to remain unchanged.
Dynamic IP address: an address supplied from a pool and available for later reassignment.

Common mistake

Dynamic does not mean that the address changes continuously. It means the assignment is temporary and may change when the lease or connection changes.

Interactive: IP Address Explorer

Use the four tabs below to explore key addressing ideas: how IPv4 bytes become dotted decimal, how CIDR divides an address into a netID and hostID, and how sub-netting reuses hostID bits inside one organisation.

IPv4 notation visualiser

Enter four decimal bytes. The widget shows the matching 32-bit binary address.

Dotted decimal 150.20.7.45

CIDR netID / hostID visualiser

Choose an address and a CIDR suffix. The highlighted bits show where the netID ends and the hostID begins.

netID bits 20
hostID bits 12
HostID codes 4096
netID bits hostID bits

Sub-netting visualiser

Start with an 8-bit hostID. Choose how many of those bits are reused as the internal LAN code.

LAN code workstation code
LAN code 101
LAN number 5
Workstation code 01100
Workstation number 12

NAT translation demo

Choose one internal device and send a request to the Internet. Watch the private source address being replaced by the public address of the NAT box.

Private network

NAT box Public IP 203.0.113.8
Internet Destination server 198.51.100.40

Select an internal device, then send a request.

  1. Step 1: The device sends a packet using its private internal IP address.
  2. Step 2: The NAT box replaces the private source address with its public IP address.
  3. Step 3: The Internet server replies to the public address of the NAT box.
  4. Step 4: The NAT box sends the reply back to the correct internal device.

Practice

Core understanding

  1. Explain the use of source and destination IP addresses in a packet.
  2. Explain why an address is assigned to a network interface rather than permanently to a whole device.
  3. Describe the format of an IPv4 address.
  4. Describe the format of an IPv6 address.
  5. Explain the purpose of subnetting.
  6. Compare public and private IP addresses.
  7. Explain one security implication of using a public address.
  8. Distinguish a static address from a dynamic address.

Address interpretation

  1. Convert 11000001 00101100 00001001 01110010 to dotted decimal notation.
  2. How many interface bits remain in an IPv4 address with a /27 prefix?
  3. Explain what the /26 means in 10.44.8.128/26.
  4. Shorten 2001:0DB8:0000:0000:0031:0000:0000:0009 using valid IPv6 abbreviation.

Scenario: a new media studio

A studio has staff laptops, a shared printer, an internal file server and a public website.

  1. Which devices are suitable for dynamic private addresses?
  2. Which internal devices may need predictable static or reserved addresses?
  3. Which service needs a public Internet-facing address?
  4. Explain why NAT alone is not sufficient protection.
  5. Suggest one reason to place guest devices on a separate subnet.

Review

Concept Key idea
IP packet addressing Source and destination addresses support delivery and replies.
IPv4 32 bits written as four dotted denary octets.
IPv6 128 bits written as colon-separated hexadecimal groups.
Subnetting Extends a prefix to divide one address block into smaller networks.
Public address Globally unique and routable through the public Internet.
Private address Reusable internally and not publicly routed.
NAT Translates between private internal addressing and public Internet addressing.
Static address Intended to remain fixed.
Dynamic address Automatically leased and available for reassignment.

Quick self-check

  1. Can I trace how a destination IP address is used across networks?
  2. Can I explain how DHCP associates an address with an interface?
  3. Can I identify valid IPv4 and IPv6 notation?
  4. Can I explain why an organisation creates subnets?
  5. Can I discuss public/private security without claiming that private means fully secure?
  6. Can I choose static or dynamic addressing for a scenario?