In this note I am responding to some questions on the ``slash notation''
that were asked after class on 02/09/2002.
Let's look at the address space defined by
w.x.y.z/n .
Popularly:
This is the set of adresses, or class of addresses, that have the same
first n bits as w.x.y.z . (The FIRST n bits: count from left).
More accurately:
This is the the class of addresses that if we bitwise AND them with
the mask that consists of n ones followed by (32 - n) zeros gives
w.x.y.z .
From the second (correct!) definition we see that w.x.y.z/n makes
sense only if the last (32 - n) bits in w.x.y.z are zero. The first n
bits can be anything. (The first definition is ``sloppy'', and by
definition a sloppy definition is not a definition!).
Example:
128.235.0.0/18 .
Since 128 = 1000 0000
235 = 1110 1011 (128 + 64 + 32 + 8 + 2 + 1) ,
128.235.0.0/18 is the class of addresses of which the first 18 bits are
1000 0000 1110 1101 00
and the last 14 bits can be anything. For example, try 128.235.42.170 .
Is this in 128.235.0.0/18 ?
128.235.42.170 = 1000 0000 1110 1011 0010 1010 1010 1010
mask = 1111 1111 1111 1111 1100 0000 0000 0000 (18 ones,
14 zeros)
AND: 1000 0000 1110 1011 0000 0000 0000 0000
YES! 128.235.42.170 is in 128.235.0.0/18 .
Next, try 128.235.170.170
128.235.170.170 = 1000 0000 1110 1011 1010 1010 1010 1010
MASK = 1111 1111 1111 1111 1100 0000 0000 0000
AND: 1000 0000 1110 1011 1000 0000 0000 0000
NO! 128.235.170.170 is NOT in 128.235.0.0/18 .
(popularly: the 17-th bit is wrong, is one, must be zero)
Another example: is 128.236.42.42 in 128.235.0.0/18 ?
128.236.42.42 = 1000 0000 1110 1100 0010 1010 0010 1010
MASK = 1111 1111 1111 1111 1100 0000 0000 0000
AND: 1000 0000 1110 1100 0000 0000 0000 0000
NO! (popularly: the 14-th bit is one, must be zero, and the 15-th
and 16-th bit are zero, must be one). This could have been seen
immediately! (Since 235 is not equal to 236, there must be a
difference somewhere in the 9-th through 16-th bits).
---
For mathematically inclined students:
Consider the class w.x.y.z/n . suppose w.x.y.z has a (at least one) one
among its last (32 - n) bits. Prove that the class of adresses
w.x.y.z/n is empty.
---