CCNA online course

IPv4 Address Classes

Learn legacy IPv4 Classes A through E, default masks, network and host portions, special ranges, and why modern networks use CIDR and VLSM.

IPv4 address classes are a legacy method for dividing the 32-bit IPv4 address space into networks of different default sizes. Classful addressing is no longer the normal basis for routing, but it remains important for CCNA exams, older documentation, and understanding how modern classless addressing developed.

An address class is identified primarily by the leading bits of the address. In dotted-decimal notation, the leading-bit pattern can usually be recognized by examining the first octet.

IPv4 Address Structure

IPv4 is a 32-bit Internet Protocol address. It is normally written as four decimal octets separated by periods, such as 192.168.12.34. Each octet contains 8 bits and can represent a value from 0 through 255.

192.168.12.34
11000000.10101000.00001100.00100010

An IPv4 address is divided into two logical parts:

  • Network portion: Bits that identify the network or prefix.
  • Host portion: Bits that identify an interface within that network.

A subnet mask shows which bits belong to the network portion. A prefix length, written in CIDR notation, states how many leading bits are network bits. For example, /24 means 24 network bits and 8 host bits.

Historical defaultNetwork bitsHost bitsBit layout
Class A, /8824NNNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH
Class B, /161616NNNNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH
Class C, /24248NNNNNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH

IPv4 Address Class Summary

ClassLeading binary bitsFirst-octet decimal rangePrimary purposeHistorical default prefixDefault subnet maskNetwork bitsHost bitsDefault usable-host capacity
A01–126 for ordinary class identificationLarge unicast networks/8255.0.0.0824About 126 networks; 16,777,214 hosts per network
B10128–191Medium-sized unicast networks/16255.255.0.0161616,384 networks; 65,534 hosts per network
C110192–223Small unicast networks/24255.255.255.02482,097,152 networks; 254 hosts per network
D1110224–239MulticastNoneNoneNot a conventional unicast splitNot a conventional unicast splitNot applicable
E1111240–255Reserved or experimental useNoneNoneNot a conventional unicast splitNot a conventional unicast splitNot applicable

The Class A network count is often described as 128 possible first-octet patterns, but 0.0.0.0/8 and 127.0.0.0/8 have special meanings. That leaves 126 ordinary Class A network ranges for historical discussions.

Class A

Class A addresses begin with the binary pattern 0. Ordinary class identification uses first-octet values from 1 through 126. The historical default is /8, or 255.0.0.0.

Under the Class A default, the first octet identifies the network and the remaining three octets identify hosts. A network therefore has 24 host bits. The traditional usable-host formula is 2^24 - 2 = 16,777,214, excluding the network and broadcast addresses.

The range 0.0.0.0/8 is reserved for unspecified and special meanings, while 127.0.0.0/8 is reserved for loopback. They should not be treated as ordinary assignable Class A networks.

Class B

Class B addresses begin with 10 in binary and have a first octet from 128 through 191. The historical default is /16, or 255.255.0.0.

The first two octets form the default network portion and the last two octets form the host portion. There are 16 host bits, giving 2^16 - 2 = 65,534 traditional usable host addresses per default Class B network. The historical class space contains 2^14 = 16,384 possible Class B networks.

Class C

Class C addresses begin with 110 in binary and have a first octet from 192 through 223. The historical default is /24, or 255.255.255.0.

The first three octets form the default network portion and the last octet forms the host portion. There are 8 host bits, giving 2^8 - 2 = 254 traditional usable host addresses per default Class C network. The historical class space contains 2^21 = 2,097,152 possible Class C networks.

Class D

Class D addresses begin with 1110 and occupy first-octet values from 224 through 239. This range is used for multicast, which is one-to-many delivery to members of a multicast group.

Class D is not divided into a conventional unicast network portion and host portion. It therefore has no default unicast subnet mask. For example, 224.0.0.5 is a multicast address, not an ordinary host address.

Class E

Class E addresses begin with 1111 and occupy first-octet values from 240 through 255. This range is reserved or experimental and is not used for normal public unicast host assignment.

Class E also has no default unicast subnet mask. A first octet such as 250 indicates the Class E range, but it does not identify a normal assignable unicast network.

Special and Private IPv4 Ranges

Some IPv4 ranges are commonly confused with address classes. A class describes a historical address-space category; a special or private range describes how addresses may be used. Modern special ranges are defined with explicit prefixes.

Range or addressPrefixPurposeAssignable to ordinary hosts?Key note
0.0.0.0 and 0.0.0.0/8/8 contextUnspecified address or default contextUsually noMeaning depends on context; 0.0.0.0/0 commonly represents the default route.
127.0.0.0/8/8LoopbackNo for remote use127.0.0.1 refers to the local host.
10.0.0.0/8/8Private internal addressingYes inside private networksNot globally routed on the public Internet.
172.16.0.0/12/12Private internal addressingYes inside private networksSpans 172.16.0.0 through 172.31.255.255.
192.168.0.0/16/16Private internal addressingYes inside private networksOften used in home and small-office networks.
224.0.0.0/4/4MulticastNo as ordinary unicastCorresponds to the Class D range.
240.0.0.0/4/4Reserved or experimentalNo for normal public unicastCorresponds to the Class E range.
255.255.255.255/32 addressLimited broadcastNoBroadcasts to hosts on the local network and is not routed.

Private ranges cross classful-looking boundaries. For example, 172.16.0.0/12 does not follow the old Class B /16 boundary. Its /12 prefix is authoritative.

Network, Host, and Broadcast Addresses

In a conventional IPv4 subnet, setting every host bit to zero produces the network address. It identifies the subnet itself and is normally not assigned to an interface.

Setting every host bit to one produces the directed broadcast address, where directed broadcast is supported. It represents all hosts on that subnet and is normally not assigned to an individual interface.

For 192.168.12.34/24, the mask is 255.255.255.0:

Network:    192.168.12.0
Usable:     192.168.12.1 - 192.168.12.254
Broadcast:  192.168.12.255

The familiar usable-host formula is not universal. A /31 prefix is commonly used for point-to-point links, where both addresses can be used as endpoints and there is no traditional network/broadcast subtraction. A /32 prefix identifies one address and is commonly used for a loopback, host route, or other single-host purpose.

Classful Addressing Versus CIDR and VLSM

Classful addressing used fixed default boundaries: Class A used /8, Class B used /16, and Class C used /24. This produced very large, inflexible allocations. An organization needing a few hundred addresses might receive far more space than it required.

CIDR, or Classless Inter-Domain Routing, replaced those fixed defaults with an explicit prefix length. A network can use prefixes such as /20, /27, or /30, regardless of the address's historical class.

VLSM, or Variable Length Subnet Masking, allows different subnet sizes within a larger allocation. For example, one subnet can use /24 for a user LAN while another uses /30 or /31 for a point-to-point connection.

Classful Defaults Compared with Actual CIDR Prefixes

Address exampleHistorical classHistorical default maskActual prefixResulting networkTeaching point
10.25.4.8A/8, 255.0.0.0/24 in this example10.25.4.0/24A Class A-looking address can be subnetted with a different prefix.
172.20.10.5B/16, 255.255.0.0/20172.20.0.0/20The configured /20 matters, not the historical Class B default.
192.168.12.34C/24, 255.255.255.0/27192.168.12.32/27A Class C-range address does not require a /24 mask.

Identifying an Address Class

Use this repeatable process when a question asks for the historical class:

  1. Inspect the first octet in dotted-decimal notation.
  2. Map it to the class range: 1–126 is A, 128–191 is B, 192–223 is C, 224–239 is D, and 240–255 is E.
  3. For Classes A, B, and C, recall the historical default prefix and mask.
  4. Check whether the address is a special range such as loopback, unspecified, private, multicast, or broadcast.
  5. If a prefix or mask is supplied, use that actual configuration rather than the historical default.

Binary recognition provides the same result without memorizing every decimal range:

  • 0xxxxxxx indicates Class A.
  • 10xxxxxx indicates Class B.
  • 110xxxxx indicates Class C.
  • 1110xxxx indicates Class D multicast.
  • 1111xxxx indicates Class E reserved or experimental space.

Examples

AddressFirst octetHistorical classificationImportant conclusion
10.25.4.810Class A-lookingHistorical default is /8, but the actual prefix must be checked.
172.20.10.5172Class B-lookingIt is also within private space because it falls in 172.16.0.0/12.
192.168.50.10192Class C-lookingIt is private-use space, not automatically a /24.
224.0.0.5224Class DMulticast, not ordinary unicast.
250.1.2.3250Class EReserved or experimental range.

Calculating a CIDR Subnet

Consider 192.168.12.34/27. The address is in the historical Class C range, but /27 is the configured prefix. A /27 mask is 255.255.255.224, leaving 5 host bits and creating blocks of 32 addresses in the last octet.

Block ranges: 0-31, 32-63, 64-95, ...
Address:     34  -> belongs to 32-63
Network:     192.168.12.32/27
Broadcast:   192.168.12.63
Usable:      192.168.12.33-192.168.12.62

This example demonstrates why the first octet alone is insufficient today. The address looks Class C historically, but the actual subnet is /27, not /24.

Cisco IOS Configuration and Verification

Cisco IOS interface configuration uses an explicit IPv4 address and subnet mask. The router does not need to infer the mask from the address class.

interface GigabitEthernet0/0
 ip address 192.168.12.34 255.255.255.224
 no shutdown

Useful verification commands include:

show ip interface brief
show ip interface GigabitEthernet0/0
show ip route connected

On a host operating system, commands such as ip addr, ip route, and ipconfig can reveal the local address, mask or prefix, and routes.

The command show running-config | include ip classless and the configuration command ip classless are associated with a legacy IOS concept. The practical lesson for current networks is that routing decisions use explicit classless prefixes.

Troubleshooting Common Mistakes

Assuming every 192 address uses a /24 mask

First-octet value 192 indicates the historical Class C range, but it does not prove that the active mask is 255.255.255.0. Check the interface configuration, prefix information, and routing table. Calculate the subnet from the configured prefix.

Assigning a network or broadcast address to a host

For a conventional 192.168.1.0/24 subnet, 192.168.1.0 is the network address and 192.168.1.255 is the directed broadcast address. Assign an address from 192.168.1.1 through 192.168.1.254 instead.

Treating multicast as ordinary unicast

A destination from 224.0.0.0 through 239.255.255.255 is multicast. If one-to-one communication is required, use a valid unicast address. Multicast communication requires appropriate group membership and network support.

Trying to reach 127.0.0.1 remotely

127.0.0.1 is loopback and refers to the local device. It tests the local TCP/IP stack; it is not a remote destination. Use a non-loopback interface address to test connectivity across a network.

Relying on a classful route boundary

A route may use a non-default prefix or summarize multiple networks. Review complete route prefixes and apply longest-prefix matching. Confirm masks on endpoints and intermediate routers rather than comparing only the first octet.

Key Points

  • IPv4 addresses contain 32 bits arranged as four 8-bit octets.
  • Class A, B, and C were historical unicast categories with default prefixes of /8, /16, and /24.
  • Class D, 224.0.0.0/4, is multicast and has no default unicast mask.
  • Class E, 240.0.0.0/4, is reserved or experimental and is not normal public unicast space.
  • Network and broadcast addresses are formed by clearing or setting all host bits in a conventional subnet.
  • /31 point-to-point prefixes and /32 single-host prefixes are modern exceptions to the basic usable-host formula.
  • CIDR and VLSM allow arbitrary prefix lengths and efficient subnet sizing.
  • In modern networking, always treat the configured subnet mask or prefix as authoritative.