cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
620
Views
20
Helpful
6
Replies

Need help to understand this prefix list

hfakoor222
Spotlight
Spotlight
  • Create a single prefix-list statement to filter out any subnet in the Class C network range that has a subnetmask of /25, /26 or /27. As a result all the Class C subnets with /24 or higher than /27 should still be in Vanilla’s routing table.

 

So the answer given is

 

seq 5 deny 192.0.0.0/3  ge 24  le 27

 

I don't understand this statement

"we take 192 and look at first 3 bits  for a class C"

 

 

How is it looking at first 3 bits to look for the class c range?

Class C network number values begins at 192 and end at 223.

 

How am I supposed to get the range of 192-223 by looking at 3 bits?

Which 3 bits?

And what am I supposed to do with those bits to get the range?

 

Thank you

 

I

1 Accepted Solution

Accepted Solutions

Hi

 3 bits means:

1 bit - /25 or .128

2 bits - /26  or 192

3 bits -  /27 or 224

00000000.00000000.00000000.10000000 - 128 -

00000000.00000000.00000000.11000000-  192 -

00000000.00000000.00000000.11100000 - 224 -

/27 255.255.255.224 0.0.0.31
/26 255.255.255.192 0.0.0.63
/25 255.255.255.128 0.0.0.127

View solution in original post

6 Replies 6

Hi

 3 bits means:

1 bit - /25 or .128

2 bits - /26  or 192

3 bits -  /27 or 224

00000000.00000000.00000000.10000000 - 128 -

00000000.00000000.00000000.11000000-  192 -

00000000.00000000.00000000.11100000 - 224 -

/27 255.255.255.224 0.0.0.31
/26 255.255.255.192 0.0.0.63
/25 255.255.255.128 0.0.0.127

Using math this would be:

 

2^7 + 2^6 + 2^ 5+ 2^4 + 2^3 + 2^2 + 2^1 + 2^0

  1   - 1  -  1  - 1 -   1  -  1-   1 -   1   - 1 =     128+64+32+16+8+4+2+1 =  256

If you replace 1 by 0 ==>

1 - 0- 0- 0- 0- 0- 0-0 ==> 128

1-1-0-0-0-0-0-0-0 ==> 192

1-1-1-0-0-0-0-0-0==224

 Understand now why 3 Bits?

 

The mask is formed by concatenating 0 and 1s in the way that you go from 2^0 which 1 up to 2^7 which is 128.

I used google to count number by number from 192 to 224 to binary and it made sense to me. I learned this logic originally using wildcard then still get confused often.

 

But I believe I understand now.

 

Thank you.

Hello


@hfakoor222 wrote:
  • Create a single prefix-list statement to filter out any subnet in the Class C network range that has a subnetmask of /25, /26 or /27. As a result all the Class C subnets with /24 or higher than /27 should still be in Vanilla’s routing table.

 

So the answer given is

 

seq 5 deny 192.0.0.0/3  ge 24  le 27

 

I don't understand this statement

"we take 192 and look at first 3 bits  for a class C"

 

 

How is it looking at first 3 bits to look for the class c range?

Class C network number values begins at 192 and end at 223.

 

How am I supposed to get the range of 192-223 by looking at 3 bits?

Which 3 bits?

And what am I supposed to do with those bits to get the range?

 


You have initially 4 octets each with 8 binary bits to equal 32 bits for a IPV4 network
00000000 00000000 00000000 00000000

Each octet in binary adds up to 255 if they equal to 1
128 64  32 16  8  4  2  1
  0    0    0   0   0  0  0  0  = 0

128 64  32 16  8  4  2  1
  1    1    1   1   1  1  1  1  = 255

and a class C network comprises of 24 network and 8 host bits

nnnnnnnn nnnnnnnn nnnnnnnn hhhhhhhh

So now the first "3" bits of this class C will give you 192 value

128 64  32 16  8  4  2  1
  1   1    0   0   0  0  0  0
nnn
nnnnn nnnnnnnn nnnnnnnn hhhhhhhh

so to deny all class C subnetted networks from /25 to /27, the prefix-list would be :

ip prefix-list 10 deny 192.0.0.0/3 ge 25 le 27
ip prefix-list 99 permit 0.0.0.0 /0 le 32

 


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

Thank you that helps a lot

Review Cisco Networking for a $25 gift card