IP Addressing and Subnetting
Learn IPv4 and IPv6 addresses, CIDR prefixes, private ranges, and how subnet boundaries guide local and routed traffic.
An IP address identifies a network interface at the Internet Protocol layer so packets can be delivered across connected networks. A prefix says which leading bits describe the network. Subnetting divides an address block into smaller prefixes so administrators can plan local networks, routes, and address assignments.
Addresses and prefixes
IPv4 addresses contain 32 bits and are commonly written as four decimal octets, such as 192.168.10.25. IPv6 addresses contain 128 bits and are written in hexadecimal groups, such as 2001:db8:20::25. The notation /24 or /64 is a prefix length: the number of leading bits belonging to the network portion.
Classless Inter-Domain Routing (CIDR) replaced class-based allocation with flexible prefixes. The prefix determines the size of the block; it does not by itself tell you whether an address is private, public, assigned, or reachable. IPv4 private ranges commonly used inside organizations are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16.
Work a subnet example
Consider the documentation block 192.0.2.64/26. A /26 leaves six host bits, so it contains 64 IPv4 addresses. In an ordinary multi-access IPv4 subnet, .64 is the network address, .127 is the broadcast address, and .65 through .126 are traditionally assignable to hosts. On a point-to-point link, RFC 3021 allows a /31 prefix to use both addresses, with no network or broadcast reservation. A /32 identifies one host route.
To check a design, write the address in binary or use a trusted subnet calculator, then verify the network boundary, prefix, gateway, and usable range. Do not copy the same subnet onto two routed LANs: overlapping prefixes make route selection ambiguous.
IPv6 in practice
IPv6 expands the address space and has no broadcast address; it uses multicast and neighbor discovery for link-local functions. IPv6 is not simply IPv4 with longer numbers: address configuration, discovery, and filtering have important differences. A /64 is common on end-user IPv6 LANs, but prefix lengths depend on the design and allocation.
IPv6 does not require NAT to conserve addresses in the way widely shared private IPv4 networks often do. Use explicit routing and firewall policy; do not treat the absence or presence of NAT as a security boundary.
Inspect and troubleshoot
Use local inspection commands before changing a network:
ip -br address
ip route
On Windows, ipconfig /all shows interface addresses, prefixes, gateways, and DNS settings. Confirm that the address and prefix are expected, that the default gateway is on the local link, and that no other device is using the same static address. If an address is correct but a remote destination fails, check the route and firewall separately.
Practice and check your understanding
For 192.0.2.64/26, identify the prefix length, total address count, and traditional network/broadcast boundaries. Then divide 192.0.2.0/24 into four equal subnets and label each network prefix. The interactive practice below checks subnet boundaries and includes a small VLSM exercise. These documentation addresses are examples only, not production assignments.
Ask yourself: can two interfaces in different locations safely use the same private subnet? What information does a router use to choose between matching prefixes?
Trusted references
- RFC 791: Internet Protocol specifies the original IPv4 protocol.
- RFC 8200: Internet Protocol, Version 6 specifies IPv6.
- RFC 4632: Classless Inter-domain Routing describes CIDR prefixes and address aggregation.
- RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links defines the
/31point-to-point exception. - RFC 5737: IPv4 Address Blocks Reserved for Documentation reserves the example blocks used in this lesson.
- RFC 1918: Address Allocation for Private Internets defines the familiar private IPv4 ranges.
Local interactive practice
IPv4 subnetting practice
Enter an IPv4 address and either a CIDR prefix or dotted mask. All calculations stay in this browser.
- Network prefix
- 192.0.2.64/26
- Subnet mask
- 255.255.255.192
- Total addresses
- 64
- Usable addresses
- 62
- First usable address
- 192.0.2.65
- Last usable address
- 192.0.2.126
- Broadcast address
- 192.0.2.127
- Addressing rule
- Traditional subnet boundary
- Address in binary
11000000.00000000.00000010.01000110- Mask in binary
11111111.11111111.11111111.11000000- Network in binary
11000000.00000000.00000010.01000000
Subnet boundary challenge
Beginner challenge
Find the network prefix for 192.0.2.70/26
VLSM allocation exercise
Allocate each group from this documentation block: 192.0.2.0/24