Everything you want to know about IP Subnetting in 8 easy Steps
Almost every techie (coder, a database administrator or the CTO) needs to Understand IP subnetting as a fundamental requirement for performing his job efficiently. Although, the concepts are very simple but quite often people face a general difficulty in understanding this technical topic.
This topic will be broken into eight simple steps to help you easily understand IP subnetting.
You will be able to understand following things after going through these 8 steps:
- How IP addresses are broken down.
- how to configure a router.
- how subnetting works.
- how to plan a basic small office or home network.
A basic understanding about binary and decimal numbers is required. Additionally, go through following definitions and terms to get started:
- IP Address: It is a unique logical numeric address that is assigned to every computer, router, printer, switch, or any other electronic device that is going to be a part of a TCP/IP-based network
- Subnet: It is a distinct and distinguishable portion of an organization's network. It is typically assigned on floor, building or a particular geographical location basis.
- Subnet Mask: It is a 32-bit number used to discriminate the network of an IP address. IP address is divided into a network address and host address.
- Network Interface Card (NIC): It is a computer hardware module through which a computer is connected to a network.
Step 1 - Why We Need Subnets
To understand why we need subnets (short for subnetwork), we have to start right from the start and identify that we want to communicate with "different components" on networks. Users need to communicate with printers, email programs are supposed to communicate to servers, and for this communication each of these "components" needs some unique address. This is just like a home address. There is a one minor exception that the addresses must be in numerical form. No device with alphabetical characters in its address like "33rd Street" can be connected on a network. It can be assigned an alphanumeric name - and we could translate that name to a numeric address - but the address must only contain numerical characters.
These numbers are named as IP addresses, and they have the important function of figuring out not only the address of "components," but how they can communicate with each other. Having IP address is not the only requirement. It is essential to define the way to send a message from one address to another.
It is often required to set things on a network together for both administrative and proficiency's sake. For example, if you have several printers in your organization's sales offices and a different lot in the production department. You will definitely want to limit the printers that each user of each department sees. This could be accomplished by organizing the addresses of the printers into unique subnets.
A subnet can be defined as a logical organization of different devices connected on a network.
Each device on a subnet has an address that logically links it with the other devices on the same subnet. This restricts devices on one subnet from getting confused with hosts on the other subnet.
In terms of subnets and IP addressing, these devices are called "hosts". So, in our example, there is a network (the organization), which is divided into logical subnets (sales and production departments), each of which has its own hosts (printers and users).
Step 2 - Understanding Binary Numbers
Binary numbers can be used as an alternative to decimal numbers. The concept can be learnt easily as one plus one. But many people with different shades of arithmophobia (the illogical fear of arithmetic and numbers) feel pangs of fear through when talk about "binary numbers". Put your fear to rest for a short period of time.
Decimal numbering system is used by us in our everyday lives, where our numbers are based on 10s of things - perhaps because we have 10 fingers and 10 toes. All the decimal system has different symbols to represent different quantities. Straight vertical line is called a "1" and the round circle a "0".
That does not change with binary numbering systems.
With the decimal system, we can represent larger and larger numbers by attaching numbers together. It consists of different digit numbers:
- Single-digit numbers, like 9
- Double-digit numbers, like 11,
- Triple-digit numbers, like 205, and so on.
A progressively greater value is represented by each digit as numbers get larger. There is a 1's place, a 10's place, a 100's place a 1000's place and so on.
With this number, 1's place is occupied by 5, 10's place by a 0 and 100's place by a 1. Henceforth,
1 x 100 + 0 x 10 + 5 x 1 = 105
Binary numbering system is based on the same idea except that because there are only two numbers in the binary system, 0 and 1, a lot more groupings are required to represent the same number. For example, 01101001 is the binary equivalent of 105 (actually, it is usually written as 1101001 because we drop leading zeros just like in the decimal numbering system. However, in order to explain the next concept, we'll keep that first zero in place).
Once again, as binary number gets larger, a progressively greater value is represented by each digit. The binary system has a 1's place, a 2's place, a 4's place, 8's place, a 16's place, a 32's place, a 64's place and so on.
0 x 128 + 1 x 64 + 1 x 32 + 0 x 16 + 1 x 8 + 0 x 4 + 0 x 2 + 1 x 1 = 105
Step 3 - IP Addresses
The "IP" in IP addresses stands for the Internet Protocol. Protocol is usually defined as "rules of communication". Imagine, you are using a two-way radio in a police van. You would probably use "over" to indicate the end of a particular part of the conversation and "over and out" when you are finished the whole conversation. These can be described as rules of talking over a two-way radio. These rules are the protocol of a two-way radio communication.
So, IP addressing is a part of the rules for conversations over the Internet. But it has become so popular that it is used on almost any network connected to the Internet. It means that IP addressing is related to most networks as well as the Internet.
So, what is an IP address? Precisely, it is the means whereby a component on a network can be addressed. It is constituted solely of numbers, conventionally arranged in the particular form of XXX.XXX.XXX.XXX. It is referred to as dotted decimal format.
Any one part between the dots can be between 0 and 255, so example IP addresses include:
We can write these decimal numbers in binary form by taking each of the decimal value separated by dots and converting to binary number. So, a number like 188.8.131.52 could be written as:
Each of these binary components is called octet, but this term is not used in sub netting more commonly. It is only found in books and classrooms, so know what it is (and then forget about it).
Why is each dotted decimal part limited from 0 to 255? Maximum length of IP addresses is limited to 32 bits and maximum 256 combinations of binary numbers are possible in an octet (mathematically calculated as 28). Hence, 255.255.255.255 is the largest IP address one could assign, given that any one octet could be from 0 to 255.
There is one more significant aspect of an IP address that is important to understand - the concept of a class.
Each IP address belongs to a different class of IP addresses. It depends on the number in the first octet. These classes are:
Have you Noticed that the number 127 is missing? That's because it is used as a loopback address. Think of this as an address that says, "this is my address." Only the first three classes - A, B and C - are commonly used by network administrators and the other two classes, D and E, are reserved.
The class of an IP address is defined by looking at its first octet value, but for any one class the structure of an IP address is different. Each IP address consists of a network address and a host address. For any one network, the network part of the address is the common address, while the host address part is unique for each individual component on that network. So, if your phone number is 911-615-1534, the area code (911) would be the common, or network, component of the telephone system, while your individual phone number of (615-1534) would be your host address.
Following are the class wise network and host components of IP addresses.
4 - Subnetting and the Subnet Mask
You create logical divisions of the network of a network. Therefore, Subnetting involves dividing the network into smaller portions called subnets. Subnetting is done by borrowing bits from the host portion of the IP address. In other words, the IP address then has three components - the network part, the subnet part and, finally, the host part.
A subnet is created logically by grabbing the last bit from the network component of the address. It is used to determine the number of subnets required. A typical Class C address has 24 bits for the network address and eight for the host, but we borrow the left-most bit of the host address and declare it as classifying the subnet.
We can only have two possible subnets by borrowing a single bit. As binary numbers include only two digits so, if the bit is a 0, then that will be one subnet; if the bit is a 1, that would be the second subnet. Of course, by the same token, that also reduces the number of hosts we can have on the network to 127 (but actually 125 usable addresses given all zeros and all ones are not recommended addresses), down from 255.
So only with subnet mask you can tell how many bits should be borrowed, or, in other words, how many subnets we want to have on our network?
Subnet masks sound a lot frightening than the reality. All that a subnet mask does is to indicate the number bits "borrowed" from the host component of an IP address. This concept is the foundation of all subnetting. Remember this concept If you don't know anything about subnetting.
As indicated by its name it exactly masks out the host bits which are borrowed from the host address portion of the IP address.
For example, there is a subnet mask for a Class C address. The subnet mask is 255.255.255.192 which indicates the bits of the host part of the address used to determine the subnet number, when translated into bits.
Of course, more bits borrowed means fewer hosts on the network. Sometimes, all the combinations and arrangements can be puzzling, so here are some tables of subnet possibilities.
Class C Host/ Subnet Table
Class C Bits Subnet Mask Effective Hosts Effective Subnets Number of Subnet Mask bits
1 255.255.255.128 126 2 /25
2 255.255.255.192 62 4 /26
3 255.255.255.224 30 8 /27
4 255.255.255.240 14 16 /28
5 255.255.255.248 6 32 /29
6 255.255.255.252 2 64 /30
7 255.255.255.254 2 128 /31
Note that this combination of IP addresses and subnet masks in the chart is written as two separate values, such as Network Address = 184.108.40.206, Mask = 255.255.255.192.
Step 5 - Public Vs. Private IP Addresses
Theoretically, there would be about 4,228,250,625IP addresses for use, if all the possible combinations of IP addresses were available. We would have to include all public IP addresses and private IP addresses. By definition, it would then mean, there would be only public IP addresses.
However, all IP addresses are not available. Some of them have special uses. For example, any IP address with 255 at the end is used as a special broadcast address.
Following are the other addresses used for special signaling, including:
- Limited broadcasts routed to every host limited to the local subnet
- (127.0.0.1) is loopback address. It is used when a host is referring to itself
- Multicast routing mechanisms
- Broadcasts are initially routed to a specific subnet, and then to all hosts on that subnet
The notion of a private address is like that of a private extension in an office phone system. If someone wants to call some body in an organization would dial the organization's public phone number, through which all personnel can be reached. Once the connection has been established, he would enter the extension number of the person to whom he wanted to speak. Private IP addresses are related to IP addresses just like extension numbers are related to phone systems.
Network administrators can extend the size of their networks by using private IP addresses. There may be a network with one public IP address that sees all traffic on the Internet, and hundreds - or even thousands of hosts having private IP addresses on the organization's subnet.
A private IP address can be used by anyone on the understanding that all traffic using these addresses must remain local. It would not be possible, for example, it will not be possible to have an email message related to a private IP address to move across the Internet, but it is quite practical to have the same private IP address work well in the organization's network.
From the following table, you can assign private IP addresses for a private network.
From To Class Number of Addresses
10.0.0.1 10.255.255.255 A A single Class A network address
172.16.0.1 172.31.255.254 B 16 connecting Class B network addresses
192.168.0.1 192.168.255.254 C Up to 216 Class C network addresses
Step 6 - CIDR IP Addressing
After spending so much time learning about IP addresses and classes, you might be surprised that actually these are not used anymore. Its sole purpose is other none other than to understand the basic concepts of IP addressing.
Instead, Classless Internet Domain Routing (CIDR), pronounced "cider" is used by network administrators to represent IP addresses. The concept behind CIDR is to adapt the idea of subnetting to the whole Internet. Classless addressing, In short, means that instead of dividing a specific network into subnets, networks can be combined to get larger supernets.
Therefore, CIDR is often denoted as supernetting, where larger networks are treated under the rules of subnetting. The mask is attached to the network address in the form of bits used to write CIDR in a network/mask format. For example, it is written as 220.127.116.11/34. The use of the network prefix (the /34 of 18.104.22.168/34) is the most important thing to understand about the CIDR method of subnetting, rather than determine the dividing point between the network number and the host number by using the first three bits of the IP address.
Step 7 - Variable Length Subnet Masking
When more than one subnet masks are assigned to an IP network, it is said to a have a variable length subnet mask (VLSM). The concept of (VLSM) is very simple: you can break any one subnet down into more subnets by indicating the proper VLSM.
Formerly, RIP 1 routing protocol and the IP addressing scheme did not take into attention the ability to have multiple subnet masks on one network. RIP 1 router has no idea of the VLSM, when it receives a packet destined for a subnet that has been used to generate the packet address. It just has an address to work. It has no knowledge of what CIDR prefix was originally applied. Therefore, no knowledge of how many bits are used for the host address and how many are for the network address.
Step 8 - IPv6 to the Rescue
Apparently, the 32-bit IP address has a limited number of addresses. The burst of interconnectivity has proved the shortage of IPv4 addresses. IPv6 addressing scheme is the solution for future growth. It eliminates the need for CIDR and the network mask as used in IPv4.
Size of IP address is increased from 32 bits to 128 bits in IPv6 addressing. Possible number of IP addresses is increased to 340,282,366,920,938,463,463,374,607,431,768,211,456.
Even IPv6 has a different text representation from that of IPv4, even if it has a similar-looking dotted decimal look. An IPv6 address will be see written in one of following ways:
Preferred IPv6 Addressing Notation
In preferred form hexadecimal values are used to refer to the 128-bit numbers in each address segment. Each address segment is separated by a colon. It is written like X:X:X:X:X:X:X:X, where each X comprises of four 16-bit values.
Mixed IPv6 Addressing
In environments using both IPv4 and IPv6 addresses the mixed addressing notation is useful. A mixed address would look like X:X:X:X:X:X:X:X:D:D:D:D, where the hexadecimal values of the six highest-order 16-bit components of an IPv6 address are represented by "X" and IPv4 value is represented by "D".
Compressed IPv6 Addressing Notation
In compressed form, zero strings are simply substituted with double colons to indicate the zeros are "compressed".
Here are the main points what we've learned:
- Each component on a network needs a unique address to communicate.
- Binary numbers are not much very confusing. We feel difficulty just because we use the base10 numbering system in our daily lives.
- A subnet is a logical organization of connected network devices. It is logical groupings of devices.
- We write IP addresses in the form of XXX.XXX.XXX.XXX, where first octet defines the class of each IP address.
- Subnet mask only indicates the number of bits being "borrowed" from the host component of an IP address.
- All of the IP addresses cannot be used. Some have special purposes.
- Public telephone numbers versus private extensions is a perfect example of Public versus private Ips.
- The IP address has three components (the network part, the subnet part and the host part).
- Supernetting is carried out through CIDR to acclimate the idea of subnetting to the entire Internet.
- You can break any one subnet down into more subnets by indicating the proper VLSM.
- Future lies in IPv6. It increases the number of available IP addresses as well as abolishes the requirement for CIDR and network masks.
- Preferred, compressed and mixed are three ways to write an IPv6 address.
Hopefully, the article shed some light on the subject of subnetting. If there is any further questions, please write down a line.