Skip to content

Networks, hosts, and prefixes

Module
Understanding IPv4 Addresses
Difficulty
Easy
Updated
Tested on
Ubuntu 24.04.5 LTS, netlab 1.0, GNU Bash 5.2.21, tcpdump 4.99.4
On this page

Laptop is 10.77.10.10 and web is 10.77.20.80. They look close, but one is at home and one is beyond router. The dots alone cannot explain that difference. Read the slash after each address to find which part names its network.

Finish Dotted-decimal addresses after Practice: Ethernet and Local Delivery. Keep the starting lab running with modes off. Use the VM terminal for the one-command machine calls. You will read settings without changing any of them.

The /24 following laptop’s address tells you where to divide its 32 bits. A prefix is the leading part of an address that names a network. The prefix length counts how many bits belong to it, starting at the left. The slash introduces that count; it is not another address octet.

The network part is the part selected by that prefix length. The host part is the remaining part, which distinguishes an interface within that network. Read both parts together when identifying an interface. The same host part can occur in different networks without naming the same interface.

With /24, count three groups of eight bits from the left. The first three octets are the network part. The last octet is the host part. Laptop’s network part is 10.77.10; its host part is 10. That split applies because the prefix length is 24. It is not a permanent property of the dots.

Repeat these commands from the VM. Read the IPv4 address on each non-loopback row, keeping its slash and number. The command form returns to the VM after every read, so you do not need to enter and leave three shells.

Compare laptop, phone and web prefixes
learner@rootvolt:~$ netlab shell laptop -- ip -br address[sudo] password for learner: lo               UNKNOWN        127.0.0.1/8 ::1/128 
eth0@if3         UP             10.77.10.10/24 fe80::77:10ff:fe00:10/64 learner@rootvolt:~$ netlab shell phone -- ip -br addresslo               UNKNOWN        127.0.0.1/8 ::1/128 
eth0@if5         UP             10.77.10.11/24 fe80::77:10ff:fe00:11/64 learner@rootvolt:~$ netlab shell web -- ip -br addresslo               UNKNOWN        127.0.0.1/8 ::1/128 
eth0@if11        UP             10.77.20.80/24 fe80::77:20ff:fe00:80/64 learner@rootvolt:~$ 

Step-by-step replay of a verified session · Recorded on Ubuntu 24.04.5 LTS, networking lab (netlab 1.0), GNU Bash 5.2.21. Compare the address and prefix on laptop, phone and web without changing the lab.
Steps (12)
  1. Type netlab shell laptop -- ip -br address
  2. Press Enter
  3. Output: [sudo] password for learner:
  4. Type the password (the terminal shows nothing)
  5. Press Enter
  6. Output: lo UNKNOWN 127.0.0.1/8 ::1/128 eth0@if3 UP 10.77.10.10/24 fe80::77:10ff:fe00:10/64
  7. Type netlab shell phone -- ip -br address
  8. Press Enter
  9. Output: lo UNKNOWN 127.0.0.1/8 ::1/128 eth0@if5 UP 10.77.10.11/24 fe80::77:10ff:fe00:11/64
  10. Type netlab shell web -- ip -br address
  11. Press Enter
  12. Output: lo UNKNOWN 127.0.0.1/8 ::1/128 eth0@if11 UP 10.77.20.80/24 fe80::77:20ff:fe00:80/64

Phone’s eth0@if5 has 10.77.10.11/24. Web’s eth0@if11 has 10.77.20.80/24. Laptop and phone share 10.77.10 under /24. Their different last octets distinguish their interfaces. Web has 10.77.20 as its network part. A matching first and second octet is not enough for a /24 comparison.

Do the split on paper before deciding whether two settings share a network. First read each prefix length, then mark that many bits. Only then compare the marked parts. Looking at familiar numbers first can make you overlook a different prefix.

Change the question without changing the lab

Section titled “Change the question without changing the lab”

Imagine laptop’s prefix were /16. Sixteen bits cover the first two octets.

Predict: if both laptop and web had /16, would they share a network part? Keep their address numbers unchanged.

One address under two prefixes Under /24 the network part is 10.77.10; under /16 it is 10.77. The remaining numbers form the host part. Under /24 10 . 77 . 10 . 10 network part: 10.77.10 host part: 10 Under /16 10 . 77 . 10 . 10 network part: 10.77 host part: 10.10
One address under two prefixes Under /24 the network part is 10.77.10; under /16 it is 10.77. The remaining numbers form the host part. Under /24 10 . 77 . 10 . 10 network part 10.77.10 host part 10 Under /16 10 . 77 . 10 . 10 network part 10.77 host part 10.10
Under /24 the network part is 10.77.10; under /16 it is 10.77. The remaining octets form the host part.
Check your answer

Yes. Both would have network part 10.77. Laptop’s host part would be 10.10; web’s would be 20.80. This is a hypothetical comparison. The replay still shows /24 on every lab connection; do not change those settings to match the figure’s second row.

That describes a larger network because fewer bits are fixed as its name. More bits remain for different host parts.

“Addresses that look alike are in the same network.” Laptop and web share two opening numbers, but the captured /24 settings put them in different networks.

“The first three numbers are always the network.” The /16 row disproves that rule. The prefix length decides how many bits belong to the network part.

Under /8, the first octet is the network part and the last three are the host part. For this lesson, compare pairs with equal prefix lengths. Keep the full setting beside any split so another reader can check it.

For each pair below, write both network parts and decide whether they match. Then run netlab shell phone -- ip -br address and netlab shell router -- ip -br address. Compare phone’s network part with each of router’s two non-loopback interfaces. Say which one shares it.

Pair Addresses
A 10.1.2.3/8 and 10.9.8.7/8
B 10.1.2.3/8 and 192.0.2.3/8
C 172.16.2.3/16 and 172.16.9.8/16
D 172.16.2.3/16 and 172.17.2.3/16
E 198.51.100.4/24 and 198.51.100.9/24
F 192.0.2.4/24 and 203.0.113.4/24
Solution

A, C and E match. B, D and F do not. Compare one, two and three octets respectively for /8, /16 and /24. Phone shares 10.77.10 with router’s eth0@if7, at 10.77.10.1/24. Router’s eth1@if9, at 10.77.20.1/24, has a different network part.

Subnetting Foundations explains prefix lengths whose boundary falls inside an octet.

  • The prefix length counts network bits from the left.
  • The host part contains the remaining bits.
  • Compare the parts under the stated prefix, rather than the address’s appearance.

Next, Private and public addressing asks where address ranges may be used.