Understanding Subnetting

In a typical office we may have Sales, Warehousing, Accounting, Administration, and others.
We may not want everyone on the same network.
To manage our network we may want to further sub-divide our network. 

Subnetting allows you to create multiple logical networks that exist within a single Class A, B, or C network. If you do not subnet, you are only able to use one network from your Class A, B, or C network, which is unrealistic.


Now before discussion about subnetting I want to explain Network Mask which is going to be used for subnetting.

Network Masks

A network mask helps you know which portion of the address identifies the network and which portion of the address identifies the host. Class A, B, and C networks have default masks, also known as natural masks, as shown here:

Class A: 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0
 
An IP address on a Class A network that has not been subnetted would have an address/mask pair similar to: 8.20.15.1 255.0.0.0. To see how the mask helps you identify the network and host parts of the address, convert the address and mask to binary numbers.

8.20.15.1 = 00001000.00010100.00001111.00000001
255.0.0.0 = 11111111.00000000.00000000.00000000
 
Once you have the address and the mask represented in binary, then identifying the network and host ID is easier. Any address bits which have corresponding mask bits set to 1 represent the network ID. Any address bits that have corresponding mask bits set to 0 represent the host ID.

8.20.15.1 = 00001000.00010100.00001111.00000001
255.0.0.0 = 11111111.00000000.00000000.00000000
            -----------------------------------
            network ID |      host ID            

network ID =  00001000 = 8
host ID = 00010100.00001111.00000001 = 20.15.1

How to create a sub network :
In order to subnet a network, extend the natural mask using some of the bits from the host ID portion of the address to create a subnetwork ID. We can use the following technique to create manageable sub-networks.

We can borrow bits from the host area and create subnets.
We borrow from the left side of the host bits first (Class C address shown)

                                                   (Host bits field)
EX;                  192 . 101 . 114 . 00000000              (last octet is in binary form)
 

Borrow 3 bits     -       So 2 raised to 3rd (23) is 8 possible subnet address combinations

The binary would look like this:                         My 8 subnet addresses would be:
 
000 00000                   .0                                             192.101.114.0
 001 00000                   .32                                            192.101.114.32
 010 00000                   .64                                            192.101.114.64
 011 00000                   .96                                             192.101.114.96
 100 00000                   .128                                          192.101.114.128
 101 00000                   .160                                          192.101.114.160
 110 00000                   .192                                          192.101.114.192
 111 00000                    .224                                          192.101.114.224

The remaining 5 digits in each subnet are possible host positions.    (25)
So 2 to the 5th is 32 potential hosts.  In the first potential subnet they would look like this.
000 00000
000 00001
000 00010
000 00011
000 00100
000 00101
    on to
000 11111

NOTE: The second potential subnet would look just like the first subnet but the first three digits in the octet would be 001 instead of 000.

Now in the original network 192.101.114.0 (without subnetting) we couldn’t use the .0 or the .255 positions as hosts.  That is because the .0 is the network ID and the .255 is the broadcast number for everyone in that IP network. 
            So we have 256 - 2 = 254 actual host positions left.

            In each of the other subnets, the first number is the subnet ID and the last number is it’s own broadcast number.  So we use two of the 32 possible host positions in each subnet.    (32 hosts – 2 = 30 usable hosts)

            We had a total potential of 256-2=254 hosts.  After borrowing 3 bits to subnet, we have only:   8 subnets X (32-2) 30 hosts = 240 actual host positions.

Subnet Calculator :



Lets have another example for clear view:

Given a Class C network of 204.17.5.0 which has a natural mask of 255.255.255.0, you can create subnets in this manner:

204.17.5.0 -      11001100.00010001.00000101.00000000
255.255.255.224 - 11111111.11111111.11111111.11100000
                                           --------------------------------|sub|----
By extending the mask to be 255.255.255.224, you have taken three bits (indicated by "sub") from the original host portion of the address and used them to make subnets. With these three bits, it is possible to create eight subnets. With the remaining five host ID bits, each subnet can have up to 32 host addresses, 30 of which can actually be assigned to a device since host ids of all zeros or all ones are not allowed (it is very important to remember this). So, with this in mind, these subnets have been created.

204.17.5.0 255.255.255.224     host address range 1 to 30
204.17.5.32 255.255.255.224    host address range 33 to 62
204.17.5.64 255.255.255.224    host address range 65 to 94
204.17.5.96 255.255.255.224    host address range 97 to 126
204.17.5.128 255.255.255.224   host address range 129 to 158
204.17.5.160 255.255.255.224   host address range 161 to 190
204.17.5.192 255.255.255.224   host address range 193 to 222
204.17.5.224 255.255.255.224   host address range 225 to 254

The network subnetting scheme in this section allows for eight subnets, and the network might appear as:


Notice that each of the routers in above Figure is attached to four subnetworks, one subnetwork is common to both routers. Also, each router has an IP address for each subnetwork to which it is attached. Each subnetwork could potentially support up to 30 host addresses.

This brings up an interesting point. The more host bits you use for a subnet mask, the more subnets you have available. However, the more subnets available, the less host addresses available per subnet. For example, a Class C network of 204.17.5.0 and a mask of 255.255.255.224 (/27) allows you to have eight subnets, each with 32 host addresses (30 of which could be assigned to devices). If you use a mask of 255.255.255.240 (/28), the break down is:

204.17.5.0 -      11001100.00010001.00000101.00000000
255.255.255.240 - 11111111.11111111.11111111.11110000
                                            ---------------------------------|sub |---
Since you now have four bits to make subnets with, you only have four bits left for host addresses. So in this case you can have up to 16 subnets, each of which can have up to 16 host addresses (14 of which can be assigned to devices).

Take a look at how a Class B network might be subnetted. If you have network 172.16.0.0 ,then you know that its natural mask is 255.255.0.0 or 172.16.0.0/16. Extending the mask to anything beyond 255.255.0.0 means you are subnetting. You can quickly see that you have the ability to create a lot more subnets than with the Class C network. If you use a mask of 255.255.248.0 (/21), how many subnets and hosts per subnet does this allow for?

172.16.0.0  -   10101100.00010000.00000000.00000000
255.255.248.0 - 11111111.11111111.11111000.00000000
                                --------------------------| sub |-----------
You are using five bits from the original host bits for subnets. This allows you to have 32 subnets (25). After using the five bits for subnetting, you are left with 11 bits for host addresses. This allows each subnet so have 2048 host addresses (211), 2046 of which could be assigned to devices. 

How to determine the subnet for the given IP Address/Mask

Example-1

Now that you have an understanding of subnetting, put this knowledge to use. In this example, you are given two address / mask combinations, written with the prefix/length notation, which have been assigned to two devices. Your task is to determine if these devices are on the same subnet or different subnets. You can do this by using the address and mask of each device to determine to which subnet each address belongs.

DeviceA: 172.16.17.30/20
DeviceB: 172.16.28.15/20
Determining the Subnet for DeviceA:

172.16.17.30  -   10101100.00010000.00010001.00011110
255.255.240.0 -   11111111.11111111.11110000.00000000
                           -----------------------------| sub|------------
subnet =          10101100.00010000.00010000.00000000 = 172.16.16.0
Looking at the address bits that have a corresponding mask bit set to one, and setting all the other address bits to zero (this is equivalent to performing a logical "AND" between the mask and address), shows you to which subnet this address belongs. In this case, DeviceA belongs to subnet 172.16.16.0.

Determining the Subnet for DeviceB:

172.16.28.15  -   10101100.00010000.00011100.00001111
255.255.240.0 -   11111111.11111111.11110000.00000000
                                     -----------------------| sub|------------
subnet =          10101100.00010000.00010000.00000000 = 172.16.16.0
From these determinations, DeviceA and DeviceB have addresses that are part of the same subnet.

No comments:

Post a Comment