How do you split the IPv4 block 198.51.100.0/24 into four equal subnets, and what are each subnet's network, broadcast and usable range?
answer
- borrow bits from the host part
- four is two squared
- step by the block size
- each subnet pays its own two
basics
~20 sBorrow two host bits: 2^2 = 4 subnets of /26, each 64 addresses with 62 usable hosts. They start at .0, .64, .128 and .192 of 198.51.100, and each broadcast sits one below the next subnet's start, the last at .255.
solid answer
~40 sFour subnets need 2 bits taken from the host part (2^2 = 4), so the prefix grows from /24 to /26, mask `255.255.255.192`, and each subnet keeps 6 host bits: 64 addresses, 62 usable. The subnets step by 64: `198.51.100.0/26` (hosts .1 to .62, broadcast .63), `198.51.100.64/26` (.65 to .126, broadcast .127), `198.51.100.128/26` (.129 to .190, broadcast .191) and `198.51.100.192/26` (.193 to .254, broadcast .255). Splitting costs addresses: one /24 has 254 usable hosts, four /26s have 248, because each subnet reserves its own network and broadcast. For a count that is not a power of two, such as five, borrow enough bits for the next power - three bits, eight /27s - and keep the spares.
go deeper
Remember that four subnets means borrowing two bits, so a /24 becomes four /26s of 62 usable hosts each.
Write out all four ranges from the block size of 64, explain why each network is a multiple of 64, and say what the split costs in usable addresses.
Know where the subnet-zero rule came from and why classless routing retired it, and spot misaligned blocks in someone else's plan before they cause overlaps.
Decide when equal splitting is good enough and when the waste justifies a variable-length plan, keeping room to grow each subnet without renumbering its neighbours.
## Borrowing bits Splitting a block into equal subnets moves the boundary between network bits and host bits to the right. Each bit **borrowed** from the host part doubles the number of subnets and halves the size of each: - borrowing *s* bits from a /n block gives **2^s subnets**; - each subnet has prefix **/(n + s)** and 2^(32 - n - s) addresses; - each keeps 2^(32 - n - s) - 2 usable host addresses. For four subnets, s = 2, because 2^2 = 4. The /24 becomes four **/26s**, mask `255.255.255.192`, each with 64 addresses and 62 usable hosts. Note the trap: you borrow the number of bits that *encodes* four subnets, not four bits. ## The four /26s, worked | Borrowed bits | Subnet | First usable | Last usable | Broadcast | |---|---|---|---|---| | `00` | 198.51.100.0/26 | 198.51.100.1 | 198.51.100.62 | 198.51.100.63 | | `01` | 198.51.100.64/26 | 198.51.100.65 | 198.51.100.126 | 198.51.100.127 | | `10` | 198.51.100.128/26 | 198.51.100.129 | 198.51.100.190 | 198.51.100.191 | | `11` | 198.51.100.192/26 | 198.51.100.193 | 198.51.100.254 | 198.51.100.255 | ## Why the boundaries fall where they do The two borrowed bits are the top two bits of the last octet, worth 128 and 64. Their four combinations, `00`, `01`, `10` and `11`, are 0, 64, 128 and 192; the other six bits are host bits. So: 1. Every network address is a multiple of 64, because its six host bits are zero. 2. Every broadcast is its network plus 63, because its six host bits are one - one below the next subnet's network address, and .255 for the last. 3. The first /26 shares its network address with the original /24, and the last shares its broadcast, 198.51.100.255; only the prefix length tells them apart. A /26 cannot start anywhere else. 198.51.100.50 AND 255.255.255.192 is 198.51.100.0, so .50 is simply a host inside the first /26; a block beginning at .50 would straddle two /26s and could not be written as one prefix. ## What a split costs Every subnet gives up its own network and broadcast address, so each further split loses usable space: | Split of one /24 | Subnets | Usable each | Usable total | |---|---|---|---| | none (/24) | 1 | 254 | 254 | | /25 | 2 | 126 | 252 | | /26 | 4 | 62 | 248 | | /27 | 8 | 30 | 240 | | /28 | 16 | 14 | 224 | That loss is the price of separate broadcast domains and separate filtering boundaries; it is usually worth paying, but it should be counted. ## Subnet zero and the all-ones subnet Older material says the first and last subnets of a split must not be used. That rule comes from RFC 950 (1985), which said subnet fields of all zeros and all ones "should not be assigned". Under classful addressing that made sense for two reasons: - **Subnet zero**: its network address, 198.51.100.0, is also the address of the whole classful network. - **The all-ones subnet**: its broadcast address was identical to the all-subnets-directed broadcast that RFC 1122 still listed in 1989. RFC 1812 (1995) declared the all-subnets-directed broadcast meaningless in a classless routing domain, and once every route carries its prefix length, 198.51.100.0/26 is not confused with 198.51.100.0/24. Classless practice uses all four subnets, and interviewers expect four, not two. ## When equal splitting is not the tool - **Not a power of two**: round the subnet count up. Five subnets need s = 3, giving eight /27s at .0, .32, .64, .96, .128, .160, .192 and .224; use five and keep three spare. - **Different sizes needed**: equal splitting wastes space when one segment needs 100 hosts and another needs 10. That calls for variable-length allocation, which carves the largest requirement first.
- What if you need five equal subnets from the IPv4 block 198.51.100.0/24?Two bits give only four, so borrow three: eight /27s at .0, .32, .64, .96, .128, .160, .192 and .224, each with 30 usable hosts. Use five and keep three spare for growth. If the five need different sizes, equal splitting is the wrong tool and you allocate variable-length subnets instead.
- Why can't the second IPv4 /26 inside 198.51.100.0/24 start at 198.51.100.50?A /26's network address has its six host bits all zero, so it must be a multiple of 64 in the last octet. 198.51.100.50 AND 255.255.255.192 is 198.51.100.0, so .50 is just a host inside the first /26. A range starting at .50 would straddle two aligned blocks and cannot be written as one prefix.
saying these in an interview costs you the question
- Splitting a /24 into four subnets gives four /28s.
- Each of the four /26s has 64 usable hosts.
- The four /26s together still provide 254 usable hosts.
- The first and last subnets of a split can never be used.
- A /26 can start at any address, such as 198.51.100.50.