Compute an access-list to match even or odd networks

One of my old student who is preparing for CCNP asked me on how to write an access-list for permitting/denying even or odd networks. So I am just pasting my email reply to him

Here is a simple tip to write an access-list for even or odd networks.

Lets say we are asked to permit all odd or permit all even for 192.168.1.0/24 ?

We’ll play the game with last octet or I should say the least significant bit of last octet.

-If it is 0, the IP address will be Even

-If it is 1, the IP address will be Odd 

192.168.1.00000001 = 192.168.1.1 – odd

192.168.1.00000011 = 192.168.1.3  – odd

192.168.1.00000010 = 192.168.1.2   even

192.168.1.00000100 = 192.168.1.4   even

FOR Even Networks

The IP address will be 192.168.1.0

With the wild card mask as 0.0.0.254

254 = 11111110

Here, 0 means DO CARE of the last bit in IP address (must be ZERO)

Hence ACL will be

access-list 1 permit 192.168.1.0  0.0.0.254

For Odd Networks

The IP address will be 192.168.1.1

With the wild card mask as 0.0.0.254

254 = 11111110

Here, 0 means DO CARE of the last bit in IP address (must be ONE)

Hence ACL will be

access-list 1 permit 192.168.1.1 0.0.0.254
 

  

8 Responses

  1. Hi Looks like we can achieve Odd networks other and simple way

    What is being denied by Even Networks can be allowed
    and What is being allowed by Even Networks should be denied…

    Simple

    access-list 1 deny 192.168.1.0 0.0.0.254
    access-list 1 permit any

    Kaushal

  2. Yeps you are right!

    Are you the same Kaushal who gave CCIE (security) lab exam in sanjose on April 23rd?

    -Raman

  3. I found some very useful information on your blog. I am a new blogger and i have very little khowledge about blogging. I found some very important blogging tips here. Thank you very much. With your help i created my own blog http://epshi.com . Look at my blog and please tell me what i required more. Thank you again.

  4. Wildcard masking technique to match bits is not widely known to the general, but the people who do understand it definitely knows their stuff. So does anyone know how to do this for IPv6 ACLs??

  5. [...] WOW ternyata bisa. berdasarkan artikel yang saya temukan di situs ini… [...]

  6. [...] an access-list to match even or odd networks This article was found on Cisco Tips & Tricks. Click here to visit the full article on the original website.One of my old student who is preparing for CCNP asked me on how to write an access-list for [...]

  7. thank for the tip i was a bit confuse about this one

Leave a Reply