IP addressing and subnetting are an important if basic part of networks. Network administators will learn how to calculate a subnet mask using the host's formula.
In this article, we will continue learning important IP addressing and subnetting information, and we will learn how to apply this valuable information to some real-world scenarios.
Review
Before we move on, I'd like to review some information that was covered in part one of this series, IP addressing and subnetting: What network administrators need to know.
- IP addresses must be unique on the Internet (when using public IP addresses) and on a private network (when using private IP addresses).
- DHCP is commonly used to hand out IP addresses. This helps to keep addresses unique, provides a database of addresses assigned and prevents administrators from having to assign addresses statically.
- IP addresses are 32 bits (made up of four octets of 8 bits each).
- A subnet mask is what tells the computer what part of the IP address is the network and what part is for the host computers on that network.
- Subnetting is the process of breaking a large network into smaller networks by adding 1s to the subnet mask.
- Today, classless IP addresses are used almost exclusively, and classful IP addresses are used only for certification testing or older routing protocols.
- A default gateway is where a device sends packets that are destined for a device not on the local LAN. Again, the device knows what is and what is not on the local LAN by the subnet mask.
- Private IP addresses are used by most networks today, and these special, non-routable IP addresses are translated to public Internet IP addresses when those devices need to talk to the Internet.
Now, let's learn more important IP address and subnetting information and how it applies to your real-world network.
Using the host's formula
A common real-world question when laying out your network is: "What subnet mask do I need for my network?" To answer this question, let's learn how to use the "host's formula." The host's formula will tell you how many hosts will be allowed on a network that has a certain subnet mask. The host's formula is 2n - 2. The "n" in the host's formula represents the number of 0s in the subnet mask, if the subnet mask were converted to binary (we will talk about this soon).
To use the host's formula, let's first look at a simple example. Say that you have the IP address space 192.168.0.0. Currently, you have a small network with 20 hosts. This network may grow to 300 hosts within the next year, however, and you may have multiple locations in time and need to allow for them to communicate using this address space. With only 20 hosts, the simplest thing to do would be to use 255.255.255.0 as your subnet mask. This would mean that you would have 192.168.0.x as your network and x.x.x.0-255 for your hosts.
Before you decide to use this subnet mask, however, let's apply the host's formula to it. To use the host's formula in this scenario, you take the subnet mask (255.255.255.0) and convert it to binary (for more information, see my binary-to-decimal conversion article). This would give you:To use the host's formula, let's first look at a simple example. Say that you have the IP address space 192.168.0.0. Currently, you have a small network with 20 hosts. This network may grow to 300 hosts within the next year, however, and you may have multiple locations in time and need to allow for them to communicate using this address space. With only 20 hosts, the simplest thing to do would be to use 255.255.255.0 as your subnet mask. This would mean that you would have 192.168.0.x as your network and x.x.x.0-255 for your hosts.
111111111 11111111 11111111 00000000
The host's formula is 2 n - 2, where "n" is the number of zeros in the subnet mask. As you can count, there are eight zeros in the subnet mask. To use this with the host's formula, you would calculate 28 - 2. This comes to 256 minus 2, or 254. So, with the subnet mask specified, you will get 254 usable hosts. This would suit your 20-user network now but won't support your future network host expectations of 300 hosts.
It is in your best interest to plan ahead and choose the best subnet mask the first time. This prevents you from having to come back later and change all the IP addresses on this network. If you remember from part one, adding 1s to the subnet mask means that you get fewer hosts per network but more networks. If you take away 1s from the subnet mask, you get more hosts per network but fewer networks. The latter is what we need to do.
To do this, let's take away one of the 1s to make our subnet mask:
11111111 11111111 11111110 0000000
In decimal, this is 255.255.254.0
11111111 11111111 11111110 0000000
In decimal, this is 255.255.254.0
This means that you have nine 0s in the subnet mask. To apply the host's formula with this subnet mask, what we would calculate is 29 - 2. This comes to 512 minus 2, or 510. So, with the subnet mask specified, you will get 510 usable hosts. This would definitely suit your 20-user network now and your future network host expectations of 300 hosts.
Considering that information, we know that the most efficient subnet mask for our network is 255.255.254.0. Our valid hosts are 192.168.1-255 and 192.168.1.0-254. That is how you arrive at the total of 510 usable hosts.
It is important to understand this and be able to calculate it longhand, but I verify my calculations with a subnet calculator like Solarwind's subnet calculator or Boson's subnet calculator.
You can use the host's formula to calculate "what-if" scenarios to determine the most efficient subnet mask for the size of your networks.
Comments
Post a Comment