IP Subnetting Basics
One of the topics that seem to be the hardest for those entering the networking field is the concept of subnetting and addressing. There are a number of different techniques that can be used to explain how to subnet, many are good and greatly depend on the aptitude of the learner and whether the technique used works for that specific learner. This article is intended as an addressing and subnetting primer and will initially review what the Internet Protocol (IP) address is and how it is structured; it will then go over a number of the main IP concepts that are commonly referenced in subnetting documentation and guides. As the audience for this article is a reader with no previous subnetting experience, more advanced subnetting examples and the binary math behind subnetting be covered in the companion article “Advanced IPv4 Subnet Concepts and Examples.”
What is an IP Address Used For?
Most individuals entering into the networking field have at least heard of IP and know that it can be assigned to an end device. The question that is often asked by these individuals is “what is an IP address used for and why is it needed?” The IP address, unlike other addresses that exist on an end device, is used to communicate with it over an IP network; this network can be local (like a corporate network), global (like the Internet) or can be a combination of both. From an end user perspective, the only thing that is required is an IP address that is able to be assigned to their device (or devices) that enables them to speak with the intended destination.
For most home users, this is a single address that is given by an Internet Service Provider (ISP) that enables the user to speak with any destination that also exists on the Internet. In a corporate environment, each corporate device is assigned an address that at least enables it to speak with the required internal corporate resources (and typically also enables some amount of Internet access). The address is 32 bits long and is notated using 4 different octets (groups of 8), for example 00000001.00000010.00000011.00000100 (binary) or 22.214.171.124 (decimal).
How are IP Addresses Split Up?
So why would an IP address range need to be split up? Think of it this way: if all IP addresses existed without being split into smaller ranges, it would be almost impossible to assign them logically to the many different entities that exist on the Internet. As the Internet is a global network, there are a number of different entities that exist and want to use it; for example: ISPs, corporations, governments, educational institutions and end users.
So why assign an address to these different entities? If an IP addressing space was randomly assigned it would be impossible to efficiently route traffic from source to destination. Let’s use the US Postal Service as an example; what if postal address assignment was random? What if there were three houses on a block: house #1 had address 38748923, house#2 had address 83639567 and house #3 had address 53845284? In this scenario, how would the post office route mail to these addresses? They would have to individually route every parcel based on a specific address; even the mail distribution points would need to reference very specific addressing tables to ensure proper routing. The same is true for IP addresses. If the space was not split up logically, the Internet routers would need to have a table entry for every single IP address; and keep in mind that with IP version 4 there are over 3 billion total addresses used on the Internet. Imagine for a minute the amount of investment that would be required for each of these connected routers to hold this large of a table, even modern high speed routers would not be able to process this size of table.
The initial solution to this problem was to split the IP address space into classes, these included:
- Class AAll addresses within this range begin with a binary ‘0’ in the first octet which results in addresses from 0.0.0.0 through 127.255.255.255. With the class A address space, the other 7 bits of the first octet are used to separate the space into different networks (and were assigned to different organizations), this allowed for a total of 128 (27) class A ranges that were available. Each of these assigned ranges could use the other 24 bits of the address and use them to assign to network hosts; this provided up to 16,777,216 (224) host addresses.
- Class BAll address within this range begin with a binary ‘10’ in the first octet, which results in addresses from 126.96.36.199 through 188.8.131.52. With the class B address space, the other 6 bits of the first octet and the whole second octet are used to separate the space into different networks; this allowed for a total of 16,384 (214) class B ranges that were available. Each of these assigned ranges could use the other 16 bits of the address and use them to assign to network hosts; this provided up to 65,636 (216) host addresses.
- Class CAll addresses within this range begin with a binary ‘110’ in the first octet, which results in addresses from 192.0.0.0 through 184.108.40.206. With the class C address space, the other 5 bits of the first octet and the whole second and third octets are used to separate the space into different networks; this allowed for a total of 2,097,152 (221) class C ranges that were available. Each of these assigned ranges could use the other 8 bits of the address and use them to assign to network hosts, this provided up to 256 (28) host addresses.
- Class DAll addresses with this range begin with a binary ‘1110’ in the first octet, which results in addresses from 220.127.116.11 through 18.104.22.168.0. Unlike the previous classes of addresses, the class D range is used for multicast and does not have network and host bits defined.
- Class EAll addresses with this range begin with a binary ‘1111’ in the first octet which results in addresses from 240.0.0.0 through 255.255.255.255. This range is reserved and is not used for network or host assignment.
Figure 1 Class A Range (/8)
Figure 2 Class B Range (/16)
Figure 3 Class C Range (/24)
Figure 4 Class D Range
Figure 5 Class E Range
CIDR and VLSM
This solution worked fine when the size of the Internet was rather small. However, once the size of the networks started to grow and the number of organizations and devices increased, it became clear that using only this mechanism the number of addresses would be exhausted quickly. Two different solutions were developed, Classless Inter-Domain Routing (CIDRRFC 1518, 1519) and Variable Length Subnet Masking (VLSMRFC 950). The CIDR standard developed a method of combining multiple classful networks to limit the size of the Internet routing tables. CIDR notation included a ‘/’ with a number following it that indicated the number of grouped non-host bits also refer to as the network prefix. For example, a classful class A address uses a total of 8 bits that are reserved, including the initial ‘0’ and the 7 bits for the network, this is noted in CIDR as /8. A classful class B address uses a total of 16 bits and is notated as /16 and so on. CIDR is not limited to only notating on a classful boundary, it can notate at any boundary from 0 through 32.
The next thing to discuss is why this is important to Internet routers. As the number of A and B class addresses were depleted, it became obvious that many organizations would need to have multiple blocks of addresses. To maintain an efficient routing table it was easier to assign these blocks consecutively, for example 22.214.171.124/16 and 126.96.36.199/16. Without CIDR it was necessary for there to be two separate routing entries for these networks. When these networks are looked at in binary it can be seen that the difference between the network bits is a single digit as shown in Figure 6:
With CIDR, instead of being represented in the routing table as 188.8.131.52/16 and 184.108.40.206/16, it could be combined to be 220.127.116.11/15; this is what is referred to as a supernet.
VLSM was defined to provide the ability to divide classful networks into smaller pieces. Using the classful model, addresses would have to be assigned in 256, 65,636 and 16,777,216 sized blocks; this is not an efficient method of address assignment or network routing. Just imagine if all of the devices in a class A network had to listen to all of the traffic from each of the other 16,777,215 devices; the network would never function. VLSM provided the ability to separate an assigned address space based on the requirements of the specific situation. For example, if a large organization was assigned a class A network, they had the ability to separate that network (via VLSM) into smaller blocks that they would assign to different divisions, locations and departments. A much more detailed description of this process will be discussed in “Advanced IPv4 Subnet Concepts and Examples.”
The concept of subnetting scares many new people entering into the network world, especially those who have issues with math. Keep in mind that the concepts can be learned by anyone and just need to be properly understood to be a good networking engineer. Take the time to understand the basics before moving forward, once this is complete the more advanced ideas can be picked up quicker and will continue to become easier to learn.