How to calculate IP addresses in a subnet using Windows Calculator

Reading Time: 3 minutes

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.

11111111111111111111111100000000
2552552550

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

Image showing standard calculator in Windows Operating System
Image showing the option to switch to Scientific mode

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

11111111111111111111111100000000
2552552550

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

2^{(32 - 24)}=2^{8}=256

  1. 32 minus 24 = 8
  2. we now calculate 2 to the power of 8
  3. To do this, clear the calculator and type 2
  4. 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.

Let me know in the comments section below

/16 = ? post the answer below

/27 = ? post the answer below

/23 = ? post the answer below

That’s it. I hope you found this post useful.

How to convert IP and Subnet Mask from decimal to binary in Excel

Reading Time: 2 minutes

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.

  1. Launch Microsoft Excel on your device
  2. 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.

CIDR Notation Simplified

Reading Time: 3 minutes

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.

Screenshot of VNET creation in Azure. The image shows an IP address name space of 10.7.0.0/16 and a single subnet of 10.7.0/24

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,

11111111111111110000000000000000
25525500

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,

11111111111111111111111100000000
2552552550

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,

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

111111111111111100000000000000
25525500

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,

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

1286432168421
11000000


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

11111111111111111111111111000000
255255255192

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 🙂

Service dependencies win32 access denied

Reading Time: < 1 minuteWhen 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