IP Addressing: IPv4, IPv6, Subnetting and CIDR
NetworkingIP AddressingGuide

IP Addressing: IPv4, IPv6, Subnetting and CIDR

Master IP addressing from the fundamentals: IPv4 and IPv6, prefixes, private addressing, CIDR, subnetting, VLSM, gateways, and practical address-plan design.

IPv6 guideSubnettingNetworking fundamentals

Introduction

IP addressing is the system that gives devices and network interfaces a logical identity so packets can be delivered locally and routed between networks. To understand a subnet, a gateway, a route, or almost any Layer 3 troubleshooting task, you need to understand the relationship between an IP address and its prefix or subnet mask.

This guide brings together IPv4, IPv6, CIDR, subnetting, and VLSM. The goal is not to memorize isolated formulas, but to see addressing as a design system: define network boundaries, assign addresses consistently, preserve room for growth, and make routing easier to understand.

Address + prefix

An address identifies an interface, while the prefix describes which bits belong to the network and which bits identify an address inside that network.

IPv4 and IPv6

Both protocols provide Layer 3 addressing, but their address space, notation, discovery mechanisms, and operational practices differ.

Subnetting and CIDR

CIDR gives us prefix notation and subnetting lets us divide address space into useful, routable blocks.

Addressing fundamentals

An IP address only makes sense together with a prefix. For example, 192.0.2.10/24 tells us both the host address and that the first 24 bits describe the network prefix. Devices use that prefix to decide whether a destination is on-link or whether traffic must be sent to a router.

Network portion and host portion

In IPv4, the subnet mask expresses the same boundary as CIDR prefix notation. A /24 corresponds to 255.255.255.0. A /26 corresponds to 255.255.255.192. The longer the prefix, the smaller the address block.

Default gateway

A host sends traffic directly when the destination is considered local. For remote networks, it forwards the packet to a default gateway. This is why a correct address with a wrong prefix can cause failures even if the gateway itself is configured correctly.

IPv4 addressing

IPv4 addresses are 32 bits long and are normally written as four decimal octets, such as 192.168.10.25. Each octet represents eight bits, giving a total space of roughly 4.3 billion addresses before reservations and special-use ranges are considered.

Private address space

RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 for private networks. These addresses are not globally routed on the public Internet and are commonly combined with NAT/PAT at an edge device.

Classful addressing is historical

Class A, B, and C terminology is still useful when reading older material, but modern networks use classless addressing and CIDR. Design decisions should be based on prefixes and required address space, not on class boundaries.

Special-use ranges

Loopback, link-local, documentation, multicast, and shared address space all have specific meanings. Do not assume that every address outside RFC 1918 is automatically a normal public unicast address.

IPv6 addressing

IPv6 uses 128-bit addresses written in hexadecimal. The much larger address space solves the exhaustion problem, but IPv6 also changes important operational details: it has no IP broadcast, Neighbor Discovery replaces several IPv4 mechanisms, and Stateless Address Autoconfiguration can let hosts form addresses from router advertisements.

A typical IPv6 LAN uses a /64 prefix, although other prefix lengths exist for specific purposes. Link-local addresses in fe80::/10 are automatically present on IPv6-enabled interfaces and are essential for local neighbor and router communication.

Continue with the dedicated IPv6 guide for notation, prefixing, SLAAC, DHCPv6, Neighbor Discovery, and troubleshooting.

Subnetting: dividing address space

Subnetting takes an existing prefix and creates smaller prefixes from it. In IPv4 this is usually done to segment broadcast domains, allocate addresses efficiently, enforce security boundaries, or create routeable network blocks for different sites and VLANs.

For example, splitting 192.168.10.0/24 into four equal blocks produces four /26 subnets. Each block contains 64 addresses. In conventional LAN semantics, the network and broadcast addresses are reserved, leaving 62 usable host addresses per subnet.

The exact host semantics matter for /31 and /32. A /31 can be used on point-to-point links under RFC 3021, while a /32 represents a single address or host route rather than a conventional multi-host subnet.

See the Subnetting guide for the full method.

CIDR and prefix notation

Classless Inter-Domain Routing uses the slash prefix notation that is now standard across IPv4 and IPv6. CIDR lets address blocks follow binary boundaries instead of historical class boundaries. This makes allocation, subnetting, route summarization, and routing-table design far more flexible.

A shorter prefix describes a larger block. A longer prefix describes a smaller, more specific block. Routers normally prefer the longest matching prefix when several routes can reach the same destination.

FLSM and VLSM

FLSM uses the same subnet mask for every child subnet. It is easy to calculate and useful when each segment needs roughly the same capacity. VLSM uses different prefix lengths so each subnet can be sized closer to its actual requirement.

VLSM generally allocates the largest requirement first, then continues with progressively smaller blocks while respecting binary boundaries. That approach reduces wasted space and keeps the plan predictable.

Use the dedicated FLSM and VLSM guides for worked methods.

Address-planning best practices

  • Document every subnet, prefix, gateway, VLAN, purpose, and reservation.
  • Leave deliberate room for growth instead of filling every block immediately.
  • Use hierarchical allocation so related networks can be summarized where appropriate.
  • Keep infrastructure ranges, user ranges, management networks, and transit networks understandable.
  • Avoid overlapping private address space when networks may later connect through VPNs, mergers, or multi-site routing.
  • Treat IPv6 as a first-class design problem rather than translating an IPv4 plan mechanically.

Common addressing mistakes

Typical failures include assigning the correct IP with the wrong mask, using an address from the wrong subnet, configuring the wrong default gateway, creating overlapping networks, forgetting special-use ranges, or assuming that a ping failure automatically means the address itself is wrong.

When troubleshooting, confirm the interface address, prefix, default route, ARP or Neighbor Discovery state, local routing table, and the next hop before changing configuration.

Frequently asked questions

Is a subnet mask the same as a CIDR prefix?

They describe the same network/host boundary in IPv4, using different notation. CIDR notation is also used for IPv6.

Do IPv6 networks use subnet masks?

IPv6 uses prefix lengths rather than dotted-decimal masks.

Is every non-private IPv4 address public?

No. Several special-use ranges exist outside RFC 1918, including loopback, link-local, documentation, multicast, and shared address space.