Subnetting (FLSM & VLSM)
with examples
by
Krishna Mohan
Krishna.mohan.ec@gmail.com
As IP addresses are limited, it is not advisable to waste it, weather it is private IP or public IP.
A large network can be divide into various small networks using subnetting.
Subnetting involves conversion of host bits into network bits.
Methods of Subnetting:
a) FLSM (Fixed Length Subnet Mask)
b) VLSM (Variable Length Subnet Mask)
Division of network based on requirement:
a) Based on host bits : 2^h-2>=required address where h= no. of host bits
b) Based on network bits : 2^n>=required address where n=no of network bits
Addressing format with network & host bits as
Class & format Network Bits (N) Host bits (H)
A: N.H.H.H 8 24
B: N.N.H.H 16 16
C: N.N.N.H 24 8
Calculation of Subnet mask with FLSM
Example. Calculate subnet mask using Host Bits , each having 12 hosts or nodes or devices. Also provide IP
addresses of all devices. How many subnets available. Given network id as 199.1.1
Solution:
Step I: Calculation of host bits
For h host bits, 2^ℎ-2≥requirement
Here requirement=12
Hence h=4 (as 2^4-2=16-2=14 ≥ 12
Hence host bits required is 4
Step II: Calculation of subnet mask
Given class C address, which has format N.N.N.H or
11111111.11111111.11111111.00000000 (24 network bits & 8 host bits)
From the host bit calculation h=4, hence 4 LSB bits are host bits & remaining 4 bits of are for network bits.
On rearranging 11111111.11111111.11111111.11110000 (24+4=28 total network bits & 4 host bits), which is
subnet mask for the designed network, can be given as 28/4 (network bits/host bits).
Converting into decimal, subnet mask is 255.255.255.240
Step III: Calculation of no of sub-networks
No of networks=2^(no of network bits taken from host bits)= 2^(8-4)=2^4=16 subnets
Step IV: IP Range
Given IP is 199.1.1
Range=2^4= 16 (group of 16 is one subnetwork) & each having 16 devices or nodes.
199.1.1.0, 199.1.1.1, 199.1.1.2………………………………………………………………………………199.1.1.15
199.1.1.16, 199.1.1.17………………………………………………………………………………………...199.1.1.31
199.1.1.32…………………………………………………………………………………………………………………………….
199.1.1.48…………………………………………………………………………………………………………………………….
……………………………………………………………………………………………………………………………………………….
199.1.1.240, 199.1.1.241……………………………………………………………………………………….199.1.1.255
First address of each subnet is network ID (here 199.1.1.0, 199.1.1.16…….199.1.1.240)
Last address of each subnet is broadcast ID (here 199.1.1.15, 199.1.1.31……..199.1.1.255)
Network ID & Broadcast ID cannot be assigned to any device.
IPs other than network & broadcast ID may be assigned to any device
Above IPs are for subnet mask 255.255.255.240
Total IPs available for devices are 16*16-16*2=224
What is 192.168.1.10/26
It is a class C IP address with 26 network bits. The network bits used to calculate subnet mask.
Since class C has format N.N.N.H, where N is 8 bit network octet, & H is host bits
Given 26 network bits , hence the format 11111111.11111111.11111111.11000000
Host bits can be calculated as h=32-network bits. Here h=32-26=6
Thus subnet mask is 255.255.255.192 with IP 192.168.1.10
Calculation of subnet mask using VLSM (Variable Length Subnet Mask)
Here the length of block is variable
Example: Given the no of hosts as 100, 50 20 & 6. find IP addresses & subnet mask. Using Class C (192.168.1
network)
Solution: For 100 hosts:
2^h-2>=100, hence h=7 (host bits)
Hence value is 8+8+8+(8-7)=25
Hence subnet mask is 11111111.11111111.11111111.10000000 i.e.255.255.255.128
Block size is 2^7=128 hence the range is
192.168.1.0/25 to 192.168.1.127/25 for 100 hosts
For 50 hosts:
2^h-2>=50, hence h=6 (host bits)
Hence value is 8+8+8+(8-6)=26
Hence subnet mask is 11111111.11111111.11111111.11000000 i.e.255.255.255.192
Block size is 2^6=64 hence the range is
192.168.1.128/26 to 192.168.1.191/26 for 50 hosts
Solution: For 20 hosts:
2^h-2>=20, hence h=5 (host bits)
Hence value is 8+8+8+(8-5)=27
Hence subnet mask is 11111111.11111111.11111111.11100000 i.e.255.255.255.224
Block size is 2^5=32 hence the range is
192.168.1.192/27 to 192.168.1.223/27 for 20 hosts
For 6 hosts:
2^h-2>=6, hence h=3 (host bits)
Hence value is 8+8+8+(8-3)=29
Hence subnet mask is 11111111.11111111.11111111.11111000 i.e.255.255.255.248
Block size is 2^3=8 hence the range is
192.168.1.224/29 to 192.168.1.231/29 for 6 hosts
Hence complete range:
192.168.1.0/25 to 192.168.1.127/25 for 100 hosts
192.168.1.128/26 to 192.168.1.191/26 for 50 hosts
192.168.1.192/27 to 192.168.1.223/27 for 20 hosts
192.168.1.224/29 to 192.168.1.231/29 for 6 hosts
Any doubt mail at: Krishna.mohan.ec@gmail.com

Subnetting (FLSM & VLSM) with examples

  • 1.
    Subnetting (FLSM &VLSM) with examples by Krishna Mohan Krishna.mohan.ec@gmail.com
  • 2.
    As IP addressesare limited, it is not advisable to waste it, weather it is private IP or public IP. A large network can be divide into various small networks using subnetting. Subnetting involves conversion of host bits into network bits. Methods of Subnetting: a) FLSM (Fixed Length Subnet Mask) b) VLSM (Variable Length Subnet Mask) Division of network based on requirement: a) Based on host bits : 2^h-2>=required address where h= no. of host bits b) Based on network bits : 2^n>=required address where n=no of network bits Addressing format with network & host bits as Class & format Network Bits (N) Host bits (H) A: N.H.H.H 8 24 B: N.N.H.H 16 16 C: N.N.N.H 24 8
  • 3.
    Calculation of Subnetmask with FLSM Example. Calculate subnet mask using Host Bits , each having 12 hosts or nodes or devices. Also provide IP addresses of all devices. How many subnets available. Given network id as 199.1.1 Solution: Step I: Calculation of host bits For h host bits, 2^ℎ-2≥requirement Here requirement=12 Hence h=4 (as 2^4-2=16-2=14 ≥ 12 Hence host bits required is 4 Step II: Calculation of subnet mask Given class C address, which has format N.N.N.H or 11111111.11111111.11111111.00000000 (24 network bits & 8 host bits) From the host bit calculation h=4, hence 4 LSB bits are host bits & remaining 4 bits of are for network bits. On rearranging 11111111.11111111.11111111.11110000 (24+4=28 total network bits & 4 host bits), which is subnet mask for the designed network, can be given as 28/4 (network bits/host bits). Converting into decimal, subnet mask is 255.255.255.240 Step III: Calculation of no of sub-networks No of networks=2^(no of network bits taken from host bits)= 2^(8-4)=2^4=16 subnets
  • 4.
    Step IV: IPRange Given IP is 199.1.1 Range=2^4= 16 (group of 16 is one subnetwork) & each having 16 devices or nodes. 199.1.1.0, 199.1.1.1, 199.1.1.2………………………………………………………………………………199.1.1.15 199.1.1.16, 199.1.1.17………………………………………………………………………………………...199.1.1.31 199.1.1.32……………………………………………………………………………………………………………………………. 199.1.1.48……………………………………………………………………………………………………………………………. ………………………………………………………………………………………………………………………………………………. 199.1.1.240, 199.1.1.241……………………………………………………………………………………….199.1.1.255 First address of each subnet is network ID (here 199.1.1.0, 199.1.1.16…….199.1.1.240) Last address of each subnet is broadcast ID (here 199.1.1.15, 199.1.1.31……..199.1.1.255) Network ID & Broadcast ID cannot be assigned to any device. IPs other than network & broadcast ID may be assigned to any device Above IPs are for subnet mask 255.255.255.240 Total IPs available for devices are 16*16-16*2=224
  • 5.
    What is 192.168.1.10/26 Itis a class C IP address with 26 network bits. The network bits used to calculate subnet mask. Since class C has format N.N.N.H, where N is 8 bit network octet, & H is host bits Given 26 network bits , hence the format 11111111.11111111.11111111.11000000 Host bits can be calculated as h=32-network bits. Here h=32-26=6 Thus subnet mask is 255.255.255.192 with IP 192.168.1.10
  • 6.
    Calculation of subnetmask using VLSM (Variable Length Subnet Mask) Here the length of block is variable Example: Given the no of hosts as 100, 50 20 & 6. find IP addresses & subnet mask. Using Class C (192.168.1 network) Solution: For 100 hosts: 2^h-2>=100, hence h=7 (host bits) Hence value is 8+8+8+(8-7)=25 Hence subnet mask is 11111111.11111111.11111111.10000000 i.e.255.255.255.128 Block size is 2^7=128 hence the range is 192.168.1.0/25 to 192.168.1.127/25 for 100 hosts For 50 hosts: 2^h-2>=50, hence h=6 (host bits) Hence value is 8+8+8+(8-6)=26 Hence subnet mask is 11111111.11111111.11111111.11000000 i.e.255.255.255.192 Block size is 2^6=64 hence the range is 192.168.1.128/26 to 192.168.1.191/26 for 50 hosts
  • 7.
    Solution: For 20hosts: 2^h-2>=20, hence h=5 (host bits) Hence value is 8+8+8+(8-5)=27 Hence subnet mask is 11111111.11111111.11111111.11100000 i.e.255.255.255.224 Block size is 2^5=32 hence the range is 192.168.1.192/27 to 192.168.1.223/27 for 20 hosts For 6 hosts: 2^h-2>=6, hence h=3 (host bits) Hence value is 8+8+8+(8-3)=29 Hence subnet mask is 11111111.11111111.11111111.11111000 i.e.255.255.255.248 Block size is 2^3=8 hence the range is 192.168.1.224/29 to 192.168.1.231/29 for 6 hosts Hence complete range: 192.168.1.0/25 to 192.168.1.127/25 for 100 hosts 192.168.1.128/26 to 192.168.1.191/26 for 50 hosts 192.168.1.192/27 to 192.168.1.223/27 for 20 hosts 192.168.1.224/29 to 192.168.1.231/29 for 6 hosts Any doubt mail at: Krishna.mohan.ec@gmail.com