Velocity Reviews > Newbee question:

# Newbee question:

Guest
Posts: n/a

 11-29-2003
John Doe wrote:
> 192.168.1.1
> 255.255.255.240
>
> Can someone please give me the formula that converts network bits "/28" to a
> subnet mask "240". I cannot figure this out. I don't want a calculator, I
> want to know how they got from a to b.
>
> 30 = 252 -> Why?

30 = 252 is not really correct, it should be /30 = 255.255.255.252,
separate 8bit segments, you need to consider each segment separately,

1111111 = 255
1111110 = 254
1111100 = 252
1111000 = 248
etc....

Therefore, a mask of 255.255.255.252 is in binary:
11111111.11111111.11111111.11111100

The first 30 bits are 1s, defining a network mask of 255.255.255.252, or
a "/30" subnet.

A "/28" subnet (255.255.255.240) would have a total of 28 "1" bits, the
final octet being "11100000" in binary, 240 decimal. In the same manner,
a simple class B network 172.16.0.0/16 has a netmask of 255.255.0.0. The
first 2 octets are all 1s, 16bits. The final 2 octets all 0s.

Make any sense or too much rambling?

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----

John Doe
Guest
Posts: n/a

 11-29-2003
192.168.1.1
255.255.255.240

Can someone please give me the formula that converts network bits "/28" to a
subnet mask "240". I cannot figure this out. I don't want a calculator, I
want to know how they got from a to b.

30 = 252 -> Why?
29 = 248
28 = 240
27 = 224
26 = 192
25 = 128
24 = 0

Walter Roberson
Guest
Posts: n/a

 11-29-2003
In article <HGWxb.42491\$(E-Mail Removed)> ,
John Doe <postmaster@127.0.0.1> wrote:
:192.168.1.1
:255.255.255.240

:Can someone please give me the formula that converts network bits "/28" to a
:subnet mask "240". I cannot figure this out. I don't want a calculator, I
:want to know how they got from a to b.

:30 = 252 -> Why?
:29 = 248
:28 = 240
:27 = 224
:26 = 192
:25 = 128
:24 = 0

The "28" refers to the number of bits to be held constant. The rest
of the bits [ (32-2 = 4 of them in this example] are allowed to
vary. Allow them to vary to their maximum value of all 1's -- 4
consequative 1's in this example, which would be decimal 15.
Subtract that value from 255 to get the netmask.

The formula would be (2^32 - 1) - (2^(32-N) - 1) which simplifies to
(2^32 - 2^(32-N)) as the complete 32 bit netmask.

If you just want to concentrate on the last byte, then it comes down
to (2^8 - 2^(32-N)). 2^8 is 256, so that's 256 - 2^(32-N).

30 -> 256 - 2^(32-30) -> 256 - 2^2 -> 256 - 4 -> 252
29 -> 256 - 2^(32-29) -> 256 - 2^3 -> 248
28 -> 256 - 2^(32-2 -> 240
etc.
--

John Doe
Guest
Posts: n/a

 11-29-2003
Thanks to the both of you. I see the light now

"John Doe" <postmaster@127.0.0.1> wrote in message
news:HGWxb.42491\$(E-Mail Removed). com...
> 192.168.1.1
> 255.255.255.240
>
> Can someone please give me the formula that converts network bits "/28" to

a
> subnet mask "240". I cannot figure this out. I don't want a calculator,

I
> want to know how they got from a to b.
>
> 30 = 252 -> Why?
> 29 = 248
> 28 = 240
> 27 = 224
> 26 = 192
> 25 = 128
> 24 = 0
>
>