|What is subnetting?
Well, subnetting is basically just splitting an existing network into small, more manageable networks. It is done by using simple bit borrowing from the host part of the IP address, which is explained later.
Why do we need to subnet?
To avoid huge data overhead on networks, and to increase network efficiency.
Tell me more!
Well, a standard IP address looks like x.x.x.x where x is a variable number ranging from 1-254, It is better understood when broken down into binary. The IP address 126.96.36.199 would convert to 00000001.00000001.00000001.00000001 in binary. Now, the determinination of destination of data is based on the network and host address.
Before we talk about network and host addresses we can look at the above as 4 octets of binary, this is an explanation of the terminology used later. There are three types of network types used in IPV4 (current implementation of IP, further tutorials on IPV6 will be written soon), these networks are class A, class B, and class C. A class A network is any network where the first bit of the first octet is a 0, a class B network is any network where the first two bits in the octet are 10, and a class C network is any network where the first three bits in the octet are 110. There is too much to go into for why there is this addressing scheme, and beyond the scope of this small tutorial. So we now have an understanding of the different classes of network, and how to define them. Let's get on with subnetting. We will use a class B network as the example for the subnetting used in this tutorial, but the same theory applies to all classes of network, though, if you have any questions, just post them in the forum. So let's have a look at a simple class B network.
188.8.131.52 – This is an IP address of a class B network.
10011100.00000001.00000000.00000000 – This is the binary notation of the IP address.
The network address of a class B network is the first 16 bits (first two octets), then the remaining 16 bits (last two octets) are for the host address. For class A networks the first 8 bits are used for the host address, and for class C networks the first 24 bits are used for the host address.
So we can see that 10011100.00000001 is the network address, and 00000001.00000001 is the host address. This is where subnetting comes in, which simply put is borrowing bits from the host address to increase the number of networks. Let's say we want to borrow 5 bits from the host address two increase the number of networks, we end up with 10011100.00000001.00000 as the network address and 001.00000001 as the host address. A word of warning at this point, well advice really; try and keep everything in binary, it is much easier to understand. Leave the conversion to decimal right to the end. So we now have 16+5 bits for the address which means we have 11 bits for the host address. This borrowing to create more networks is called subnetting. Let's take a look at the host ranges for the subnets we have created.
We have borrowed 5 bits, leaving us with 3 bits for the ranges of hosts in each subnet. So converted to decimal (because I'm nice like that) we have : -
184.108.40.206 – 220.127.116.11 – This is the first ranges of usable host addresses in the subnets we have just created.
18.104.22.168 – 22.214.171.124 – This is the second set of usable host address in the subnets.
OK, we have created our subnet, gotten the ranges of usable IP address, but how do we tell the machine about our new addressing system?
We use what's called an extended network prefix, also known as the subnet mask. This is found by converting one of our subnet addresses into binary (we'll use 126.96.36.199)
which looks like this:
10011100.00000001.00000000.00000000 -Now we must convert all of the network bits to one which look like this:
11111111.11111111.11111000.00000000 -Now we turn all of the hosts bits to zero (already done), now we convert this back into decimal.
255.255.248.0 – And this is our subnet mask for the subnets we have just created.
We have now created a subnet from a class B address and created the mask for it, and also found the working host ranges. I know it seems difficult at first, but it does get easier. Just keep playing around. The nature of computers is calculated experimentation, so go out and give it a go.
If you have any questions or comments post them on the forum, and I will try my best to answer them, time allowing of course.
This article was originally written by sliptop