Welcome

First of all, may I welcome you to my site. My name is Chris and I'm from the UK and work as a Systems Engineer for Cisco. This blog was initially created to post up my subnetting technique but has now got more stuff to do with attaining Cisco certifications. Either way I really hope that the content is sufficent for your needs and I look forward to hearing your feedback. If you find that the content really helps you please feel free to donate using the PayPal link on the right.

To view the index of all my articles please click here.

How to calculate the Wildcard Mask

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

Posted byChris Bloomfield at 11:36  

25 comments:

cromwell said... 16 April 2008 at 16:18  

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!

Well done!

Cromwell!

Chris Bloomfield said... 16 April 2008 at 18:36  

Glad it was of some help. Good luck with the rest of your studies.

cromwell said... 16 April 2008 at 19:51  

I would like to advise people
not 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

Gino Angelo said... 23 May 2008 at 22:52  

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?

The 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!

Chris Bloomfield said... 24 May 2008 at 09:15  

Hi Gino,

I will reply to this in the subnetting post as this post is to do with wildcard mask calculation.

Regards,

Chris

KHGiese said... 26 June 2008 at 17:02  

Thanks for the very informative blog on subnetting.

I 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

Chris Bloomfield said... 26 June 2008 at 18:11  

Exactly right KHGiese.

Easy isn't it?

aba said... 8 July 2008 at 21:59  

This is very useful and lots of good stuff.

I 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?

Chris Bloomfield said... 9 July 2008 at 18:22  

Hi Aba,

You 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

saggi50 said... 30 August 2008 at 20:24  

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

Ron said... 30 October 2008 at 20:03  

Great job!

This 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! =)

alex said... 11 May 2009 at 23:58  

Great methodology

I 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.

Chris Bloomfield said... 27 May 2009 at 23:29  

Hi Alex,

So 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

rupul said... 27 April 2010 at 09:10  

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!

aju said... 12 May 2010 at 13:20  

(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)
Hi chris
can you please explain how did u get the slash /29 as the mask for 192.168.3.40.Really appreciate your help

Chris Bloomfield said... 12 May 2010 at 15:41  

Hi chris
can 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

Vincent said... 7 July 2010 at 09:53  

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.

Sunil Kumar said... 2 December 2010 at 01:20  

hi Chris... ignore the first question... Can you help me with this...? thank you

http://www.scribd.com/doc/44503762

Dr. $py said... 6 December 2010 at 19:52  

thanks really help full post

PaaNii said... 10 March 2011 at 15:07  

Its very helpful, thankx a million

cheers

networkfaq said... 14 August 2011 at 21:11  

Thanks its Helpful

Kishan Gupta said... 16 November 2011 at 15:14  

Thanks dude. Both methods are very easy for calculating Wild Card Mask.

Thanks again.

Jaleel said... 19 November 2011 at 17:37  

good job

Regards,

Jaleel.M

sparksd said... 20 June 2012 at 05:47  

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!!

krbrownz said... 15 January 2014 at 16:19  

This on is still hard to figure out.
how 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

Post a Comment