03-30-2011 01:23 PM - edited 03-06-2019 04:21 PM
Hi all,
Is it possible to create a Wildcard & Access-list that only matches even networks?
So for example say I had:
192.168.0.0
192.168.1.0
192.168.2.0
192.168.3.0
192.168.4.0
Could I create an access-list that only matches the 0,2 & 4 networks?
Also when advertising into EIGRP, is there anything I can do with the wildcard mask to only advertise the evens?
Thanks,
Adam
03-30-2011 02:46 PM
Could I create an access-list that only matches the 0,2 & 4 networks?
Also when advertising into EIGRP, is there anything I can do with the wildcard mask to only advertise the evens?
Unfortunately No. We must use network statements/ACL statements for individual networks here like
192.168.0.0 0.0.0.255
192.168.2.0 0.0.0.255
The reason behind this is wildcard masks are the reverse of subnet masks. And we cant group even/odd networks using SNM too.
a 255.255.255.0 SNM is represnted as 0.0.0.255 in Wildcard Mask
Regards.
Please rate if the post was helpful
03-30-2011 02:50 PM
The reason behind this is wildcard masks are the reverse of subnet masks.
Wildcard masks are often simply the reverse of the subnet mask but they have much more flexibility than subnet masks, at least in access-lists. It is a common misconception that they are simply the reverse of subnet masks.
See post below.
Jon
03-30-2011 02:47 PM
adam-styles wrote:
Hi all,
Is it possible to create a Wildcard & Access-list that only matches even networks?
So for example say I had:
192.168.0.0
192.168.1.0
192.168.2.0
192.168.3.0
192.168.4.0
Could I create an access-list that only matches the 0,2 & 4 networks?
Also when advertising into EIGRP, is there anything I can do with the wildcard mask to only advertise the evens?
Thanks,
Adam
Adam
access-lists - yes
router config - no
in access-lists you can use this wildcard mask -
0.0.254.255 - this would match all even numbered networks from 192.168.0.0 -> 192.168.254.0 and not match any of the odd numbered subnets.
However even though you use a wild card mask in OSPF/EIGRP router config it is not actually a true wildcard mask and the above won't be accepted.
Edit - just to explain how this works -
each octet is represented in binary so -
254 =
128 64 32 16 8 4 2 1
1 1 1 1 1 1 1 0
some example 192.168.x.0 subnets -
192.168.27.0 - looking at the 3rd octet in binary is - 0001101 (note the last bit is 1)
192.168.42.0 - binary is 00101010 (last bit = 0)
192.168.193.0 = 11000001
192.168.246.0 = 11110110
etc...
you could write out all the subnets and all the odds will have the last bit set to 1. Logic tells you all odd numbered subnets would have to have the last bit set because only the last bit is an odd number when you look at the value of each bit in an octet. So if the last bit is not set then the network would have to be an even number.
Jon
03-30-2011 07:57 PM
For recent versions of IOS I agree with Jon that the routing protocols will not accept a discontiguous mask such as 0.0.254.255.
Some of us who have been working with Cisco IOS for a long time may remember that there was a time when old releases of OSPF would accept a discontiguous mask (such as 0.0.254.255). But then Cisco "enhanced" the code and that ability went away.
HTH
Rick
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide