IPv4 addressing tells devices where they are and how to reach other
networks. In this lesson you'll learn how IPv4 addresses are structured,
what subnet masks do, which ranges are private, what a default gateway
is and how a host decides whether traffic is local or remote.
📖 Beginner⏱ About 20 minutes✓ Quiz included🧮 Subnetting trainer linked
01 // Structure
An IPv4 address is 32 bits
IPv4 addresses are made from four 8-bit values called
octets. Each octet can contain a decimal value
from 0 to 255.
192
11000000
Octet 1
168
10101000
Octet 2
10
00001010
Octet 3
42
00101010
Octet 4
192.168.10.42 looks like four decimal numbers,
but the network ultimately treats it as one 32-bit binary value.
02 // Network vs host
The subnet mask tells us where the network ends
An IP address alone is not enough. A device also needs a subnet mask
to know which bits describe the network and which bits identify the host.
Dotted-decimal mask
A common subnet mask might be:
255.255.255.0
CIDR prefix
The same mask can be written as:
/24
A /24 means the first 24 bits identify the network,
leaving 8 bits for host addresses.
Important: the subnet mask is not an address.
It is a bit mask that tells the host which part of the IPv4 address
represents the network.
03 // Private addressing
RFC 1918 private IPv4 ranges
Private addresses are intended for use inside private networks and
are not routed across the public Internet.
10.0.0.0/8
Range: 10.0.0.0 through 10.255.255.255.
172.16.0.0/12
Range: 172.16.0.0 through 172.31.255.255.
192.168.0.0/16
Range: 192.168.0.0 through 192.168.255.255.
Classic exam trap:
not every 172.x.x.x address is private.
Only 172.16.0.0 through 172.31.255.255 belongs to
the RFC 1918 private block.
04 // Forwarding decision
Is the destination local or remote?
Before sending traffic, a host uses its own address and subnet mask
to determine whether the destination belongs to the same IP network.
Local destination
If the destination belongs to the same subnet, the host can send
directly to the destination on the local network.
It needs the destination's Layer 2 address before building the
local Ethernet frame.
Remote destination
If the destination is outside the local subnet, the host sends
the packet toward its default gateway.
The destination IP stays the remote host's IP, but the local
Ethernet frame is addressed toward the gateway.
05 // Gateway
The default gateway is the way out
A default gateway is normally the IP address of a router or Layer 3
switch interface on the same local subnet as the host.
💻
PC
192.168.10.42/24
→
🌐
Default Gateway
192.168.10.1
→
☁️
Remote Network
8.8.8.8
The PC does not change the destination IP address
to the gateway. It still sends an IP packet destined for
8.8.8.8, but the local Layer 2 frame is delivered
to the gateway.
The host address is just one address inside the subnet.
The network and broadcast addresses identify the boundaries of that subnet.
You'll practise calculating these values properly in the
Baznetic subnetting trainer at the end of this lesson.
07 // Useful address types
A few IPv4 ranges worth recognising
127.0.0.0/8 — Loopback
Used by a host to refer to itself. The most familiar address is
127.0.0.1.
169.254.0.0/16 — Link-local/APIPA
Hosts may self-assign an address from this range when DHCP is
unavailable.
255.255.255.255 — Limited broadcast
Represents a broadcast to the local network segment.
0.0.0.0
Used in several contexts to represent an unspecified address or,
in routing notation, part of the default route 0.0.0.0/0.
08 // Check your knowledge
Quick quiz
1. How many bits are in an IPv4 address?
IPv4 addresses contain 32 bits, usually displayed as four
8-bit decimal octets.
2. Which subnet mask is equivalent to /24?
A /24 has 24 network bits, giving the dotted-decimal mask
255.255.255.0.
3. Which of these is a private IPv4 address?
172.20.10.1 falls inside 172.16.0.0/12, one of the RFC 1918
private address ranges.
4. A PC determines that a destination is outside its local subnet.
Where does it normally send the frame?
For a remote IP destination, the local Ethernet frame is sent
toward the default gateway.
5. What is 127.0.0.1 commonly used for?
127.0.0.1 is the familiar IPv4 loopback address used by a host
to communicate with itself.
6. A host has address 192.168.10.50/24. Which destination is on
the same subnet?
With a /24 mask, 192.168.10.0/24 is the local network, so
192.168.10.200 is local.
Score: 0 / 6
Ready to practise?
Now make subnetting automatic.
Use the interactive Baznetic subnetting trainer to practise CIDR
prefixes, subnet masks, network addresses, broadcast addresses and
usable host ranges.