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

2.1.7 IP Addressing I — Purpose, IPv4, IPv6 and Interfaces

🔒 Lesson slides are available to signed-in users. Sign in

2.1.7 IP Addressing I — Purpose, IPv4, IPv6 and Interfaces

A network message can cross several networks before it reaches the correct device. To support this journey, the Internet Protocol (IP) uses addresses. In this lesson, you will learn why IP addresses matter, how to recognise IPv4 and IPv6, and how addresses are linked to a device's network interfaces.

Focus on the address formats and the reason each address is used. Detailed subnetting and address categories are covered in IP Addressing II.

After studying this page, you should be able to

  • explain why a packet includes source and destination IP addresses;
  • recognise the 32-bit dotted-denary format of IPv4;
  • recognise the 128-bit hexadecimal format of IPv6;
  • apply simple, correct rules for shortening IPv6 addresses;
  • explain why one computer may use different IP addresses on different network interfaces.

1. Why is an IP address needed?

Imagine an electronic noticeboard at a coastal weather station. It receives measurements from a computer at a different site. The sending computer must state where the data should be delivered. An IP address provides the information used for network-to-network delivery.

IP address: a numerical address associated with a network interface, used in sending data to and from that interface across IP networks.

An address does not contain a map of the entire journey. A router reads the destination IP address and uses its routing information to select the next direction for a packet. Several routers may do this before the packet arrives.

Write what happens, not only why it is useful

An accurate explanation says that an IP address names the destination interface and enables routers to forward packets towards its network. Simply saying that an IP address “connects devices” gives too little detail.

2. Source and destination addresses in a packet

The IP packet header contains address information used during delivery. The sender's address and the receiver's address have different roles.

FieldWhat it identifiesHow it is used
Source IPThe originating network interface.The receiver can use it as the destination address of a reply.
Destination IPThe intended receiving interface.Routers use this address when deciding where to forward the packet.
Sender 198.51.100.18 Router Checks destination IP address Receiver 203.0.113.76 Example addresses are reserved for documentation.

IP is not the same as a MAC address

An ordinary LAN switch mainly uses MAC addresses to forward Ethernet frames locally. An IP router uses destination IP addresses to move packets between networks. The two kinds of address serve different purposes.

3. IPv4 — four numbers written with dots

IPv4: version 4 of the Internet Protocol. Its address contains 32 bits, arranged as four 8-bit groups called octets.

People normally write each octet as a denary (base-10) number. A full IPv4 address therefore has four numbers separated by three dots.

1985110018 ... 8 bits8 bits8 bits8 bits

An 8-bit group can store numbers from 0 through 255. That is why an IPv4 number cannot contain an octet larger than 255. Each of the four values is written separately: the dots are not decimal points in one large number.

Why is the largest octet value 255?

Eight bits can form 256 different patterns, from 00000000 to 11111111. Since counting begins at zero, the greatest denary value is 255.

4. Checking an IPv4 address

First check the arrangement of the address. You do not need to know which organisation uses it.

CandidateCorrect IPv4 format?Reason
198.51.100.18YesFour denary values; each fits within an 8-bit octet.
198.51.100.291NoThe last value is greater than 255.
198.51.18NoOnly three groups are shown.
198.51.R.18NoAn IPv4 octet is written as a denary number, not a letter.

Format and real-world use are different questions

An address can follow IPv4 writing rules without being suitable for every network. The simple checks above concern notation, not whether the address is allocated for public use or available to a particular device.

5. IPv6 — a longer address written in hexadecimal

IPv6: version 6 of the Internet Protocol. Each address has 128 bits, which is four times the bit length of IPv4.

The complete written form has eight groups separated by colons. Every group represents 16 bits and is normally displayed using four hexadecimal digits (0–9 and A–F).

2001:0DB8:0035:0000:0000:0000:0000:00C9
PropertyIPv6
Address length128 binary digits (bits)
Complete formEight groups, 16 bits per group
Written number systemHexadecimal
SeparatorA colon between groups
Main reason for introductionIts far larger address space allows many more network interfaces to be addressed.

Important comparison

IPv6 is not an IPv4 address with different punctuation. It represents 128 bits instead of 32 bits and uses hexadecimal groups.

6. Reading a shortened IPv6 address

Long IPv6 addresses often contain zeros. There are two ways to make the written form shorter without changing the underlying 128-bit value.

  1. Remove zeros at the beginning of a group. For example, 0035 can be written as 35.
  2. Compress one continuous run of all-zero groups. Write a double colon (::) in place of those groups.

See the change:

Full form: 2001:0DB8:0035:0000:0000:0000:0000:00C9
Short form: 2001:DB8:35::C9

The double colon can be used only once in one IPv6 address. Using it twice would make it unclear how many groups of zeros were removed.

Check yourself: Is 2001:DB8::4::9 a valid shortening?

No. There are two double-colon shortcuts. A single address cannot use this shortcut in two separate places.

Another useful check

The letter G is not a hexadecimal digit. Only 0–9 and A–F can appear inside a hexadecimal address group.

7. How is an IP address associated with a device?

It is common to say that a computer “has an IP address”. A more precise description is that the address is assigned to a network interface—the connection a device uses to join a network.

Network interface: the wired or wireless connection point used by a device to exchange data with a particular network.

A portable computer may be connected through both Wi-Fi and an Ethernet cable. The Wi-Fi connection and the wired connection are separate interfaces, so they can be given different IP addresses. An interface can also have more than one address.

DeviceInterfaceIllustrative IP address
One portable computerWireless (WNIC)192.168.60.14
The same portable computerWired (NIC)10.23.5.14
A routerOne of its network-facing interfaces192.168.60.1

Where does the address come from?

The network can supply configuration automatically, or an administrator can set it manually. The address may be different if the device later joins another network. The advantages of fixed and automatically assigned addresses are explored in IP Addressing II.

Common mistake

Do not describe an IP address as a permanent serial number built into a computer. An IP address is configured for network communication and may change. A MAC address is a different kind of address used for local communication.

8. Compare the two address formats

FeatureIPv4IPv6
Length32 bits128 bits
Full written structureFour groupsEight groups
Digits usedDenaryHexadecimal
SeparatorDot (.)Colon (:)
Example203.0.113.762001:DB8:35::C9
Address spaceSmaller; limited number of combinationsMuch larger number of possible addresses

Exam language

A good comparison states the feature for both formats. For example: “IPv4 uses 32 bits and four dotted denary values, whereas IPv6 uses 128 bits and hexadecimal groups separated by colons.”

9. Worked example — choosing the correct address

A technician is checking the network details for a new information screen at a marine research station. The device can use either IPv4 or IPv6.

Check A: Is 203.0.113.260 a valid IPv4 representation?

No. The value 260 cannot fit into an 8-bit octet. Its maximum value is 255.

Check B: Does 2001:DB8:35::C9 resemble IPv4 or IPv6?

IPv6. It uses hexadecimal notation with colon separators and an allowed zero-group shortcut.

Check C: Why can its Wi-Fi and wired interfaces use different addresses?

The two connections are separate network interfaces. Each can be configured for its own network, with a suitable IP address.

Practice — explain and apply

Short questions

  1. Explain why a packet needs a destination IP address. [2]
  2. Explain one difference between a MAC address and an IP address. [2]
  3. State the bit lengths of IPv4 and IPv6. [2]
  4. Explain why 203.0.113.280 has an invalid IPv4 format. [2]
  5. Describe the full IPv6 writing format, including the number system and separator. [3]
  6. Explain why a device may have more than one IP address. [2]
Reveal suggested marking points

1 [2]: The address identifies the intended interface or destination network [1]; routers use it when forwarding the packet [1].

2 [2]: MAC is used for local frame delivery by LAN hardware [1]; IP is used for addressing packets between networks [1].

3 [2]: IPv4 = 32 bits [1]; IPv6 = 128 bits [1].

4 [2]: The octet 280 is too large [1]; an octet stores 0–255 because it contains 8 bits [1].

5 [3]: Eight groups [1]; hexadecimal [1]; groups separated by colons [1].

6 [2]: The device has separate wired and wireless interfaces, or multiple interfaces [1]; each interface can be configured with a different IP address [1].

These are original classroom marking suggestions, not an official Cambridge mark scheme. Equivalent correct wording is acceptable.

Review — the five facts to keep

Check your understanding

  1. A packet has a destination IP, which routers use during forwarding.
  2. IPv4 has 32 bits and is written as four dotted denary octets.
  3. IPv6 has 128 bits and normally uses eight colon-separated hexadecimal groups.
  4. IPv6 leading zeros can be removed; one run of zero groups can be shortened with ::.
  5. An IP address belongs to a network interface and is not necessarily permanent.

Next lesson: how IP addresses are divided into network and host portions, and why public/private and static/dynamic addresses are different choices.