This is really simple.
Simply subtract your mask from 255.255.255.255 to get your wildcard mask.
Example:
The wilcard mask of /26 is:
255.255.255.255 - 255.255.255.192 = 0.0.0.63
The wilcard mask of /19 is:
255.255.255.255 - 255.255.224.0 = 0.0.31.255
The wildcard mask of /12 is:
255.255.255.255 - 255.240.0.0 = 0.15.255.255
There is an alternative way of calculating your wildcard mask which follows on from the Subnetting Made Easy post about boundaries. If you do not understand what I mean about boundaries please read that post.
For example, if you had a /28, your next boundary is /32 so 32 - 28 = 4 and 24 = 16. If we subtract 1 from the block size it gives us 15 which is what we put into our wildcard mask in the octet that we are subnetting in. All octets before the one we are subnetting in are 0 and all octets after the octet we are subnetting in should be 255.
Let's follow that again:
1. /28 gives us 15 in the last octet (i.e. 32 - 28 = 4 and 24 - 1 = 15)
2. All octets before that octet have to be 0 (i.e. 1st, 2nd, and 3rd octets)
3. All octets after that octet have to be 255 (not applicable here as /28 is in the last octet)
4. We therefore have 0.0.0.15 as our wildcard mask
Let's do it with a /21:
1. /21 gives us 7 in the third octet (i.e. 24 - 21 = 3 and 23 - 1 = 7)
2. All octets before that octet have to be 0 (i.e. 1st and 2nd octets)
3. All octets after that octet have to be 255 (i.e. the 4th octet)
4. We therefore have 0.0.7.255 as our wildcard mask
Let's do it with a /9:
1. /9 gives us 127 in the second octet (i.e. 16 - 9 = 7 and 27 - 1 = 127
2. All octets before that octet have to be 0 (i.e. the 1st octet)
3. All octets after that octet have to be 255 (i.e. the 3rd and 4th octet)
4. We therefore have 0.127.255.255 as our wildcard mask
HTH,
Chris
It's like looking for a piece of bread to come down from the sky When it appears to be in the vicinity of your toe!
ReplyDeleteWell done!
Cromwell!
Glad it was of some help. Good luck with the rest of your studies.
ReplyDeleteI would like to advise people
ReplyDeletenot to underestimate how important
is that topic
After I have read Chris article I logged to my Semsim's curse launcher and worked on the OSF CONFIGURATION lesson. Everything I didn't understand before on that matter appeared very clear, like a crystal! And fast!!
Thanks!Thanks!Thanks again!
Cromwell,
Antoine-Serge Jean-Louis
8057 de l'Épée /4
Montreal, Canada
hello, i have just one question. why is it that on example What is the valid host range of the 7th subnet of address 10.0.0.0/14?
ReplyDeleteThe Answer was : Our valid host range must be 10.24.0.1 to 10.27.255.254 again remebering not to include our subnet (10.24.0.0) and the broadcast address (10.27.255.255).
Ca you show to us the complete solution? is it correct that it should have? :
10.0.0.0
10.4.0.0
10.8.0.0
10.16.0.0
10.32.0.0
10.64.0.0
10.128.0.0
and the seventh subnet would be 10.128.0.0 not 10.24.0.0?
help pls. thanks!
Hi Gino,
ReplyDeleteI will reply to this in the subnetting post as this post is to do with wildcard mask calculation.
Regards,
Chris
Thanks for the very informative blog on subnetting.
ReplyDeleteI have been working on this for a couple weeks. Honestly it was seemingly very hard to wrap my mind around an ideal that worked. Yours does.
Question:
10.0.0.0/21 would work out as follows?
24-21=3
2 to the 3rd power=8
so would the subnet ranges be;
10.0.0.0
10.0.8.0
10.0.16.0
10.0.24.0
etc?
Thanks,
KHGiese
Exactly right KHGiese.
ReplyDeleteEasy isn't it?
This is very useful and lots of good stuff.
ReplyDeleteI need help from any one
How do I work out the 750 hosts for one LAN and 512 hosts on another LAN (subnets) with IP address
172.16.0.0 and IP subnet zero enabled?
Hi Aba,
ReplyDeleteYou need to reserve 10 bits for each LAN to cover your hosts. As an IP address has 32 bits and you need to save 10 bits you therefore have a /22 mask (32 - 10). You could therefore have 172.16.0.0/22 and 172.16.4.0/22.
Regards,
Chris
well i m really thankful to you i was wondering for a easier way how to determine these topics i m really glad and 100 percent now confident that i can calclulate every query put to me regarding this thanks
ReplyDeleteGreat job!
ReplyDeleteThis is very helpful!
I have a few questions though, how do you get the address where it sit on, what is the basis and the valid host range?
Thanks so much! =)
Great methodology
ReplyDeleteI wander how to make it work for the following cisco academy question:
What combination of IP address and wildcard mask should be used to specify only the last 8 addresses in the subnet 192.168.3.32/28.
Cisco answer is 192.168.3.40 0.0.0.7.
Hi Alex,
ReplyDeleteSo you have:
What combination of IP address and wildcard mask should be used to specify only the last 8 addresses in the subnet 192.168.3.32/28.
192.168.3.32/28 covers 192.168.3.32 to 192.168.3.47. Your last 8 addresses will be 192.168.3.40 to 192.168.3.47. The equivalent of this is 192.168.3.40/29. Now a /29 is 0.0.0.7 as a wildcard mask. Therefore the answer given is correct.
HTH,
Chris
Hello Chris.My name is Kaushik and I am from India. I am pursuing my CCIE R&S. I found your wildcard mask stuff to be excellent.Thanks for the way you have written it so simple so that novice learners could grasp it very well. kudos to you. Hope that you become a CCIE very soon.All the very best and May God Bless You!
ReplyDelete(192.168.3.32/28 covers 192.168.3.32 to 192.168.3.47. Your last 8 addresses will be 192.168.3.40 to 192.168.3.47. The equivalent of this is 192.168.3.40/29. Now a /29 is 0.0.0.7 as a wildcard mask. Therefore the answer given is correct)
ReplyDeleteHi chris
can you please explain how did u get the slash /29 as the mask for 192.168.3.40.Really appreciate your help
Hi chris
ReplyDeletecan you please explain how did u get the slash /29 as the mask for 192.168.3.40.Really appreciate your help
A /29 mask has a block size of 8 in the last octet. Counting up in 8s in the last octet give us subnet addresses:
192.168.3.0/29
192.168.3.8/29
192.168.3.16/29
192.168.3.24/29
192.168.3.32/29
192.168.3.40/29
192.168.3.48/29
The question asked to summarise the last 8 addresses of 192.168.3.32/28 which as above is 192.168.3.40/29
Regards,
Chris
Great information and I found the explanation was very intuiative. I just want to add a link to another very useful link I found on the Internet regarding computing access-list and wild card pair http://www.ine.com/resources/01700370.htm . IT certainly helped me in real life, this is really great stuff hence I think it should be known/shared more widely.
ReplyDeletehi Chris... ignore the first question... Can you help me with this...? thank you
ReplyDeletehttp://www.scribd.com/doc/44503762
thanks really help full post
ReplyDeleteIts very helpful, thankx a million
ReplyDeletecheers
Thanks its Helpful
ReplyDeleteThanks dude. Both methods are very easy for calculating Wild Card Mask.
ReplyDeleteThanks again.
good job
ReplyDeleteRegards,
Jaleel.M
I know this post is older, but I just have to say thank you! This has helped me out far more than my university CIT professor!!
ReplyDeleteThis on is still hard to figure out.
ReplyDeletehow they got the answer.(d)....
Which of the following access-list commands matches all packets sent from hosts in subnet 172.16.5.0/25?
Choose one answer.
a. access-list 1 permit 172.16.5.0 0.0.0.128
b. access-list 1 permit 172.16.5.0
c. access-list 1 permit 172.16.0.5 0.0.255.0
d. access-list 1 permit 172.16.4.0 0.0.1.255