how can I find Net mask address in the rage: 192.16.128.0 to 192.16.135.255 Note: I want to use Classless Inter-Domain Routing so net mask should not be multiple of 8. what should we calculate it for every different range ?
1 Answer
If you write those addresses in binary, you get:
11000000 00010000 10000000 00000000 = 192.16.128.0
11000000 00010000 10000111 11111111
| ----- 21 bits ----- |
Since the addresses have the same first 21 bits, the mask is then /21 (255.255.248.0) .
Otherwise you can do it in the head for simple case: x.x.x.0-255 is /24, two of those networks (starting on an even number) are /23, 4 are /22, 8 are /21 (135-128=8).
-
I don't understand: "two of those networks (starting on an even number) are /23, 4 are /22, 8 are /21 (135-128=8)". could you please explain more? And how can we calculate if addresses have not the same like above axample?– user5716May 16, 2014 at 13:49
-
"Have not the same"? Two /24 networks (eg 192.16.128.0/24 and 192.16.128.1/24) combined make a /23 (192.16.128.0/23) network. Four /24 networks make a /22, and eight (192.16.{128..135}.0/24) make a /21 network (used in your case)– mulazMay 16, 2014 at 14:30
-
could you please explain to me step by step how to compute mask address. I'm confused! :(– user5716May 16, 2014 at 17:19
-
Write the addresses in binary, count the number of same bits in both addresses (count from left to right, stop at first different bit), and you get the longest possible mask length, for the two addresses to be in the same network.– mulazMay 16, 2014 at 17:21