Subnetting

Subnetting


Welcome to the ITFreeTraining video on subnetting. Understanding how to subnet is essential if you want to deploy and maintain IPv4 networks.

Download the PDF handout

Binary to Decimal
0:10 – In a previous video, I looked at how to convert from decimal to binary and binary to decimal. This is an important skill to know when subnetting so I will do a quick review. If I want to convert the following binary number to decimal I would use the following table. Each binary position has a value based on a power of 2. To convert the binary number, it is just a matter of adding it to the table. Using this value will give us the last row of the table. If the value is a 1, the power of 2 value is used, otherwise the total is a zero. Once all the totals have been worked out, it just a matter of adding them up to get the value. Now let’s have a look at converting decimal to binary.

Decimal to Binary
0:57 – Let’s consider the same value. To convert it to binary, the powers of 2 are used again. This time the value that is to be converted, 186 is compared with the powers of 2. If it is higher, which it is, a 1 is recorded. Since the value was higher, the powers of 2 value which is 128 is subtracted from the value. The new value, 58, is compared to the powers of 2 value. It is lower so a zero is recorded. The process is repeated until all the values are calculated. This will give the decimal number in binary. If you understand this process, then you are all set to start looking into subnetting. If you do not feel confident in your decimal and binary skills, I would suggest looking at our previous video of converting decimals as it goes into this process in more detail.

Subnet Mask
1:47 – Shown here are some examples of subnet masks. First, you can see subnet masks always have 1s on the left hand side while there are zeros on the right hand side. Due to this, notice in very first column, the last decimal in the IP address. Since 1s and 0s must be contiguous, certain decimals will always be used. Notice too, that the number of subnets and hosts that are available depending on which subnet mask is used. As the number of 1 bits in the subnet mask decreases, more hosts are available per subnet, however fewer subnets are available. Notice also, that in the top two subnets, there are no subnets or hosts available. To understand more about subnets, let’s have a look at why this is the case.

Network Prefix & Host Identifier
2:37 – The subnet mask divides an IP Address into a network and host identifier. So what happens when you are given an IP address like this one where all the subnet mask bits are set to one? First the IP Address and the subnet mask are applied. The will allow the network prefix and host identifier to be found. It is no surprise in this case, that the host identifier will be 0.0.0.0 this is because no bits have been assigned to the host part. When a subnet mask that is all 1s is used, the network prefix will always be the same as the original IP address. So the question remains, when is this useful?

255.255.255.255 Subnet Mask
3:24 – This subnet mask is used when an exact match to an IP Address is required. Often you will see this used in routing tables. When used in a routing table, it is used to ensure that data gets routed a certain way. To understand when this subnet mask may be used, consider this example. Let’s say the administrator has a workstation on the network that is connected to a router. Users are also on the same network as the administrator and access a server on a remote network through a router. It is decided that the router that will be changed to a device that supports connections between clients and servers as well as handling the routing aspect. There are still some problems with the devices, and more configuration and testing is required before it can replace the router on the network. For these reasons, the new device is given its only IP on both networks. The problem that now occurs is that the administrator wants to access the server using the new device, but does not want to affect the other users. So basically, the administrator needs to route a single IP address to the new device. To achieve this, a route is added to the local administrator’s workstation. Since the 255.255.255.255.255 subnet mask was used, only traffic for that server will be effected. You can see that using this subnet mask creates an exact match ensuring only traffic that is destined for that server will be routed through the new device. Any other traffic for any other network will not match this new rule and will be sent to the router. You can see the administrator has achieved the objective of not effecting any other users on the network and also making sure all traffic from their workstation for the server is routed through the new device.

255.255.255.254 Subnet Mask
5:20 – The next subnet mask we’ll go over is the 255.255.255.254 mask. This turns out to be an interesting subnet mask and leads us into the next topic of network and broadcast addresses. If I use the following two IP Addresses as an example, the next step would be to apply the subnet mask. If I consider the left IP Address, when the subnet mask is applied the following will occur. All the 1bits, which in this case there are 31 of them, will become the network ID. All the zero bits on the right of the 1s, which is only the 1 bit in this case, will become the host identifier. The right IP address, when the subnet mask is applied, will give the same network ID but this time give the host identifier of 1. If a host identifier is all zeros or all one bits, it is treated differently than the other host identifiers. Let’s see how.

Network Address and Broadcast Address
Any host ID that is all zero bits is considered to be the network address. The advantage of having such an address is that when this address is used, it is clear that only the network is being referred to and not a host on the network. In contrast, any host ID that is all 1 bits is considered to be the broadcast address. A broadcast address, when it is used, will transmit the same network transmission to all hosts on that network. So how does affect the number of hosts that can be on a network?

192.168.0.0/24 Breakdown
6:57 – Shown here are 9 different subnet masks and the number of subnets and hosts per subnet mask. Notice the number of useable hosts per subnet is always 2 less than the possible addresses. This is because 2 of the addresses are always used for the network and broadcast address. The question worth asking however is, in the case of when 31 bits are used for the subnet mask, when the network and broadcast addresses are allocated, this leaves no hosts. So is there a need to ever use this subnet mask? Let’s have a look.

/31 or 255.255.255.254 Subnet Mask
7:35 – When the internet was first developed, there was never too much consideration for how efficient IP allocation was going to be. So, originally, you could not use this subnet mask. Nowadays, with IPv4 address exhaustion, there is a drive to utilize what remains of IPv4 addresses as efficiently as possible. For this reason, back in 2000 a method of utilizing this subnet was developed. A good example of when to use the subnet mask is when there is a one-to-one link between devices. For example, you have a router in New York and another router in London that is connected directly by the one connection. This is a good example of when only two IP addresses are required. One for each router. So if you had a subnet mask that supports two IP addresses, this would be great and an efficient use of IP addresses. Nowadays the IPv4 standard allows this subnet mask to be used in this scenario. When previously, it did not. SO in this example, an IP address could be allocated to each router. When this subnet mask is used, since it only supports 2 IP addresses, the network address and broadcast are lost. The network address is generally used mostly on network maps and you will typically see them posted on the walls of IP departments. So its loss is not that significant. The administrator only need to know, when reading network maps, to recognize it as a valid IP Address. The loss of the broad cast address is a little more significant as it essentially means broadcasts can no longer be sent. In this example, routers don’t generally send broadcasts to each other. There are cases with routing protocols needing to exchange information with each other, but this is done using unicast (basically direct communication), or multicast where traffic is destined for many addresses, but not broadcast. So in this case, the subnet mask will work. The only problem is since this was added to the IPv4 protocol, old devices may not support it. New commercial routers nowadays should have no problem supporting this. With older routers, you may need to perform an upgrade of the software in order to support it. I have looked at one end of the subnet masks, next I will have a look at the middle range of subnet masks. In the real world, you will generally be given an address and subnet mask. You will need to subdivide this address to meet your needs. In this case, the address is a private IP address and 16 bits have already been used leaving us another 16 bits to work with. To subdivide the remaining addresses, I will use the following tables. The process involves choosing how many bits you want to use for networks and how many bits you want to use for addresses on those networks. If for example, I was to choose 17, this would allow 2 networks with 32,768 addresses per individual network. That’s a huge amount of addresses per network. If I was to instead decide to use a CIDR of 24, this would give 256 networks with 254 addresses per network. This is a popular subnet mask as it gives a decent amount of addresses per network and since it is on an 8-bit boundary, it is much easier to work with. The subnet mask for a CIDR of 24 is actually 255.255.255.0, the binary math is easy to work out. Let’s have a closer look at how you would use this subnet mask. This is a simple example, so no binary math is required, but to show the whole process, I will first change the network that I was given to work with, to binary. The first 16 of the 32 bits have already been subnetted. This is common practice. For example, perhaps your company has already allocated IP addresses for regions around the world. They then give you a small part for allocation in an individual region. ISPs will also do the same thing to a customer using subnetting. The customer is free to allocate and subnet what they are given as they see fit. The next 8 bits are free to be allocated as it is required. In our case, the 8 bits have been chosen. The last 8 bits can be used by addresses. So what does all this mean? Now that all the subnetting has been done, this allows us to work out what networks can be utilized on the network. The first network will start with 10.6 since this was the part of the address that was already subnetted. The next part is the 8 bits that we can subnet, starting from all bits being 0 gives us the address of 0. Finally, the addresses that are assigned on this network are 0 to 255. Remember that 0 and 255 cannot be used for hosts, leaving us with 254 useable addresses. The next network will be the same as the first except the 3rd will be a 1. Notice as well, the next network will be a 2. This will continue till the last network is 255. In the old days of the internet, it was discouraged to use a subnet with all 0s or all 1s. In our example, the 0 and 255 subnet contains all 0s or 1s. Nowadays it is allowed to use this subnet. You may have problems however is you use very older network equipment.


References
“Installing and Configuring Windows Server 2012 R2 Exam Ref 70-410” pg 201

Credits
Trainer: Austin Mason http://ITFreeTraining.com
Voice Talent: HP Lewis http://hplewis.com
Companion Document: Phillip Guld https://philguld.com
Video Production: Kevin Luttman http://www.KevinLuttman.com
Quality Assurance: Brett Batson http://www.pbb-proofreading.uk