Monday, May 9, 2016

IPv4 Subnetting Tutorial

Greetings, and welcome to Seeseenayy.
Due to subnetting being a conundrum for our classmates, I feel that a tutorial is needed for both them and anyone else who visits this. Noah has a better footing with subnetting, so he'll be the author of this tutorial.




For credit purposes, this tutorial is based off multiple websites below, click the link to view them:
 [1], [2], [3], [4], [5], [6]
---
*DISCLAIMER*
This tutorial assumes you already know the basics of base 2 (0s and 1s) and base 2 arithmetic. 
---

Hello, everyone.
In order to understand how to subnet, or divide, an IPv4 Address, you must first understand why you need to subnet in the first place. Simply put, subnetting allows you to utilize your private address space more efficiently, using sub-networks (hence the term 'subnetting') to limit the total number of unused host addresses within a network. Say, for example, you have three different networks within your main office space: Marketing, Manufacturing, and HR. If Marketing needs 84 IP addresses, Manufacturing needs 30 IP addresses, and HR needs only 12 IP addresses and we use the default Class C subnet (/24), which has 256 addresses each subnetwork, you can see how many addresses are wasted using three /24 subnetworks within our main network. Subnetting specifically for the needs of the network is imperative to reduce IP address waste.


I. The Fundamentals

There are two main ways to subnet, the easier of which I use regularly; however, I will cover both in this tutorial. The subnet that you are probably most familiar with is probably the /24 subnet, or the 255.255.255.0 subnet mask. So let's analyze what that means:


11111111.11111111.11111111.00000000

Above is /24 expanded into binary (we will cover 'slash' notation, or CIDR notation, more in depth later in the tutorial). As you can see, each 'section' in the binary is broken up into four sets of 8 bits, formally known as octets, for a total of 32 bits. A full octet will have 256 possible values (28) ranging from 0-255. The underlined portion represents the bits used for networking. Where a 1 is represents that the bit is currently being used for network reservation. In this case, there are twenty-four 1s, which means that out of the total 32 bits in an IPv4 address 24 of them are being used for networking. In terms of subnetting, the networking bits do not mean much; however, keep the number of bits on hand because it will be important for other steps.

11111111.11111111.11111111.00000000

Now lets look at this underlined portion. What you are looking at represents the bits used for host addressing. In this case, a 0 represents a bit that is available for hosts. I like to think of 0s as 'open' bits. In the case of a /24 subnet mask, 8 bits are used for addressing. (Do you see a pattern? 32 total bits - 24 network bits = 8 host bits). So what does this exactly mean? This means that there are 28 total host addresses that can be used within this subnet mask. However, there is some terminology that is important to cover to reduce confusion later:

1. Host Addresses - The number gained from taking 2 to the power of the total number of host bits. This number includes BOTH usable host addresses, network and broadcast addresses.
2. Network Address - Consider this the stating number of the subnetwork and starting point for IP addresses within that subnetwork. This cannot be used as an IP address for a host, like a PC or a server. It is merely an identifier for your network.
3. Broadcast Address - If the network address signifies the beginning of a network, the broadcast address signifies the very last IP address of that subnetwork. The broadcast address, as the name implies, can also be pinged to send a broadcast packet to every device within that subnet. This, also, cannot be used as an IP address for a host
4. Usable Host Address - These addresses can be used and assigned to different hosts. It is merely the # of Host Addresses subtracted by 2 addresses, the two of the addresses being both the Network and Broadcast address.

To address the /24 subnet mask again, we have already established that the total number of host addresses is 256. If our IP address network address is 192.168.0.0, we can determine the different parts of the network. To determine the broadcast address and range of usable host addresses for this network, we need to find the SECOND network address. The simplest way to do this is add the total # of host addresses to the network address. If we add 256 to 192.168.0.0, we get 192.168.0.256. Since the maximum value of an octet is 255, we can transfer the overflow value to the next octet, so the next network address of the second subnet will be 192.168.1.0. The broadcast address is simply 1 subtracted from the second subnet, which in this case will be 192.168.0.255. All of this can be summarized simply in a chart:

Network AddressFirst Usable AddressLast Usable AddressBroadcast Address
Subnet Number-> Add 1 -><- Subtract 1 <-
1192.168.0.0192.168.0.1192.168.0.254192.168.0.255
2192.168.1.0xxx

As you can see, once you figure out the network address and subnet mask of a subnet, finding the other addresses are simple. 


II. Application

Networking is easy if you are given the subnet mask; however, what do you do if you need to determine the appropriate subnet mask for the subnetwork? It's quite simple, and follows closely with what you did in part 1. Here's a sample question:
A company needs a network that will be able to satisfy 90 and 45 hosts, respectively. List the two subnetworks that will satisfy this requirement, with a starting network of 192.168.0.0.

Always begin your network from the biggest number of hosts to the smallest. This is the standard format that will be used in any assignments or packet tracers that you will be completing. After that, you will ask yourself these questions:

1. How many total hosts are needed?

2. How many bits will be used for hosts?

3. When subnetted, how many hosts will be allocated for the subnetwork? (2 to the power of host bits)

4. How many bits will be used for networking?

Let's do this one step at a time. For the 90 host network, we need to understand that unless specifically stated, this does NOT include the network and broadcast addresses, so we must account for not 90, but 92 total host addresses. In order to determine the number of bits, you must ask yourself: '2 to the power of what is equal to or greater than 92?'. After doing your calculations, you will find that 2 to the power of 7 is just enough to host 92 hosts at 128 total hosts for the subnet (27). Finally, to determine the networking bits, subtract 7 host bits from 32 total bits for a total of 25 network bits. Therefore, the network has a /25 subnet. 

If you do the same for the 45 host subnetwork, you get values like the ones in the chart below:


Subnet 1Subnet 2
Total hosts needed9247
# Host Bits76
Total # of subnet hosts12864
# Network bits32 - 7 = 2532 - 6 = 26
Subnet Mask (CIDR)/25/26
Finally, if we follow the procedure in Part I, it is not difficult to figure out the network layout:

Network AddressFirst Usable AddressLast Usable AddressBroadcast Address
Subnet Number-> Add 1 -><- Subtract 1 <-
1192.168.0.0 /25192.168.0.1192.168.0.126192.168.0.127
2192.168.0.128 /26192.168.0.129192.168.0.190192.168.0.191
3 (not used)192.168.0.192xxx

-Noah

2 comments:

  1. Replies
    1. The tutorial is not complete yet (5/10/16), but Noah (and myself) thank you for your comment. :)

      Delete

Feel free to comment if you have a question, commendation, or concern. We love to hear your feedback!

Please do not share links to external websites if it not relevant to discussion. We reserve our right to remove any content we deem advertising.