Every device you configure in a CCNA lab needs an IPv4 address, but many students type addresses like 192.168.1.10/24 without really knowing...
Every device you configure in a CCNA lab needs an IPv4 address, but many students type addresses like 192.168.1.10/24 without really knowing what the numbers mean. In this post I will break an IPv4 address down to its 32 bits, explain the old class system (and why it still shows up in exams and in IOS output), show which ranges are private and which are public, and finish with CIDR notation so prefixes like /20 and /22 stop looking scary.
This is the foundation for subnetting. Once you are comfortable here, the step-by-step subnet math is covered in my separate subnetting tutorial, so I will not repeat it in this post.
What an IPv4 address really is
An IPv4 address is a 32-bit number. Humans write it in dotted decimal: four groups of 8 bits (octets), each converted to a decimal value from 0 to 255 and separated by dots. So the address 192.168.10.37 is really this bit string:
192 .168 .10 .37
11000000 .10101000 .00001010 .00100101
Every address has two parts:
- The network portion identifies the subnet the device belongs to. All devices on the same LAN segment share it.
- The host portion identifies one interface inside that subnet.
The address alone does not tell you where the split is. That is the job of the subnet mask (255.255.255.0) or, in modern notation, the prefix length (/24). A /24 means "the first 24 bits are network bits", which leaves 8 host bits.
In every subnet, two addresses are special. The one with all host bits set to 0 is the network address (192.168.10.0) and the one with all host bits set to 1 is the directed broadcast (192.168.10.255). Neither can be assigned to a host, which is why a subnet with h host bits has 2h - 2 usable addresses.
The classful system (A, B, C, D, E)
When IPv4 was first deployed, the network/host split was fixed by the first few bits of the address. This is called classful addressing. It has been obsolete on the Internet since 1993, but you still need it because exam questions use it, and Cisco IOS still prints classful "parent" networks in the routing table.
| Class | Leading bits | First octet range | Default mask | Networks | Usable hosts per network | Purpose |
|---|---|---|---|---|---|---|
| A | 0 | 1 - 126 | 255.0.0.0 (/8) | 126 | 16,777,214 | Unicast, very large networks |
| B | 10 | 128 - 191 | 255.255.0.0 (/16) | 16,384 | 65,534 | Unicast, medium networks |
| C | 110 | 192 - 223 | 255.255.255.0 (/24) | 2,097,152 | 254 | Unicast, small networks |
| D | 1110 | 224 - 239 | None | - | - | Multicast |
| E | 1111 | 240 - 255 | None | - | - | Reserved (experimental) |
A few details that exam questions love:
- Strictly, any first octet starting with bit 0 is Class A, which is 0 to 127. But 0.0.0.0/8 means "this network" and 127.0.0.0/8 is loopback, so only 1 to 126 are usable Class A networks.
- 127.0.0.1 is the address you ping to test your own TCP/IP stack. Any address in 127.0.0.0/8 loops back inside the host and never reaches the wire.
- Class D addresses are multicast group addresses. OSPF, for example, sends hellos to 224.0.0.5. A host never gets a Class D address on its interface.
- 255.255.255.255 (inside the Class E range) is the limited broadcast address. A DHCP client uses it in its Discover message because it has no address yet.
Why classes were abandoned
The class sizes were a terrible fit for real organizations. A company with 2,000 hosts was too big for a Class C (254 hosts) but wasted over 63,000 addresses in a Class B. At the same time, every Class C network needed its own route in Internet routers, so routing tables were growing quickly. Both problems were solved by CIDR, which I cover below.
Private vs public addresses
A public address is globally unique and routable on the Internet. A private address can be reused inside any organization and is never routed on the public Internet. RFC 1918 reserves three private blocks, one roughly in each old class:
| Private block | CIDR | Range | Addresses | Typical use |
|---|---|---|---|---|
| 10.0.0.0 | 10.0.0.0/8 | 10.0.0.0 - 10.255.255.255 | 16,777,216 | Enterprises, data centers, ISP internal networks |
| 172.16.0.0 | 172.16.0.0/12 | 172.16.0.0 - 172.31.255.255 | 1,048,576 | Medium networks, many Docker and VPN defaults |
| 192.168.0.0 | 192.168.0.0/16 | 192.168.0.0 - 192.168.255.255 | 65,536 | Home routers and small offices |
Watch the middle one carefully. 172.16.0.0/12 covers 172.16 through 172.31 only. An address like 172.32.1.1 or 172.15.0.1 is public. This is one of the most common trick questions.
Because private addresses cannot travel on the Internet, your router has to translate them to a public address on the way out. That is NAT (more precisely PAT, where many inside hosts share one public IP using different port numbers). At home in Nepal, your laptop probably has a 192.168.x.x address, your ISP router has one public address on its WAN side (or even another private address, see below), and NAT sits between them.
Public addresses are handed out in a hierarchy. IANA (the Internet Assigned Numbers Authority) allocates large blocks to the five Regional Internet Registries. For Nepal, India and the rest of the Asia-Pacific region that registry is APNIC. The RIRs allocate to ISPs and large organizations, and ISPs assign addresses to customers. IANA allocated its last free /8 blocks to the RIRs in February 2011, which is the main reason NAT and IPv6 matter so much today.
Other special-purpose ranges you should recognize
| Block | Name | What you will see in practice |
|---|---|---|
| 0.0.0.0/8 | "This network" | 0.0.0.0 as a DHCP client's source address; 0.0.0.0/0 as the default route |
| 127.0.0.0/8 | Loopback | ping 127.0.0.1 to test the local stack |
| 169.254.0.0/16 | Link-local (APIPA) | A Windows PC that failed to get a DHCP lease assigns itself one of these |
| 100.64.0.0/10 | Shared address space | Carrier-grade NAT; if your ISP router's WAN IP is in 100.64-100.127, you are behind your ISP's NAT |
| 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 | Documentation (TEST-NET-1/2/3) | Safe addresses for examples and books; never used on real networks |
| 224.0.0.0/4 | Multicast (old Class D) | 224.0.0.5/224.0.0.6 for OSPF, 224.0.0.10 for EIGRP |
| 240.0.0.0/4 | Reserved (old Class E) | Not usable on normal hosts |
| 255.255.255.255/32 | Limited broadcast | Broadcast to the local segment only; routers never forward it |
CIDR: prefixes instead of classes
Classless Inter-Domain Routing (CIDR) throws away the rule that the first octet decides the mask. Any prefix length from /0 to /32 is allowed, and the prefix is written after a slash. Two big wins came out of this.
1. Right-sized networks
An organization can get exactly the block size it needs. A company needing about 2,000 addresses can get a /21 (2,046 usable hosts) instead of a whole Class B. Internally, you can carve a block into subnets of different sizes; that is VLSM, which my subnetting tutorial walks through with worked examples.
| Prefix | Subnet mask | Host bits | Usable hosts | Common use |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 24 | 16,777,214 | Large private block (10.0.0.0/8) |
| /16 | 255.255.0.0 | 16 | 65,534 | Campus or site summary |
| /20 | 255.255.240.0 | 12 | 4,094 | Large building or cloud VPC subnet |
| /22 | 255.255.252.0 | 10 | 1,022 | Big Wi-Fi network |
| /24 | 255.255.255.0 | 8 | 254 | Typical LAN or VLAN |
| /26 | 255.255.255.192 | 6 | 62 | Small department |
| /29 | 255.255.255.248 | 3 | 6 | Small public block from an ISP |
| /30 | 255.255.255.252 | 2 | 2 | Router-to-router link |
| /31 | 255.255.255.254 | 1 | 2 (no broadcast) | Point-to-point links (RFC 3021) |
| /32 | 255.255.255.255 | 0 | 1 | Loopback or host route |
2. Route aggregation (supernetting)
CIDR also lets a router advertise many contiguous networks as one route. Suppose a branch uses four /24 networks:
10.1.0.0/24 third octet 000000|00
10.1.1.0/24 third octet 000000|01
10.1.2.0/24 third octet 000000|10
10.1.3.0/24 third octet 000000|11
^^^^^^ same 6 bits
The first 16 bits (10.1) plus the first 6 bits of the third octet are identical in all four, so they share a 22-bit prefix. The head office only needs one route: 10.1.0.0/22. On the Internet, this kind of aggregation is what keeps the global routing table manageable.
Seeing it on a Cisco router
You can check your understanding in Packet Tracer 8.x with any router, for example a 2911. Give an interface a classless address:
R1(config)# interface gigabitEthernet 0/0
R1(config-if)# ip address 172.16.5.10 255.255.240.0
R1(config-if)# no shutdown
R1(config-if)# end
R1# show ip route
...
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.0.0/20 is directly connected, GigabitEthernet0/0
L 172.16.5.10/32 is directly connected, GigabitEthernet0/0
(Codes legend trimmed.) Three things to notice:
- The connected route is 172.16.0.0/20, not 172.16.5.0. With 255.255.240.0 the third octet has a block size of 16, so 5 falls inside the 0 to 15 block. The broadcast address of this subnet is 172.16.15.255.
- The heading line "172.16.0.0/16 is variably subnetted" is IOS grouping routes under their old classful parent. 172.16 is Class B, so the parent is /16. This is the classful system still visible in 2026.
- The
Lroute is the local /32 host route for the router's own interface address.
Common mistakes
- Treating 172.32.x.x as private. The private block stops at 172.31.255.255.
- Assigning the network or broadcast address to a host. On 192.168.10.0/24, IOS rejects
ip address 192.168.10.0 255.255.255.0with "Bad mask /24 for address 192.168.10.0". - Assuming the class decides the mask. 10.1.1.1 is "Class A", but it can perfectly well live in a /24 or /30. Always read the mask.
- Confusing 169.254.x.x with a real address. It means DHCP failed. Fix the DHCP path; do not troubleshoot routing first.
- Using random public addresses in labs that later leak into a real network. Use RFC 1918 or the documentation ranges.
Summary
An IPv4 address is 32 bits split into a network and a host portion, and the mask or prefix length decides where the split is. Classes A, B and C defined fixed splits, D is multicast and E is reserved; classes survive mostly in exams and in IOS routing table headings. RFC 1918 gives us 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private use behind NAT, while public space flows from IANA to RIRs like APNIC and then to ISPs. CIDR lets us use any prefix length, size networks properly and aggregate routes. With this in place, subnetting is just practice.
Prefer video? Watch more hands-on labs on the Technical Hakim YouTube channel.
Related tutorials
- Subnetting Made Simple: /24 to /30 with Worked Examples
- NAT and PAT on Cisco Routers: Lab for Home and Office Networks
- IPv6 Addressing and Static Routing: Packet Tracer Lab
- MAC Addresses and ARP Explained (with a Packet Tracer Simulation)
- OSI Model vs TCP/IP Model: Layers, Protocols and a Wireshark Walkthrough
Sources
- RFC 791, Internet Protocol: https://www.rfc-editor.org/rfc/rfc791
- RFC 1918, Address Allocation for Private Internets: https://www.rfc-editor.org/rfc/rfc1918
- RFC 4632, Classless Inter-domain Routing (CIDR): https://www.rfc-editor.org/rfc/rfc4632
- RFC 6890, Special-Purpose IP Address Registries: https://www.rfc-editor.org/rfc/rfc6890
- RFC 6598, IANA-Reserved IPv4 Prefix for Shared Address Space: https://www.rfc-editor.org/rfc/rfc6598
- RFC 5737, IPv4 Address Blocks Reserved for Documentation: https://www.rfc-editor.org/rfc/rfc5737
- RFC 3021, Using 31-Bit Prefixes on IPv4 Point-to-Point Links: https://www.rfc-editor.org/rfc/rfc3021
- RFC 3927, Dynamic Configuration of IPv4 Link-Local Addresses: https://www.rfc-editor.org/rfc/rfc3927
- IANA IPv4 Special-Purpose Address Registry
No comments