How does an ip prefix
90.0.0.0/4
translate to
0101∗
in binary
and
10.0.0.0/2
to this:
00*
I'm trying to understand it since a while now but I am unable to derive the logic.
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.
Sign up to join this communityHow does an ip prefix
90.0.0.0/4
translate to
0101∗
in binary
and
10.0.0.0/2
to this:
00*
I'm trying to understand it since a while now but I am unable to derive the logic.
For a netmasked IP address xxx.xxx.xxx.xxx/N, convert each xxx octet in the address to binary. The masked address is the leftmost N bits with all other bits replaced with zeroes.
So 10.0.0.2/2 becomes 00001010 00000000 00000000 00000010 which is then masked to 00000000 00000000 00000000 00000000, because 00 are the leftmost 2 bits.
90.0.0.0/4 becomes 01011010 00000000 00000000 00000000 which is then masked to 01010000 00000000 00000000 00000000, because 0101 are the leftmost 4 bits.