3. Subnet Mask
• A Subnet mask is a 32-bit number that masks an IP
address, and divides the IP address into network
address and host address.
• Subnet Mask is made by setting
• network bits to all "1"s
• host bits to all "0"s.
Visit www.youtube.com/GURUKULA for Lecture Videos
5. Representation of Subnet Mask
• There are 3 types of representation
• Binary Representation
• Dotted Decimal Representation
• /n Representation or CIDR Representation
(n Defines #. Of bits allotted for Network)
Visit www.youtube.com/GURUKULA for Lecture Videos
6. Default Subnet Mask
Class NID - HID Binary
Class A NID – HID – HID – HID 11111111.00000000.00000000.00000000
Class B NID – NID – HID – HID 11111111.11111111.00000000.00000000
Class C NID – NID – NID – HID 11111111.11111111.11111111.00000000
Class Dotted Decimal /n
Class A 255.0.0.0 /8
Class B 255.255.0.0 /16
Class C 255.255.255.0 /24
Visit www.youtube.com/GURUKULA for Lecture Videos
7. Need for Subnet Mask
1. Given any IP Address, Subnet mask can be used to identify
the network ID
Visit www.youtube.com/GURUKULA for Lecture Videos
8. Need for Subnet Mask
2. To inform the router that subnetting is performed
Lets go back to the Example problem
200.1.2.0
200.1.2.127
200.1.2.0 /25
200.1.2.127 /25
11111111.11111111.11111111.10000000
255 . 255 . 255 . 128
Visit www.youtube.com/GURUKULA for Lecture Videos
10. Variable Length Subnetting
•There are certain drawbacks in fixed length
methods
• All subnets will have equal number of IP Address
64 64
6464
64
64
128
This scenario is called VLSM
(Variable Length Subnet Masking)
Visit www.youtube.com/GURUKULA for Lecture Videos
11. Variable Length – Example 1
• Divide the given address space 172.16.0.0 / 16 into 7 networks
whose requirement is given below
• Net 1 → 500 hosts
• Net 2 → 200 hosts
• Net 3 → 100 hosts
• Net 4 → 60 hosts
• Net 5 → 20 hosts
• Net 6 → 2 hosts
• Net 7 → 2 hosts
Visit www.youtube.com/GURUKULA for Lecture Videos
12. 500
200
100
60
20
2
2
1. Arrange the required No. of hosts in Ascending Order
2. Allocate the No of bits required for Hosts in powers of 2
29 = 512
28 = 256
27 = 128
26 = 64
25 = 32
22 = 4
22 = 4
3. Write the given address space with required no of Host Bits
172.16.00000000.00000000
4. Count for required no of bits from right side ( ) and find the first and last address
172.16.00000001.11111111
5. Write the starting and ending address with subnet mask
172.16.0.0 / 23
172.16.1.255 / 23
6. Write the immediate next ip address for next subnet
172.16.00000010.00000000
7. Count the number of bits required for 2nd subnet
172.16.00000010.00000000
172.16.00000010.11111111
Write the first and last ip address with subnet mask
172.16.2.0 / 24
172.16.2.255 / 24
Repeat the procedure until last subnet
172.16.00000011.00000000
172.16.00000011.01111111
172.16.3.0 / 25
172.16.3.127 / 25
172.16.00000011.10000000
172.16.00000011.10111111
172.16.3.128 / 26
172.16.3.191 / 26
172.16.00000011.11000000
172.16.00000011.11011111
172.16.3.192 / 27
172.16.3.223 / 27
172.16.00000011.11100000
172.16.00000011.11100011
172.16.3.224 / 30
172.16.3.227 / 30
172.16.00000011.11100100
172.16.00000011.11100111
172.16.3.228 / 30
172.16.3.231 / 30
Visit www.youtube.com/GURUKULA for Lecture Videos
13. Variable Length – Example 2
Divide the address space 172.16.0.0 / 16 for 3
LANS as mentioned below
Lan 1 should have 50 address
Lan 2 should have 217 address
Lan 3 should have 300 address
Visit www.youtube.com/GURUKULA for Lecture Videos
14. Solution
NET #
No of Bits
Required
Address space
Address with subnet
mask
LAN 3 → 300 29 = 512
172.16.00000000.00000000 172.16.0.0 /23
172.16.00000001.11111111 172.16.1.255 /23
LAN 2 → 217 28 = 256
172.16.00000010.00000000 172.16.2.0 /24
172.16.00000010.11111111 172.16.2.255 /24
LAN 1 → 50 26 = 64
172.16.00000011.00000000 172.16.3.0 /26
172.16.00000011.00111111 172.16.3.63 /26
Visit www.youtube.com/GURUKULA for Lecture Videos
15. Mastering the Subnets Problem
Divide the address space 172.16.0.0 / 16 for 3 LANS as
mentioned below
• Lan 1 should have 50 address
• Lan 1.1 → 25 address
• Lan 1.2 → 12 address
• Lan 1.3 → 5 address
• Lan 1.4 → 5 address
• Lan 2 should have 217 address
• Lan 2.1 → 70 address
• Lan 2.2 → 30 address
• Lan 2.3 → 16 address
• Lan 2.4 → 10 address
• Lan 3 should have 300 address
• Lan 3.1 → 80 address
• Lan 3.2 → 42 address
• Lan 3.3 → 25 address
• Lan 3.4 → 15 address
• Lan 3.5 → all remaining address
Visit www.youtube.com/GURUKULA for Lecture Videos
17. Rules for CIDR Blocks
• All IP address should be Contiguous
• The size of the requested IP should be in power of 2
• Meaning – you cannot ask for 500 IP address. You can get only 512 IP
Address as a block
Taking this further will have their applications in Operating Systems
So, I will leave it to your exercise
18. References:
• Behrouz A. Forouzan, ―Data communication and Networking, Fifth
Edition, Tata McGraw – Hill, 2013
• Larry L. Peterson, Bruce S. Davie, ―Computer Networks: A Systems
Approach, Fifth Edition, Morgan Kaufmann Publishers, 2011.
• Few online References (Will be Mentioned in the description Section)
Thank You…