Study Guide

IPv4 and IPv6 Addresses

What an IP address is, how an IPv4 address is built from four octets, public, private and special addresses, and how IPv6 addresses are written.

Lesson 3.5 Networking Fundamentals

For data to reach the right device, every device needs an address, just as a letter needs one. This lesson is about the address used to find a device anywhere in the world: what it is for, how it is built, and the different kinds.

Stage: Think

Sending a parcel

Think it through

A parcel travels from Leeds to a house in Glasgow, passing through three depots on the way. What on the parcel stays the same for the whole journey, and what changes at each depot?

Show what happens

The destination on the label never changes. Where it is sent next changes at every depot. Networks use two kinds of address in exactly this way.

Think it through

What does a depot need to read to decide where to send the parcel next?
Show the answer

Answer: B. The final destination, to choose the next depot.

The final destination. From it, each depot works out the next stop. The two network addresses divide the work in the same way.

Stage: Explain

IP addresses and MAC addresses

A device on a network has two addresses, and a parcel shows why. A parcel has a label with the final destination, which stays on it for the whole journey. At each stage it is also sent to the next depot, and that changes every time it is handed on.

  • The IP address is the label. IP stands for Internet Protocol, the set of rules for addressing and moving data across networks.
  • The MAC address is the next depot. It is a number built into each network interface, used to hand data to the next device on the local network.
QuestionIP addressMAC address
What is it like?The destination on a parcel’s labelThe address of the next depot
What is it for?Finding the right device across many networks, anywhere in the worldHanding data to the next device on the local network
Does it change on the journey?No: it stays the same from sender to receiverYes: it is replaced at every router on the way
What does one look like?192.168.1.1000:1A:2B:3C:4D:5E
Which device reads it?RoutersSwitches
Which layer is it?Layer 3, NetworkLayer 2, Data Link

Check your understanding

A packet crosses three routers on its way. Which of its two addresses is replaced at every router?
Show the answer

Answer: C. The MAC address: it is replaced each time.

The MAC address, which says which device on each local network receives the data next. The IP address normally stays the same from sender to receiver.

Where the comparison stops. A parcel’s label is never rewritten. An IP address sometimes is: a home or school router usually swaps the sender’s address on the way out to the internet. That is called address translation and is taught in IP forwarding, default gateways and NAT/PAT.

The rest of this lesson is about IP addresses. Ethernet Switching and MAC Addresses covers MAC addresses.

Stage: Predict

The structure of an IPv4 address

The version of IP in use since the early internet is version 4, IPv4. An IPv4 address is 32 bits long: thirty-two ones and zeros. Nobody wants to read that, so it is split into four groups of eight bits, called octets, and each octet is written as an ordinary number from 0 to 255 with dots between them. This is called dotted decimal.

192.168.1.10 is four octets: 32 bits in all

192.168.1.10 is four octets, 192, 168, 1, 10, which in binary are 11000000, 10101000, 00000001, 00001010: 32 bits in total.

4 octets × 8 bits = 32 bits. The dots separate the octets.

Think it through

Look at 192.168.1.10 and 192.168.1.77. What do the two addresses share, and what might that tell you?

Show what happens

They share the first three octets, 192.168.1, and differ only in the last. Like a street name and a house number, the shared part can say which network, and the rest which device.

Network and host portions

Every IPv4 address has two parts, usually labelled N and H:

  • the network portion (N), shared by every device on the same network, like a street name;
  • the host portion (H), which identifies one device on that network, like a house number.
192.168.1.10 with a /24 boundary: three network octets, one host octet

192.168.1.10/24: the first 24 bits are the network portion and the last 8 bits are the host portion. Applying the /24 mask gives the network address 192.168.1.0.

N Network portion: 24 bits H Host portion: 8 bits

In this example the first three octets are the street and the last is the house, so 192.168.1.10 and 192.168.1.77 are neighbours on the same network.

The address alone does not say where the boundary falls. A second setting does that. It is often written after the address as a slash and a number, such as /24, meaning “the first 24 bits are the network portion”. The next lesson explains it fully; for now, read /24 as “the first three octets are the network”.

Stage: Predict

Public and private addresses

Think it through

There are about 4.3 billion IPv4 addresses, but more devices than that. How could every device still have one?
Show the answer

Answer: B. Reuse the same addresses inside separate buildings.

Reuse addresses inside separate buildings, where the internet never sees them. Those are private addresses.

IPv4 has about 4.3 billion possible addresses, which is fewer than the number of devices in the world. One way the shortage is managed is by letting the same addresses be reused inside separate buildings.

  • A public address is unique across the whole internet, so data can be sent to it from anywhere.
  • A private IPv4 address is used only inside one organisation’s or household’s network. The same private addresses are used again in millions of other buildings, so the internet does not carry traffic addressed to them.

A school is a good example. Every computer inside it has a private address. The school’s router has one public address, given to it by the company that provides the internet connection. When a computer inside sends something to the internet, the router replaces the private address with its own public one on the way out, and reverses the swap for the reply. That is the address translation mentioned where the parcel comparison stops, usually shortened to NAT.

Private IPv4 and IPv6

Three ranges of IPv4 addresses are reserved for private use. They are often called the RFC 1918 ranges. An RFC, or Request for Comments, is a numbered internet standards document, and number 1918 is the one that set these ranges aside.

Private rangeFirst addressLast addressHow to recognise it
10.0.0.0/810.0.0.010.255.255.255Starts with 10.
172.16.0.0/12172.16.0.0172.31.255.255Starts with 172, and the second number is from 16 to 31.
192.168.0.0/16192.168.0.0192.168.255.255Starts with 192.168.

Check your understanding

Using the table, is 172.32.0.5 a private address?
Show the answer

Answer: B. No: the second number must be from 16 to 31.

No. Only 172.16 to 172.31 is private, and 32 is just outside it. The example below checks five more.

A technician is handed five addresses and asked which are private. Check each one against the three ranges, in order.

  1. 10.200.3.4 starts with 10. Private.
  2. 172.20.1.1 starts with 172, and the second number, 20, is between 16 and 31. Private.
  3. 172.40.1.1 starts with 172, but 40 is outside 16 to 31. Not private. This is the one that catches people out: only part of the 172 range is reserved.
  4. 192.169.1.1 starts with 192, but the second number is 169, not 168. Not private.
  5. 198.51.100.7 is in none of the three ranges, so it is not private. It is not an ordinary public address either: it belongs to a range reserved for examples, described in the next section.

What the last case shows: “not private” does not mean “public”. Other ranges are set aside for other purposes.

IPv6, the newer version of IP described at the end of this lesson, has its own equivalent of private addresses, called unique local addresses.

Stage: Predict

Other special IPv4 addresses

Think it through

A laptop shows the address 169.254.12.7 and cannot reach anything, while its neighbours work normally. What might have gone wrong?

Show what happens

It gave itself an address because nothing answered when it asked for one automatically. That range has a special meaning, listed below with the others worth recognising.

A few more ranges are worth recognising, because they explain things you will see on real devices:

  • Loopback, 127.0.0.0/8: a loopback address is one a device uses to talk to itself, usually 127.0.0.1. The VyOS routing table in Routing, default gateways and NAT/PAT lists 127.0.0.0/8 on its loopback interface.
  • Link-local, 169.254.0.0/16: an address some systems give themselves when the service that normally hands out addresses automatically (DHCP, taught in a later lesson) does not answer. Seeing one usually means automatic configuration failed.
  • Documentation ranges, 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24: reserved for examples, which is why these lessons use them for “internet” addresses.
  • 0.0.0.0: used before a device has an address, and in routing to mean “any destination”.

Stage: Predict

IPv6 addresses

Think it through

If you could redesign IP addresses so that they would never run out, what would you change?

Show what happens

Make them longer. IPv6 addresses are four times as long as IPv4 ones, which gives far more addresses than could ever be used.

Reusing private addresses only eases the shortage. IPv6 removes it by making the address four times as long: 128 bits instead of 32. That gives more addresses than could ever be used.

A 128-bit number written in dotted decimal would be unreadable, so IPv6 addresses are written in hexadecimal, as eight groups of four hexadecimal digits separated by colons:

2001:0db8:0000:0000:0000:0000:0000:0010

Two rules make them shorter:

  1. Leading zeros in a group can be dropped: 0db8 becomes db8.
  2. One run of groups that are all zeros can be replaced by ::.

With both rules, that full address becomes 2001:db8::10.

Check your understanding

Apply both rules to 2001:0db8:0000:0000:0000:0000:0000:0001. Which is correct?
Show the answer

Answer: C. 2001:db8::1

2001:db8::1. Leading zeros go from each group, and the single run of zero groups becomes one double colon.

Take 2001:db8::10, an address from the range reserved for documentation.

  1. Count the written groups: 2001, db8 and 10 are three groups.
  2. Work out what :: replaces: an address has eight groups, so :: stands for 8 − 3 = 5 groups of zeros.
  3. Restore leading zeros: db8 becomes 0db8 and 10 becomes 0010.
  4. Write it in full: 2001:0db8:0000:0000:0000:0000:0000:0010.

:: can appear only once, otherwise it would be impossible to tell how many zero groups each one hides.

Kinds of IPv6 address

Now that the format is familiar, here are the kinds of IPv6 address, each recognised by how it starts.

KindStarts withWhat it is for
Global unicast2 or 3The ordinary, internet-wide address: IPv6’s equivalent of a public address.
Unique localfdUsed inside one organisation only: IPv6’s equivalent of a private address.
Link-localfe80Created automatically by every device, and works only on its own local network.
Loopback::1A device talking to itself, like 127.0.0.1.
MulticastffOne message to a chosen group of devices.

IPv6 has no broadcast. The job of finding other devices on the local network, which IPv4 does by broadcasting, is done in IPv6 with multicast messages, in a process called Neighbour Discovery.

When a user cannot get online, the address their device shows is an early clue. A 169.254.x.x address suggests nothing answered when it asked for an address automatically. An address in a different private range from colleagues suggests it has joined the wrong network, such as a guest Wi-Fi.

Stage: Apply

Apply it in a new situation

These questions use the lesson in situations it has not shown. For the strongest test of your understanding, come back to them on another day and answer each one at the first attempt.

Apply it

A user’s laptop shows 169.254.3.9, while colleagues’ laptops show addresses beginning 10.1.4. What does that suggest?
Show the answer

Answer: A. It did not get an address automatically.

It gave itself a link-local address because nothing answered its request for one, so the problem is with automatic addressing, not with the internet.

Apply it

A colleague says: “Our server has a private address, so it is safe from attack.” What is the best response?
Show the answer

Answer: B. Private is about reachability, not protection.

Private means not reachable directly from the internet, which is a matter of addressing. Anything already inside the network can still reach it, so it is not a security control.

Stage: Check

Check your understanding

These questions come from the approved revision bank. Choose an answer and check it; the explanation and its sources follow.

  1. Which addresses are inside RFC 1918 private IPv4 ranges? Select all that apply.

    Show answer

    Answer: 10.25.1.9; 172.31.200.8; 192.168.4.20

    10.25.1.9, 172.31.200.8 and 192.168.4.20 lie within the three RFC 1918 blocks. 172.32.0.1 is outside 172.16.0.0/12. 192.0.2.10 is outside all three RFC 1918 ranges; being outside these ranges does not by itself prove public routability.

    Revision sources: Session 5: Networking Fundamentals — Part 1 (Classroom session record)

  2. Which pair gives the address lengths of IPv4 and IPv6?

    Show answer

    Answer: IPv4: 32 bits; IPv6: 128 bits

    IPv4 has 32-bit addresses and IPv6 has 128-bit addresses. 48 bits describes a conventional Ethernet MAC address. Reversing the values or treating bits as bytes changes their meaning.

    Revision sources: Session 5: Networking Fundamentals — Part 1 (Classroom session record)

Study and revision

Practise addressing questions and flashcards through the Networking & Protocols topic.

Stage: Consolidate

What to remember

  • The IP address is the destination; the MAC address is the next hop, replaced at every router.
  • An IPv4 address is 32 bits in four octets, with a network portion and a host portion set by a separate setting.
  • Private ranges are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16; not private does not always mean public.
  • Special ranges include loopback, link-local and documentation addresses.
  • IPv6 addresses are 128 bits in hexadecimal, shortened by dropping leading zeros and one run of zero groups.

Key terms

IP address

A logical network-layer address identifying an interface for delivery across networks. IPv4 addresses are 32 bits; IPv6 addresses are 128 bits.

Private IPv4 address

An address from the RFC 1918 blocks 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16, used inside private networks rather than routed on the public internet.

Loopback address

An address a device uses to send traffic to itself, such as 127.0.0.1 in IPv4 or ::1 in IPv6.

Common misunderstandings

Other special-purpose ranges exist, including loopback, link-local and the documentation ranges.

Private means “not reachable directly from the internet”, which is a matter of addressing. It is not a security control: anything already inside the network can reach a private address.

The network and host boundary is set by a separate setting, the subnet mask or prefix length, not by the address alone.

Lesson sources and acknowledgements

Sources and scope

  • Taught in Session 5 (see the Session 5 Learning Log): IP and MAC addresses compared, IPv4 and IPv6 address lengths, public and private addresses, the RFC 1918 ranges, IPv6 address types and Neighbour Discovery.
  • From the Study Buddy session on 23 September (see the entry): IPv4 as 32 bits in four octets, the N and H notation, and IPv6 as 128-bit hexadecimal.
  • Moved from an earlier lesson: “Private IPv4 and IPv6” was previously part of What Is a Network? and keeps its heading and anchor here. Its wording was rewritten on 13 October 2026, and the kinds of IPv6 address moved below the section that explains how an IPv6 address is written.
  • Supplementary explanation: the parcel comparison and its limit, the school example of public and private addresses, the “how to recognise it” column and the five-address worked example, the special IPv4 ranges, IPv6 shortening rules, the worked expansion, the table of IPv6 kinds and the misunderstandings.
  • Simplifications: the “starts with” column for IPv6 gives the usual appearance of each kind. The reserved ranges are a little wider: global unicast is 2000::/3, unique local is fc00::/7 (of which the fd half is the part in use), link-local is fe80::/10 and multicast is ff00::/8. Some internet providers also translate addresses a second time on their own equipment (Carrier-Grade NAT), so a home router’s outside address is not always a public one.

Guided version (published 1 November 2026, awaiting the site owner’s editorial review): the parcel opening questions, every question asked in the lesson with its feedback and hints, the address exercises and the closing summary are supplementary explanation written for the Study Guide. The settings are fictional. The questions in the lesson’s steps are not revision-bank items; those in “Check your understanding” are, unchanged.