Useful Articles

25/recent/ticker-posts

Subnetting Class C

Subnetting Class C

In this article we will understand IPv4 class C subnetting. Let's begin by understanding basic definitions.

Definition of IP Address:  An IP address is a 32 bit number that logically defines a host. IP address assigned to a LAN card or a device interface can change based on network admin's requirement.

Definition of Subnet Mask: Subnet Mask is a 32 bit value that defines which portion of an IP address is network and which portion is host.

Definition of Subnetting and its requirement: Subnetting is extending the network portion and reducing the host portion. Advantage of Subnetting is that helps a network admin to efficiently use the network IPs.

Let's take example of a class C Network address 192.168.10.0/24. In this network, we will get 254 usable hosts. i.e. from 192.168.10.1/24 till 192.168.10.254/24. Last IP 192.168.10.255/24 is a broadcast address. Also note that default subnet mask of class C is /24 (or 255.255.255.0)


Subnetting Class C

 

Kindly note that subnet mask 255.255.255.0 can be written as /24.   We can write /24 in binary as  11111111.11111111.11111111.00000000. Here, number of 1s is 24 and we use this value to denote the subnet mask as /24.

Now let's learn how to do subnetting for the network 192.168.10.0/24 till 192.168.10.0/30.  We will extend the network portion from /24 to /30 and we will see that the host portion will be reduced.

Let's begin subnetting by borrowing 1 bit (Most significant bit) from host portion and use it in the network portion.  The subnet mask will become /25 (previous value was /24).


Also note that the last octet(4th octet i.e. '0' ) of network 192.168.10.0 can be written as 00000000.


While we change subnet mask from /24 to /25, the binary value of  last octet of subnet mask can be written as 10000000

While we change the most significant bit of last octet from 0 to 1, the Decimal value of subnet mask will become 255.255.255.128, because the decimal value of '10000000' is 128.

Let assume the number of bits we have made turned '1' or borrowed = N,  so here N= 1

Let assume the number of bits left zero(remaining) = H, so here H = 7.

 

Formulas to calculate number of subnets and hosts per subnet

  • Number of subnets (for /25 mask)  =  2 N  
  • Number of hosts per subnet =  (2 H)   - 2
  • Block size of each subnet =  256 - Decimal value of  new mask.

 

Subnetting Class C - Examples

 

Subnetting Class C - 192.168.10.0/25

  •     Number of subnets (for /25 mask)  =  2 N    
                    N = 1, so 2 1       =  2
                   So number of subnets (for /25 mask) = 2
                   We will also discuss about range/value/block size of these subnets in this article shortly.

  •    Number of hosts per subnet =  (2 H)   - 2  
                   H is 7, so 2 7  - 2  
                  Hosts per subnet = 128 - 2 = 126. 

  •     Block size of each subnet =  256 - 128  = 128
For /25 mask, we will get 2 subnets, each with 126 hosts.
  • 1st  Subnet  = 192.168.10.0/25
  • 2nd  Subnet = 192.168.10.128/25
  • For 1st  Subnet, 1st valid IP is 192.168.10.1/25, last valid IP is 192.168.10.126/25, and broadcast address is 192.168.10.127/25
  • For 2nd  Subnet, 1st valid IP is 192.168.10.129/25, last valid IP is 192.168.10.254/25, and broadcast address is 192.168.10.255/25


Subnetting Class C - 192.168.10.0/26

With mask /26, subnet mask will be 255.255.255.192.  Binary value of last octet is 11000000. Using this let’s proceed further.


  • Number of subnets (for /25 mask)  =  2 N    

             N = 2, because now 2 bits are borrowed from host portion,  therefore  2 2       =  4

             Number of subnets (for /25 mask) = 4


  • Number of hosts per subnet =  (2 H)   - 2     

            H is 6, because 6 zeros are left in host portion, therefore 2 6  - 2  

            Hosts per subnet = (64 -2)  = 62. 

  • Block size of each subnet =  256 - 192  = 64

For /26 mask, we will get 4 subnets, each with 62 hosts, each subnet has block size of 64.

  • 1st  Subnet = 192.168.10.0/26
  • 2nd  Subnet=192.168.10.64/26
  • 3rd  Subnet = 192.168.10.128/26
  • 4th  Subnet=192.168.10.192/26

 

  • For 1st  Subnet, 1st valid IP is 192.168.10.1/26, last valid IP is 192.168.10.62/26, and broadcast address is 192.168.10.63/26
  • For 2nd  Subnet, 1st valid IP is 192.168.10.65/25, last valid IP is 192.168.10.126/26, and  broadcast address is 192.168.10.127/26
  • For 3rd  Subnet, 1st valid IP is 192.168.10.128/26, last valid IP is 192.168.10.192/26, and broadcast address is 192.168.10.191/26
  • For 4th  Subnet, 1st valid IP is 192.168.10.193/26, last valid IP is 192.168.10.254/26, and  broadcast address is 192.168.10.255/26

We substracted 2 from host portion of each subnet because  second last IP of each subnet is (for example .127 and .255) is broadcast address and  .0 and .128 and network address.

Let's prepare subnetting chart for each option while extending the network portion from /25 till /30.

Subnetting Chart

Based on above chart, let's try to solve a subnet case study. There is a small organization which has 5 departments. Number of users per department is mentioned in the picture below. Let's try to allocate the subnets to each department based on our understanding so far.

Subnetting Class C


Main Subnet : 192.168.10.0/24. Let's divide this subnet to fulfill our requirement by allocating subnets to 5 departments based on number of their users.

  • Operations :  192.168.10.0/25
  • Marketing:  192.168.10.128/26
  • Sales :  192.168.10.192/27
  • Finance : 192.168.10.224/28
  • HR : 192.168.10.240/29
Kindly note that we cannot overlap same IP ranges to different departments. For example, below allocations will be incorrect.
  • Operations :  192.168.10.0/25
  • Marketing:  192.168.10.0/26  -- You cannot overlap the range which is already used for operations so this range will be incorrect.

Important note: In order to efficiently use IPs, we use /30 subnet mask for Point to Point links (leased line) between 2 routers.  /30 mask will give us 2 host IPs.


For Further Reading

 Subnetting Class B



Post a Comment

0 Comments