Tip

IP addressing and subnetting: Calculate a subnet mask using the subnet's formula

Now that you understand the host's formula, you should also know the subnet's formula, which

    Requires Free Membership to View

will help you make sure you have the right subnet mask for the number of subnets that you have. Just because you determine that you have the right number of hosts for your LAN using the host's formula, doesn't mean that you will have enough subnets (networks) for your network. Let's see how the subnet's formula works.

The subnet's formula is 2n, where n is the number of 1s added to the subnet mask, from whatever the subnet mask was. Let's take the same example I had above but build on it.

More tips on IP addressing and subnetting
Calculate a subnet mask using the host's formula

IP addressing and subnetting: What network administrators need to know

Binary-to-decimal conversion

Say that I have network 192.168.0.0 and want to subnet it to support all my networks and hosts, and say that I expect to have 100 remote sites with 300 PCs each. What subnet mask should I use? In our last example, we found that the 255.255.254.0 subnet mask provided me with 510 hosts per subnet. That was more than adequate to support my 300 PCs, but does that same subnet mask provide me with networks for at least 100 remote sites? Let's find out.

To apply the subnet's formula to our 192.168.0.0 network, we start with the current subnet mask. What is the current subnet mask? I'm not talking about the classful subnet mask, just the current subnet mask for that network, which is 255.255.0.0. I can't use that subnet mask because it provides me with 65,000 hosts but only one network. I need at least 100 networks and at least 300 hosts per network. I want to "add 1s" to that subnet mask and break it up into more networks with fewer hosts (fewer than 65,000).

To do this, let's convert the 255.255.0.0 subnet mask to binary.
255.255.0.0 =
11111111 11111111 00000000 00000000
(in binary)

I am going to add 1s right after the last 1 on the right (in the middle of the mask, between the 1s and 0s). So, how many 1s do I add?

Let's throw a number out there, and say that I add five 1s to make it look like this:
11111111 11111111 11111000 00000000

Using the subnet's formula, this would give us 25 = 32 networks.

Thirty-two networks aren't enough to support my 100 remote sites, no matter how many hosts are in each network.

Let's add two more 1s to make it look like this:
11111111 11111111 11111110 00000000

Using the subnet's formula, this would give us 27 = 128 networks

This is at least 100, so I have enough subnets for my 100 remote networks. Do I have enough hosts? Using the host's formula, we calculate 29 – 2 = 510 (which we had already calculated above). So, we have enough hosts for our 300 PCs at each remote site.

This means that we have found the right subnet mask for our network. We convert our subnet mask from binary back to decimal and get 255.255.254.0.

Here is a screenshot and text output from the Solarwinds subnet calculator that verifies our calculations and shows which IP addresses are in which network:

 

 IP Address : 192.168.0.0 Address Class : Classless /16 Network Address : 192.168.0.0 Subnet Address : 192.168.0.0 Subnet Mask : 255.255.254.0 Subnet bit mask : nnnnnnnn.nnnnnnnn.sssssssh.hhhhhhhh Subnet Bits : 23 Host Bits : 9 Possible Number of Subnets : 128 Hosts per Subnet : 510 Subnet Mask Subnet Size Host Range Broadcast 192.168.0.0 255.255.254.0 510 192.168.0.1 to 192.168.1.254 192.168.1.255 192.168.2.0 255.255.254.0 510 192.168.2.1 to 192.168.3.254 192.168.3.255 192.168.4.0 255.255.254.0 510 192.168.4.1 to 192.168.5.254 192.168.5.255 192.168.6.0 255.255.254.0 510 192.168.6.1 to 192.168.7.254 192.168.7.255 192.168.8.0 255.255.254.0 510 192.168.8.1 to 192.168.9.254 192.168.9.255 192.168.10.0 255.255.254.0 510 192.168.10.1 to 192.168.11.254 192.168.11.255 192.168.12.0 255.255.254.0 510 192.168.12.1 to 192.168.13.254 192.168.13.255 192.168.14.0 255.255.254.0 510 192.168.14.1 to 192.168.15.254 192.168.15.255 192.168.16.0 255.255.254.0 510 192.168.16.1 to 192.168.17.254 192.168.17.255 192.168.18.0 255.255.254.0 510 192.168.18.1 to 192.168.19.254 192.168.19.255 192.168.20.0 255.255.254.0 510 192.168.20.1 to 192.168.21.254 192.168.21.255 192.168.22.0 255.255.254.0 510 192.168.22.1 to 192.168.23.254 192.168.23.255 192.168.24.0 255.255.254.0 510 192.168.24.1 to 192.168.25.254 192.168.25.255 192.168.26.0 255.255.254.0 510 192.168.26.1 to 192.168.27.254 192.168.27.255 192.168.28.0 255.255.254.0 510 192.168.28.1 to 192.168.29.254 192.168.29.255 192.168.30.0 255.255.254.0 510 192.168.30.1 to 192.168.31.254 192.168.31.255 192.168.32.0 255.255.254.0 510 192.168.32.1 to 192.168.33.254 192.168.33.255 192.168.34.0 255.255.254.0 510 192.168.34.1 to 192.168.35.254 192.168.35.255 192.168.36.0 255.255.254.0 510 192.168.36.1 to 192.168.37.254 192.168.37.255 192.168.38.0 255.255.254.0 510 192.168.38.1 to 192.168.39.254 192.168.39.255 192.168.40.0 255.255.254.0 510 192.168.40.1 to 192.168.41.254 192.168.41.255 192.168.42.0 255.255.254.0 510 192.168.42.1 to 192.168.43.254 192.168.43.255 192.168.44.0 255.255.254.0 510 192.168.44.1 to 192.168.45.254 192.168.45.255 192.168.46.0 255.255.254.0 510 192.168.46.1 to 192.168.47.254 192.168.47.255 192.168.48.0 255.255.254.0 510 192.168.48.1 to 192.168.49.254 192.168.49.255 192.168.50.0 255.255.254.0 510 192.168.50.1 to 192.168.51.254 192.168.51.255 192.168.52.0 255.255.254.0 510 192.168.52.1 to 192.168.53.254 192.168.53.255 192.168.54.0 255.255.254.0 510 192.168.54.1 to 192.168.55.254 192.168.55.255 192.168.56.0 255.255.254.0 510 192.168.56.1 to 192.168.57.254 192.168.57.255 192.168.58.0 255.255.254.0 510 192.168.58.1 to 192.168.59.254 192.168.59.255 192.168.60.0 255.255.254.0 510 192.168.60.1 to 192.168.61.254 192.168.61.255 192.168.62.0 255.255.254.0 510 192.168.62.1 to 192.168.63.254 192.168.63.255 192.168.64.0 255.255.254.0 510 192.168.64.1 to 192.168.65.254 192.168.65.255 192.168.66.0 255.255.254.0 510 192.168.66.1 to 192.168.67.254 192.168.67.255 192.168.68.0 255.255.254.0 510 192.168.68.1 to 192.168.69.254 192.168.69.255 192.168.70.0 255.255.254.0 510 192.168.70.1 to 192.168.71.254 192.168.71.255 192.168.72.0 255.255.254.0 510 192.168.72.1 to 192.168.73.254 192.168.73.255 192.168.74.0 255.255.254.0 510 192.168.74.1 to 192.168.75.254 192.168.75.255 192.168.76.0 255.255.254.0 510 192.168.76.1 to 192.168.77.254 192.168.77.255 192.168.78.0 255.255.254.0 510 192.168.78.1 to 192.168.79.254 192.168.79.255 192.168.80.0 255.255.254.0 510 192.168.80.1 to 192.168.81.254 192.168.81.255 192.168.82.0 255.255.254.0 510 192.168.82.1 to 192.168.83.254 192.168.83.255 192.168.84.0 255.255.254.0 510 192.168.84.1 to 192.168.85.254 192.168.85.255 192.168.86.0 255.255.254.0 510 192.168.86.1 to 192.168.87.254 192.168.87.255 192.168.88.0 255.255.254.0 510 192.168.88.1 to 192.168.89.254 192.168.89.255 192.168.90.0 255.255.254.0 510 192.168.90.1 to 192.168.91.254 192.168.91.255 192.168.92.0 255.255.254.0 510 192.168.92.1 to 192.168.93.254 192.168.93.255 192.168.94.0 255.255.254.0 510 192.168.94.1 to 192.168.95.254 192.168.95.255 192.168.96.0 255.255.254.0 510 192.168.96.1 to 192.168.97.254 192.168.97.255 192.168.98.0 255.255.254.0 510 192.168.98.1 to 192.168.99.254 192.168.99.255 192.168.100.0 255.255.254.0 510 192.168.100.1 to 192.168.101.254 192.168.101.255 192.168.102.0 255.255.254.0 510 192.168.102.1 to 192.168.103.254 192.168.103.255 192.168.104.0 255.255.254.0 510 192.168.104.1 to 192.168.105.254 192.168.105.255 192.168.106.0 255.255.254.0 510 192.168.106.1 to 192.168.107.254 192.168.107.255 192.168.108.0 255.255.254.0 510 192.168.108.1 to 192.168.109.254 192.168.109.255 192.168.110.0 255.255.254.0 510 192.168.110.1 to 192.168.111.254 192.168.111.255 192.168.112.0 255.255.254.0 510 192.168.112.1 to 192.168.113.254 192.168.113.255 192.168.114.0 255.255.254.0 510 192.168.114.1 to 192.168.115.254 192.168.115.255 192.168.116.0 255.255.254.0 510 192.168.116.1 to 192.168.117.254 192.168.117.255 192.168.118.0 255.255.254.0 510 192.168.118.1 to 192.168.119.254 192.168.119.255 192.168.120.0 255.255.254.0 510 192.168.120.1 to 192.168.121.254 192.168.121.255 192.168.122.0 255.255.254.0 510 192.168.122.1 to 192.168.123.254 192.168.123.255 192.168.124.0 255.255.254.0 510 192.168.124.1 to 192.168.125.254 192.168.125.255 192.168.126.0 255.255.254.0 510 192.168.126.1 to 192.168.127.254 192.168.127.255 192.168.128.0 255.255.254.0 510 192.168.128.1 to 192.168.129.254 192.168.129.255 192.168.130.0 255.255.254.0 510 192.168.130.1 to 192.168.131.254 192.168.131.255 192.168.132.0 255.255.254.0 510 192.168.132.1 to 192.168.133.254 192.168.133.255 192.168.134.0 255.255.254.0 510 192.168.134.1 to 192.168.135.254 192.168.135.255 192.168.136.0 255.255.254.0 510 192.168.136.1 to 192.168.137.254 192.168.137.255 192.168.138.0 255.255.254.0 510 192.168.138.1 to 192.168.139.254 192.168.139.255 192.168.140.0 255.255.254.0 510 192.168.140.1 to 192.168.141.254 192.168.141.255 192.168.142.0 255.255.254.0 510 192.168.142.1 to 192.168.143.254 192.168.143.255 192.168.144.0 255.255.254.0 510 192.168.144.1 to 192.168.145.254 192.168.145.255 192.168.146.0 255.255.254.0 510 192.168.146.1 to 192.168.147.254 192.168.147.255 192.168.148.0 255.255.254.0 510 192.168.148.1 to 192.168.149.254 192.168.149.255 192.168.150.0 255.255.254.0 510 192.168.150.1 to 192.168.151.254 192.168.151.255 192.168.152.0 255.255.254.0 510 192.168.152.1 to 192.168.153.254 192.168.153.255 192.168.154.0 255.255.254.0 510 192.168.154.1 to 192.168.155.254 192.168.155.255 192.168.156.0 255.255.254.0 510 192.168.156.1 to 192.168.157.254 192.168.157.255 192.168.158.0 255.255.254.0 510 192.168.158.1 to 192.168.159.254 192.168.159.255 192.168.160.0 255.255.254.0 510 192.168.160.1 to 192.168.161.254 192.168.161.255 192.168.162.0 255.255.254.0 510 192.168.162.1 to 192.168.163.254 192.168.163.255 192.168.164.0 255.255.254.0 510 192.168.164.1 to 192.168.165.254 192.168.165.255 192.168.166.0 255.255.254.0 510 192.168.166.1 to 192.168.167.254 192.168.167.255 192.168.168.0 255.255.254.0 510 192.168.168.1 to 192.168.169.254 192.168.169.255 192.168.170.0 255.255.254.0 510 192.168.170.1 to 192.168.171.254 192.168.171.255 192.168.172.0 255.255.254.0 510 192.168.172.1 to 192.168.173.254 192.168.173.255 192.168.174.0 255.255.254.0 510 192.168.174.1 to 192.168.175.254 192.168.175.255 192.168.176.0 255.255.254.0 510 192.168.176.1 to 192.168.177.254 192.168.177.255 192.168.178.0 255.255.254.0 510 192.168.178.1 to 192.168.179.254 192.168.179.255 192.168.180.0 255.255.254.0 510 192.168.180.1 to 192.168.181.254 192.168.181.255 192.168.182.0 255.255.254.0 510 192.168.182.1 to 192.168.183.254 192.168.183.255 192.168.184.0 255.255.254.0 510 192.168.184.1 to 192.168.185.254 192.168.185.255 192.168.186.0 255.255.254.0 510 192.168.186.1 to 192.168.187.254 192.168.187.255 192.168.188.0 255.255.254.0 510 192.168.188.1 to 192.168.189.254 192.168.189.255 192.168.190.0 255.255.254.0 510 192.168.190.1 to 192.168.191.254 192.168.191.255 192.168.192.0 255.255.254.0 510 192.168.192.1 to 192.168.193.254 192.168.193.255 192.168.194.0 255.255.254.0 510 192.168.194.1 to 192.168.195.254 192.168.195.255 192.168.196.0 255.255.254.0 510 192.168.196.1 to 192.168.197.254 192.168.197.255 192.168.198.0 255.255.254.0 510 192.168.198.1 to 192.168.199.254 192.168.199.255 192.168.200.0 255.255.254.0 510 192.168.200.1 to 192.168.201.254 192.168.201.255 192.168.202.0 255.255.254.0 510 192.168.202.1 to 192.168.203.254 192.168.203.255 192.168.204.0 255.255.254.0 510 192.168.204.1 to 192.168.205.254 192.168.205.255 192.168.206.0 255.255.254.0 510 192.168.206.1 to 192.168.207.254 192.168.207.255 192.168.208.0 255.255.254.0 510 192.168.208.1 to 192.168.209.254 192.168.209.255 192.168.210.0 255.255.254.0 510 192.168.210.1 to 192.168.211.254 192.168.211.255 192.168.212.0 255.255.254.0 510 192.168.212.1 to 192.168.213.254 192.168.213.255 192.168.214.0 255.255.254.0 510 192.168.214.1 to 192.168.215.254 192.168.215.255 192.168.216.0 255.255.254.0 510 192.168.216.1 to 192.168.217.254 192.168.217.255 192.168.218.0 255.255.254.0 510 192.168.218.1 to 192.168.219.254 192.168.219.255 192.168.220.0 255.255.254.0 510 192.168.220.1 to 192.168.221.254 192.168.221.255 192.168.222.0 255.255.254.0 510 192.168.222.1 to 192.168.223.254 192.168.223.255 192.168.224.0 255.255.254.0 510 192.168.224.1 to 192.168.225.254 192.168.225.255 192.168.226.0 255.255.254.0 510 192.168.226.1 to 192.168.227.254 192.168.227.255 192.168.228.0 255.255.254.0 510 192.168.228.1 to 192.168.229.254 192.168.229.255 192.168.230.0 255.255.254.0 510 192.168.230.1 to 192.168.231.254 192.168.231.255 192.168.232.0 255.255.254.0 510 192.168.232.1 to 192.168.233.254 192.168.233.255 192.168.234.0 255.255.254.0 510 192.168.234.1 to 192.168.235.254 192.168.235.255 192.168.236.0 255.255.254.0 510 192.168.236.1 to 192.168.237.254 192.168.237.255 192.168.238.0 255.255.254.0 510 192.168.238.1 to 192.168.239.254 192.168.239.255 192.168.240.0 255.255.254.0 510 192.168.240.1 to 192.168.241.254 192.168.241.255 192.168.242.0 255.255.254.0 510 192.168.242.1 to 192.168.243.254 192.168.243.255 192.168.244.0 255.255.254.0 510 192.168.244.1 to 192.168.245.254 192.168.245.255 192.168.246.0 255.255.254.0 510 192.168.246.1 to 192.168.247.254 192.168.247.255 192.168.248.0 255.255.254.0 510 192.168.248.1 to 192.168.249.254 192.168.249.255 192.168.250.0 255.255.254.0 510 192.168.250.1 to 192.168.251.254 192.168.251.255 192.168.252.0 255.255.254.0 510 192.168.252.1 to 192.168.253.254 192.168.253.255 192.168.254.0 255.255.254.0 510 192.168.254.1 to 192.168.255.254 192.168.255.255

In the real world

In the real world, chances are that you may never have the opportunity to design a large network such as this from scratch. However, large-scale network design skills are valuable for a variety of reasons:

  1. Understanding the subnetting of a large-scale network that is already implemented.
  2. Understanding what effect making changes to a network, its IP addressing, and its subnetting will have.
  3. To prove in a certification test that you understand IP addressing and subnetting and can apply them. Certifications like the CCNA require you to be able to apply these skills and calculate IP addressing "longhand" (without a calculator).

About the author:
David Davis (CCIE #9369, CWNA, MCSE, CISSP, Linux+, CEH) has been in the IT industry for 15 years. Currently, he manages a group of systems/network administrators for a privately owned retail company and authors IT-related material in his spare time. He has written more than 50 articles, eight practice tests and three video courses and has co-authored one book. His Web site is HappyRouter.com.

This was first published in November 2006

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.