1
$\begingroup$

I was reading Data Communication book by Forouzan in which there is a one restriction put on CIDR subnetting by Internet authorities:

First IP address in the block should be evenly divisible by the number of addresses. For example, below, the first address, when converted to a decimal number, is 3440387360, which when divided by 16 (block size) results in 215024210. enter image description here

Since this did not clear the practical significance behind this restriction I went on exploring and came across the video where it is explained as follows:

Whenever we divide any number by $k^{th}$ power of 2 (another restriction being that the block size should be $2^k$), the reminder is least significant k bits. So evenly divisible by $2^k$ means that least significant $k$ bits should all be 0. This way the first address of the allocated address block can be used as a block ID since it has all 0s in the host ID part.

Now that seems more logical despite the fact that I dont understand how

evenly divisible by the number of addresses $2^k$

translates to

least significant $k$ bits should all be 0

Can't it be just that the decimal equivalent of least significant $k$ bits should be divisible by 2. I mean if least significant 4 bits (for a block of $2^4$ addresses) is $(1010)_2$, then it translates to $(10)_{10}$ which is divisible by 2.

So in short why is evenly divisible translates to all 0 LSBs?

$\endgroup$
1
$\begingroup$

Since each place in a binary number is a power of two, the binary expansion of $2^k$ for any $k$ will be a 1 followed by $k$ zeroes. Examples:

$$1 = 2^0 = 1$$ $$16 = 2^4 = 1\underbrace{0000}_{4\ zeroes}$$ $$512 = 2^9 = 1\underbrace{000000000}_{9\ zeroes}$$

Multiplying a number that ends in zeroes by another number (integer) produces at least that many trailing zeroes. So any number divisible by a number ending in $k$ zeroes has to end in at least $k$ zeroes.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.