In this blog post I will take you through working out how many IPv4 IP addresses there are in a subnet using the built in Windows calculator.

Let’s take an example of a /24 mask, and I want to know how many IP addresses I can use,

192.168.1.0/24 and a mask of 255.255.255.0

If you haven not already read my post on CIDR notation simplified, I would recommend you have a read.

11111111

11111111

11111111

00000000

255

255

255

0

Add up the 1’s, that’s a total of 24 bits, that’s where the /24 comes from. See my post CIDR notation simplified if you wish to dive deeper.

How do I calculate how many available IP addresses I can assign from the above. We’ll use the Windows calculator,

Click on your start menu and search for calculator,

Switch from standard to scientific

In the example above we had a subnet mask of /24. The sum to calculate the number of IP addresses available would be,

A total of 32 if we total all the bits together, we minus the bits which are turned on, 24, so that’s 32 – 24 leaving us with 8 bits (The last box to the right below).

11111111

11111111

11111111

00000000

255

255

255

0

The sum is below, but let’s input this into the calculator.

32 minus 24 = 8

we now calculate 2 to the power of 8

To do this, clear the calculator and type 2

Next, click the Xy button as shown in the screenshot below

5. Type 8 and click the = button

That gives us 256 IP addresses in a /24 subnet mask. We take away two as we don’t use .0 (Network address) and 255 (Broadcast address) = 254 IP’s that we can use

Try the sum with another example,

What do you get if you calculate /16, /27 and /32 using the method above. What numbers appear on your calculator.

In this blog post I will take you through how to convert an IP address and subnet mask from decimal to binary using Microsoft Excel.

Launch Microsoft Excel on your device

Type in a IP address and subnet mask. In the image below, I have typed a row title of IP address in Column A, Row 1 and Subnet Mask in Column A row 2. I have then inputted a random IP address of 192.168.1.5 and the subnet mask of 255.255.255.0. I have further added title IP Binary in Column A, Row 3 and Subnet Binary in Column A, Row 4 (see image below).

3. Click on cell B:3 (Column B and Row 3). Let’s convert the IP address to binary first.

4. Type =DEC2BIN(B1, 8) and press enter

8 = the number of bits you want to see

5. This gives you the binary digits for 192

6. Click the green square and whilst holding down the left button on your mouse, drag to column E as shown in the image below.

7. The result should be as shown in the image below. You now have the binary digits for the IP address 192.168.1.5. Try changing the IP address to a different one, you’ll find the binary digits will also change.

8. Go through the same steps for the subnet mask, so in column B, row 4, type =DEC2BIN(B2, 8) and press enter on your keyboard. Drag field across to column E as you did in step 6 above.

You now have your very own decimal to binary calculator. Change the IP address and subnet mask as you wish, the binary digits should change.

I hope you found this useful. Please feel free to comment below if you have any feedback.

The aim of this blog post is to help you understand CIDR notations. The purpose of this blog post is not to understand IP address calculations. Let’s get started.

Let’s take Microsoft Azure as an example, but the same applies on all networks.

When building a VNET in Azure one of the requirements is to specify an IP range for your VNET, for example, I’ll use 10.7.0.0/16 for the purpose of this post. We further segment the IP address name space into Subnets, for example, 10.7.1.0/24, 10.7.2.0/24 and so on. To learn more about Azure Virtual Networks, visit the following Microsoft Learn link – Explore Azure Virtual Networks – Training | Microsoft Learn

The above ranges 10.7.0.0/16, 10.7.1.0/24 and 10.7.2.0/24 are known as CIDR notations.

So why do we use CIDR notations and how do we work them out?

The definition of CIDR notation from Wikipedia: Classless Inter-Domain Routing is a method for allocating IP addresses and for IP routing.

Let’s try to simplify further,

CIDR notation is a convenient way to write subnet masks instead of having to type/write, for example, 255.255.255.0 or any other subnet mask such as 255.255.0.0 etc. Instead you create a CIDR notation as per the examples above.

So what subnet mask does /16, /24, /26 etc refer to and how do we work out the subnet mask by looking at two digit numbers such as /24 /16 and so on? Well, each number refers to a different subnet mask. A few examples below,

/16 refers to: 255.255.0.0 /24 refers to: 255.255.255.0 /26 refers to: 255.255.255.192

To work out CIDR notation, we need to understand that IP’s are structured in numbers of either 0 or 1. Yes, may be confusing but let’s break this down further,

Let’s take subnet mask 255.255.0.0 as an example. IP addresses include 4 octets and each octet (under the hood) makes up 8 bits, so the above mask would look like this in binary,

11111111

11111111

00000000

00000000

255

255

0

0

Because the last two octets are not activated, we leave them as zero’s.

So how do we work out the CIDR notation from the above? count the 1’s. We have 8 1’s in the first octet and 8 1’s in the second, so that’s a total of 16, therefore, the CIDR range would be /16

Let’s try another one,

11111111

11111111

11111111

00000000

255

255

255

0

What is the CIDR notation for the above? count the 1’s?

Yes, you got it. It’s /24

You may be thinking how do I work out the number 255 and where does the number 255 come from? Yes we understand that 1 = activated and 0 = not activated, but how do we come to a number of 255?

First of all, we need to understand where 255 comes from and how it’s calculated. To work this out, we need to visit the binary table. The binary table starts with 1 and ends with the number 128 as below,

128

64

32

16

8

4

2

1

Binary table

A task for you, what number do you get if you add all of the numbers above? 255, right?

So if we go back to the example from earlier (see below), 8 1’s in the first octet add up to 255 because we have activated all digits. The digits in the second octet have also been activate which total 255. The third and fourth octets have not been activated, therefore, they remain as zero’s.

11111111

11111111

0000000

0000000

255

255

0

0

The result is a /16 CIDR notation because we add up all the ones from octets one and two.

ok, so you now understand where the number 255 comes from. What about a mask of,

255.255.255.192

How would you work this out?

We need to revisit the binary table again, I have copied it below,

128

64

32

16

8

4

2

1

Binary table

We use the binary table to retrieve the number of 192. Starting from the left of the binary table, we have 128 and we know that 128 on its own does not make up 192. However, if we add the numbers from the binary table 128 + the next number 64, we get 192, see below.

128

64

32

16

8

4

2

1

1

1

0

0

0

0

0

0

Therefore, we activate two digits in the fourth octet as per the below.

11111111

11111111

11111111

11000000

255

255

255

192

What is the CIDR notation for the above? add up the 1’s and you get a /26, 8 + 8 + 8 + 2 = 26

First octet: 255 – we add up all numbers from the binary table to get a maximum of 255

Second octet: 255 – we add up all numbers from the binary table to get a maximum of 255

Third octet: – we add up all numbers from the binary table to get a maximum of 255

Fourth octet: 192 – This time we only need to add the first two numbers from the binary table (128 +64), therefore activating two digits 11000000

I hope this helps. If you have any questions/feedback please feel free to comment below. Thank you 🙂

Reading Time: < 1minuteWhen you right click on a service, click properties and access the dependencies tab, you receive the below error:

Error: win32 access denied

This worked for me:

1) Right click ‘Remote Procedure Call (RPC) service’
2) Click properties
3) Click the logon tab
4) Switch the ‘log on as’ from network service to local service
5) Restart the machine

Subscribe

Subscribe to new tech posts.
We will never send you spam email or forward your details to third parties.

This will close in 0 seconds

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.

Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.

Cookie

Duration

Description

cookielawinfo-checbox-analytics

11 months

This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".

cookielawinfo-checbox-functional

11 months

The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".

cookielawinfo-checbox-others

11 months

This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.

cookielawinfo-checkbox-necessary

11 months

This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".

cookielawinfo-checkbox-performance

11 months

This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".

viewed_cookie_policy

11 months

The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.

Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.

Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.