IP Addressing and Subnetting
Objectives
• Upon completion of this course, you will be
able to:
– Know about IP address classification and calculation
– Be familiar with Subnet and Mask
Contents
• IP Address Classification
• Subnet and IP Address Calculation
• VLSM
IPv4 Address Function
10.13.0.1 192.168.1.1
HDR SADADATA
172.17.0.1 172.17.0.2
• Uniquely and logically identifies end stations
• Packet forwarding is based on IP address
IP Address
32 bits
Network Host
Maximum 255 255 255 255
1 8 9 16 17 24 25 32
Binary 11111111111111111111111111111111
128
8
4
2
1
64
32
16
128
8
4
2
1
64
32
16
128
8
4
2
1
64
32
128
8
4
2
1
64
32
16
16
Decimal 172 16 122 204
Binary 10101100000100000111101011001100
Classification
8 bits 8 bits 8 bits 8 bits
• Class A: Network Host Host Host
• Class B: Network Network Host Host
• Class C: Network Network Network Host
• Class D: Multicast Address
• Class E: Reserved for Research
Valid Network Numbers
Bits:
1 89 16 17 2425 32
Class A: 0NNNNNNN Host Host Host
Range (1-126)
Class B: 10NNNNNN Network Host Host
Range (128-191)
Class C: 110NNNNN Network Network Host
Range (192-223)
Class D: 1110MMMMMulticast GroupMulticast GroupMulticast Group
Range (224-239)
Reserved IP Address
Network 127.0.0.0
Network 0.0.0.0
All 0 host address
All 1 host address
Host 255.255.255.255
Default Subnet Mask
Class of Size of Size of
Network Default Mask
Address Host Part
Part
A 8 2 255.0.0.0
4
B 1 1 255.255.0.0
6 6
C 24 8 255.255.255.0
Contents
• IP address classification
• Subnet and IP address calculation
• VLSM
Broadcast Domains
Each router interface connects a broadcast domain and broadcasts are only
propagated within its specific broadcast domain.
Problems with Large Broadcast Domains
• Slow network operations due to the significant amount of broadcast traffic.
• Slow device operations because a device must accept and process each
broadcast packet.
Problems with Large Broadcast Domains (cont.)
• Solution -reduce the size of the network to create smaller broadcast domains
in a process called subnetting.
• These smaller network spaces are called subnets.
Reasons for Subnetting
Network administrators can group devices and services into subnets that are determined by:
Location
Reasons for Subnetting (cont.)
Network administrators can group devices and services into subnets that are determined by:
Organizational unit.
Reasons for Subnetting (cont.)
Network administrators can group devices and services into subnets that are determined by:
Device type.
Conversion Between Binary and Decimal
1 8 9 16 17 24 25 32
11111111111111111111111111111111
128
8
4
2
1
64
32
16
Weight:
128
8
4
2
1
64
32
16
128
8
4
2
1
64
32
128
8
4
2
1
64
32
16
16
172 16 122 204
172=128+32+8+4 128+64+8+4=20
4
10101100000100000111101011001100
Boolean AND
Rules Example
0 AND 0 yields 0 0 1 1 0
0 AND 1 yields 0 0 0 1 1
1 AND 0 yields 0 Boolean AND
1 AND 1 yields 1 0 0 1 0
Addressing Without Subnets
172.19.0.0
A
172.18.0.0
B
172.16.0.0 172.17.2.0
Subnet mask: 255.255.0.0
Addressing With Subnets
172.16.3.0
A
172.16.4.0
B
172.16.1.0 172.16.2.0
Subnet mask: 255.255.255.0
Subnet Mask and Prefix
Network Host
IP
Address
172 16 0 0
Network Host
Default
Subnet
Mask 11111111 11111111 00000000 00000000
255 255 0 0
Also written as “/16” where 16 represents the number of 1s in
Network Subnet Host
the mask.
8-bit
Subnet
Mask
255 255 255 0
Also written as “/24” where 24 represents the number of 1s in
the mask.
Address Formats When Subnetting
8 24-x x
Class A: Network Subnet Host
16 16-x x
Class B: Network Subnet Host
24 8-x x
Class C: Network Subnet Host
255.255. 255 . 0
172.16 . 2 . 160
Network Subnet Host
How Many Hosts And Subnets
Process:
Step 1:The class rules define the network part.
Step 2:The mask binary 0s define the host part.
Step 3:What is left over defines the size of subnet
part
Step 4:Number of subnets=2number-of-subnet-bits
Step 5:Number of hosts per subnet =2number-of-host-bits-2
Example
Network Subnet Host
172 16 0 0
N
8
7
6
5
4
3
2
1
8
7
6
5
4
3
2
1
Subnet mask:
0000000000000000 1
255.255.255.0 0000000100000001 2
...
00000011 3
10000000
...
...
11111101 254
...
1111111011111110 255
1111111111111111 256
- 2
2N-2 = 28-2 = 254 254
Converting table
Weight: 128 64 32 16 8 4 2 1
1 0 0 0 0 0 0 0 = 128
1 1 0 0 0 0 0 0 = 192
1 1 1 0 0 0 0 0 = 224
1 1 1 1 0 0 0 0 = 240
1 1 1 1 1 0 0 0 = 248
1 1 1 1 1 1 0 0 = 252
1 1 1 1 1 1 1 0 = 254
1 1 1 1 1 1 1 1 = 255
Finding The Subnet Number
Network Subnet Host
172.16.2.160 10101100 00010000 00000010 10100000
11111111 11111111 11111111 11000000
255.255.255.192
AND result 10101100 00010000 00000010 10000000
128
192
224
240
248
252
254
255
128
192
224
240
248
252
254
255
Subnet number 172 16 2 128
Finding The Subnet Broadcast Address
Network Subnet Host
172.16.2.160 10101100 00010000 00000010 10100000
11111111 11111111 11111111 11000000
255.255.255.192
AND result 10101100 00010000 00000010 10000000
host bits set to10101100
1 00010000 00000010 10111111
Broadcast 172 16 2 191
Finding The Valid Range of IP Addresses
Network Subnet Host
172.16.2.160 10101100 00010000 00000010 10100000
11111111 11111111 11111111 11000000
255.255.255.192
AND result 10101100 00010000 00000010 10000000
First available10101100 00010000 00000010 10000001
Last available10101100 00010000 00000010 10111110
First valid 172 16 2 129
Last valid 172 16 2 190
Address Calculating Summary
164 16 2 96
164.16.2.96 10100100 00010000 00000010 01100000 Host
11111111 11111111 1111111111000000 Mask
255.255.255.192
164.16.2.64 10100100 00010000 0000001001000000 Subnet
164.16.2.127 10100100 00010000 0000001001111111 Broadcast
164.16.2.65 10100100 00010000 0000001001000001 First
164.16.2.126 10100100 00010000 0000001001111110 Last
Which Subnet Masks Meet Requirement
Subnet Host number Subnet
Class
number per Subnet mask
200 200 B ?
2N-2 2M-2 N+M=16 N=M=8
IP address Classification Exercise
Address Class Network Host
10.2.1.1
128.63.2.100
201.222.5.64
192.6.141.2
130.113.64.16
256.241.201.1
0
Subnet Mask Exercise
Address Subnet Class Subnet
Mask
172.16.2.10 255.255.255.
0
10.6.24.20 255.255.240.
0
10.30.36.12 255.255.255.
0
Broadcast Address Exercise
Address Subnet Mask Class Subnet Broadcas
t
201.222.10.60 255.255.255.2
48
15.16.193.6 255.255.248.0
128.16.32.13 255.255.255.2
52
153.50.6.27 255.255.255.1
28
Contents
• IP address classification
• Subnet and IP address calculation
• VLSM
Variable Length Subnet Mask
172.16.14.32/27 172.16.14.132/30
A
172.16.1.0/24
172.16.14.64/27
172.16.14.136/30
B
HQ
HQ
172.16.2.0/24
172.16.14.96/27
172.16.14.140/30
C
Derived from Derived from Derived from
172.16.14.0/24 172.16.14.128/27 172.16.0.0/16
VLSM Calculating
Subnetted Address: 172.16.14.0/24
In Binary 10101100. 00010000.00001110.00000000
VLSM Address: 172.16.14.0/27
In Binary 10101100. 00010000.00100000.00000000
00100000172.16.14.32/27
0100000 172.16.14.64/27
0110000
0 172.16.14.96/27
1000000
0 172.16.14.128/27
0
VLSM Subnet
VLSM Address: 172.16.14.128/27
In Binary 10101100. 00010000.00100000.10000000
00100172.16.14.132/30
01000172.16.14.136/30
01100172.16.14.140/30
10000
VLSM Subnet
Exercise 1
200.1.1.0/24 40 hosts
200.1.1.0/24 40 nets
170.50.0.0/16 1000 hosts
12.0.0.0/24 25 nets
199.9.10.0/24 12 hosts
199.9.10.0/24 14 nets
Exercise 2
Find the Subnet ID
172.16.77.8/20
10.10.0.10/13
Are the following address valid to their relevant subnet?
10.15.255.255/13
172.16.128.255/20
Exercise 3: VLSM
A
B
C
Given: 192.168.1.0/24
Net A:10 hosts Net B: 30 hosts D
Net C: 6 hosts Net D: 4 hosts
Remember the point to point connection between Routers
Use the above Network segment and do the VLSM.
Assign the IP address according to your plan.
Summary
• IP address classification
• Subnetting and calculation
• VLSM
Thank you.