The Network Layer: Forwarding & IP

subnetting

Subnetting is carving one IP network into smaller pieces, called subnets, by borrowing bits from the host part to make a longer network part. Picture a big office building given one block of room numbers: instead of one giant open floor, you partition it into departments, each with its own contiguous range of rooms. Each subnet becomes its own little network with its own broadcast domain, which keeps traffic local, improves security, and makes the address space easier to manage.

Mechanically, you take a prefix and lengthen it. Suppose you own 192.168.1.0/24 (256 addresses, one network). Stretch the mask from /24 to /26 and you borrow 2 host bits, splitting it into 2^2 = 4 equal subnets: 192.168.1.0/26, 192.168.1.64/26, 192.168.1.128/26, and 192.168.1.192/26, each with 2^(32-26) = 64 addresses (62 usable hosts, since each subnet loses its all-zeros network address and all-ones broadcast address). A router with an interface on each subnet keeps them separate, and broadcasts in one subnet do not flood the others.

Subnetting trades address efficiency for structure: every subnet you create costs you those two reserved addresses, so over-splitting wastes space. The reverse operation, supernetting (route aggregation), merges adjacent prefixes back into one shorter prefix to shrink routing tables. Both are just CIDR arithmetic — moving the boundary between network and host bits — and both are why understanding the binary view of an address pays off.

Splitting 192.168.1.0/24 into four /26 subnets gives ranges .0–.63, .64–.127, .128–.191, .192–.255. In the first subnet, 192.168.1.0 is the network address, 192.168.1.63 is the broadcast, and .1–.62 are the 62 usable host addresses.

Lengthening the prefix from /24 to /26 splits one network into four.

Every subnet loses two addresses (the network address and the broadcast address), so a /30 has just 2 usable hosts. Don't subnet finer than you need, or you spend most of your space on overhead.

Also called
subnet division切割子網路子網化劃分子網