Networking fundamentals / 03

Subnet masks and address classes

Split an IPv4 address into network and host portions with a subnet mask, and revisit historical address classes.

On this page

The structure of an IPv4 address

In the previous lesson, we introduced IP addresses and the IPv4 and IPv6 versions. Here we focus on IPv4's 32 bits, conventionally written as four dotted decimal groups.

An address can be divided into a network portion and a host portion. The subnet mask tells us where that division lies. Historically, address classes also described standard divisions; we will return to those below.

Apply a subnet mask

To obtain the network address, perform a bitwise AND between the IP address and the subnet mask. A result bit is one only when both corresponding input bits are one.

Using the example address 192.168.1.3 and mask 255.255.255.0:

ValueBinary
Subnet mask11111111.11111111.11111111.00000000
IP address11000000.10101000.00000001.00000011
Network address11000000.10101000.00000001.00000000

The network address is 192.168.1.0, and the final octet, 3, is the host portion in this example. Slash notation records how many leading bits belong to the network: 192.168.1.3/24.

Translation note: the original prose alternated between 192.169.1.3 and 192.168.1.3 and printed an incomplete network address. The worked example above consistently uses the address from the original binary calculation and includes the final zero octet.

Historical address classes

Classful IPv4 divides addresses into A, B, C, D, and E. In that historical system, class A uses an 8-bit network portion, class B 16 bits, and class C 24 bits.

ClassLeading binary bitsFirst-octet range
A00–127
B10128–191
C110192–223
D1110224–239
E1111240–255

The original lesson describes class E as reserved for testing rather than ordinary use. Class D is associated with multicast. Some addresses within these broad ranges have special purposes.

Editorial note: this is historical classful addressing. Modern networks use classless prefixes (CIDR), so an address's first octet does not force it to use its old class's default mask.

Practice

Find the subnet mask, IP address, network address, host portion, and historical address class for 192.168.1.3/8.

The original invited readers to leave their answers in the comments. When working it out, apply the explicit /8 prefix even though the address falls in the historical class C range.

Moved here from Tistory

I migrated this post from my Korean Tistory blog, I am Jason Lee, to this website and translated it into English. My writing and projects now live together in one place.

The original publication date, code examples, and screenshots are preserved. Editorial notes clarify known issues in the original material.

Original post on Tistory English edition · Aug 30, 2026
← Back to all articles