The Basics of IP Subnetting
To understand how subnetting works, you first must have a good basic understanding of IP addresses. An IP address is set of binary octets broken into quads. That definition may not have made any sense to you, so we will try it another way. An IP address follows what is called dotted octet notation. There are four sets of numbers in an IP address, and dots are used to separate them, for example, 192.168.0.1.
Let's go a bit further into the binary octet discussion. Binary numbers are broken down by what is known as positional notation, which works from right to left in increasing place values. Here is an example:
192.168.0.1 in binary octet form would be 11000000.10101000.00000000.00000001 Binary form of 192: 1 1 0 0 0 0 0 0 = 192 128 64 32 16 8 4 2 1 (Hint: Add up the ones with the numbers below them. First one equals 128, plus the second, which is 64. Added together this equals 192.) 1 0 1 0 1 0 0 0 = 168 128 64 32 16 8 4 2 1 Binary form of 168 (Again, each 1 holds the value of the number below it.) 0 0 0 0 0 0 0 0. = 0 128 64 32 16 8 4 2 1 0 0 0 0 0 0 0 1 = 1 128 64 32 16 8 4 2 1
So, 11000000.10101000.00000000.00000001 is the binary octet breakdown of 192.168.0.1. Believe it or not, this information actually is important.
Now, let's delve into the realm of subnet masks. The subnet mask is what actually will do all of the work of subnetting (read again, subnet mask). The subnet mask of an IP address is what tells the computer or router or whatever which part of your IP address belongs to your network and which part belongs to the hosts. Thus, a subnet mask of 255.255.255.0 tells your computer that the first three quads of your IP address belong to the network, and all of your hosts will be referenced with the last quad. This gives us a standard subnet mask of 255.255.255.0, with a possibility of 254 hosts in our network.
What? Even though I failed Algebra II, my math here does make sense. You are required to have a base network address and a broadcast address for every subnet. With the standard subnet mask and the default IP address in our example, the network address is 192.168.0.0 and the broadcast address is 192.168.0.255, which leaves us 192.168.0.1-254 for our hosts.
The basics are out of the way, so let's move on to the important stuff. How we subnet an IP range depends first on how large your assigned IP range is. If you are running a private network going through one static IP address, then your range is 192.168.xxx.xxx. In this case, there really is no reason to subnet unless you want to cut down on traffic and segment your LAN for whatever reason you feel is worth undertaking this task.
To begin, assume an IP address of 184.108.40.206 as a base. This is obviously a simplified example, but it's enough to convey the point of the exercise. Broken down into dotted octet notation, 220.127.116.11 is
The first step in subnetting is planning. How many hosts do you want per mask? Is there a chance that you may be expanding any or all of these subnets in the future? These are all things that have to be taken into consideration before you get set up everything, because the number of hosts you decide upon directly effects all the following steps. Say you want to have 20 hosts available per subnet. This means that you will need a minimum of 22 hosts, (remember, network address and broadcast have to be taken into account also). Let's zoom in on the last octet of our IP address.
0 0 0 0 0 0 0 0 (Remember this from above?) 128 64 32 16 8 4 2 1
So, if we want at least 22 hosts on each of our subnets, we are going to need the last five bits in our octet quad. This will give us a total available of 16+8+4+2+1 or 31 possible hosts, 29 if you don't count the network address and broadcast address. This leaves the first three bits of the octet for network addressing. This makes our subnet mask for the entire network 255.255.255.224. How did I come up with this? The positional notation values for the first three bits of our final octet, when added together, equal 224.
Network bits Host bits | 128 64 32 | 16 8 4 2 1 | 0 0 0 0 0 0 0 0 Network address for this subnet 0 0 0 0 1 IP Range of 18.104.22.168-31 0 0 0 1 0 0 0 0 1 1 ....... and on till we get the numbers below 1 1 1 1 1 Broadcast address for this subnet 0 0 1 0 0 0 0 0 Network address for this subnet 0 0 0 0 1 IP Range of 22.214.171.124-63 0 0 0 1 0 0 0 0 1 1 ....... 1 1 1 1 1 Broadcast address for this subnet 0 1 0 0 0 0 0 0 Network address for this subnet 0 0 0 0 1 IP Range of 126.96.36.199-95 0 0 0 1 0 0 0 0 1 1 ....... 1 1 1 1 1 Broadcast address for this subnet ............. ............. 1 1 1 0 0 0 0 0 Network address for this subnet 0 0 0 0 1 IP Range of 188.8.131.52-255 0 0 0 1 0 0 0 0 1 1 ....... 1 1 1 1 1 Broadcast address for this subnet
Do you get the picture so far? Let's review. We have an IP address of 184.108.40.206. For our first subnet, we use a subnet mask of 255.255.255.224. This gives us hosts from 220.127.116.11 to 30, with 18.104.22.168 as the network address and 22.214.171.124 as the broadcast address. Our next subnet would be 126.96.36.199 with the same 31 hosts, including broadcast and network. The subnet following that would have an IP range of 188.8.131.52-95. The next would be 184.108.40.206-127, then 128-159, then 160-191, 192-223 and, finally, 224-255.
These results are a simplified example that doesn't include a lot of reasons why things happen. The following is an attempt on my part to explain how all this works. Your IP address and your subnet mask are bitwise "and"ed together (read boolean algebra). 0s hide the number, while 1s let it show through. The resulting binary number is the network address that falls out of the addition. Here's an example:
11000000.10101000.00000000.00000001 Network address (192.168.0.1) 11111111.11111111.11111111.11100000 + Subnet Mask (255.255.255.224) 11000000.10101000.00000000.00000000 Network address (192.168.0.0 in this case)
This means anything to the right of the fourth bit in the final octet is a host address. This also means that the first three bits in the final octets are the network address. So, as outlined above, our first subnet would be 192.168.0.0-31. After that we would have to set the third bit from the left in the final octet, which changes the network address and results in our second subnet. :
11000000.10101000.00000000.00100000 Network address (192.168.0.32) 11111111.11111111.11111111.11100000 + Subnet Mask (255.255.255.224) 11000000.10101000.00000000.00100000 Network address (192.168.0.32 in this case)
This breaks us down into the subnet IP range of 192.168.0.32-63. Are you catching on yet? Here is another quick example. In it, our next subnet would be what?
11000000.10101000.00000000.01000000 Network address (192.168.0.64) 11111111.11111111.11111111.11100000 + Subnet Mask (255.255.255.224) 11000000.10101000.00000000.01000000 Network address (192.168.0.64 in this case)
which leaves 192.168.0.64-95 as our subnet IP ranges.
Hope I didn't confuse you terribly, but this is the main line of thinking for subnetting a network. Feel free to contact me with any questions. I might not be able to answer them off the top of my head, but I will do my best.
|Containers—Not Virtual Machines—Are the Future Cloud||Jun 17, 2013|
|Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer||Jun 12, 2013|
|Weechat, Irssi's Little Brother||Jun 11, 2013|
|One Tail Just Isn't Enough||Jun 07, 2013|
|Introduction to MapReduce with Hadoop on Linux||Jun 05, 2013|
|Android's Limits||Jun 04, 2013|
- Containers—Not Virtual Machines—Are the Future Cloud
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Linux Systems Administrator
- Introduction to MapReduce with Hadoop on Linux
- Senior Perl Developer
- Technical Support Rep
- Weechat, Irssi's Little Brother
- UX Designer
- One Tail Just Isn't Enough
- Android's Limits
- Free is costly
51 min 34 sec ago
- Bought photoshop CS5 for developing a website :(
1 hour 7 min ago
- Reply to comment | Linux Journal
1 hour 55 min ago
- Reply to comment | Linux Journal
1 hour 56 min ago
- Replica Watches
4 hours 21 min ago
- Reply to comment | Linux Journal
8 hours 31 min ago
- on the path to understanding
8 hours 35 min ago
- As a fisher,we know that a
1 day 4 hours ago
- All I Say Is Worth Share!
1 day 5 hours ago
1 day 5 hours ago
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?