Slides from TCP/IP - Forouzan
Chapter 5
Subnetting and
Supernetting
Subnetting
Masking
Examples of Subnetting
Variable-Length Subnetting
Supernetting
Forouzan Notes COSC 6377 - Fall 2000 5-1
Figure 5-1 A network with two levels of hierarchy (not subnetted)
141.14.2.105
141.14.2.21
141.14.2.20 141.14.7.96
141.14.7.95
To the rest of Network
the Internet R1
141.14.0.0
141.14.22.64
141.14.7.44
141.14.22.9 141.14.22.8
Forouzan Notes COSC 6377 - Fall 2000 5-2
Forouzan Notes COSC 6377 - Fall 2000 5-
Slides from TCP/IP - Forouzan
Figure 5-2 A network with three levels of hierarchy (subnetted)
141.14.2.21 141.14.2.105
141.14.2.20
141.14.7.96 141.14.7.45
141.14.2.0 141.14.7.44
To the rest of Subnetwork
the Internet R1 141.14.7.0
Subnetwork
Subnetwork
141.14.22.0
141.14.22.8 Site
141.14.22.9 141.14.22.64 141.14.0.0
Forouzan Notes COSC 6377 - Fall 2000 5-3
Figure 5-3 Addresses in a network with and without subnetting
141 . 14 . 2 . 21
Netid Hostid
Network access Host access
a. Without subnetting
141 . 14 . 2 . 21
Netid Subnetid Hostid
Subnetwork access Host access
b. With subnetting
Forouzan Notes COSC 6377 - Fall 2000 5-4
Forouzan Notes COSC 6377 - Fall 2000 5-
Slides from TCP/IP - Forouzan
Figure 5-4 Hierarchy concept in a telephone number
( 408 ) 864 - 8902
Area code Exchange Connection
Forouzan Notes COSC 6377 - Fall 2000 5-5
Figure 5-5 Masking
141.14.2.21
Mask 141.14.0.0
IP address 255.255.0.0 Network address
a. Without subnetting
141.14.2.21
Mask 141.14.2.0
IP address 255.255.255.0 Subnetwork address
b. With subnetting
Forouzan Notes COSC 6377 - Fall 2000 5-6
Forouzan Notes COSC 6377 - Fall 2000 5-
Slides from TCP/IP - Forouzan
Figure 5-6 Applying bit-wise and operator to achieve masking
141.14.2.21
IP 10001101 00001110 00000010 00010101
address
Mask 11111111 11111111 00000000 00000000
141.14.0.0
Network
address 10001101 00001110 00000000 00000000
a. Without subnetting
141.14.2.21
IP 10001101 00001110 00000010 00010101
address
Mask 11111111 11111111 11111111 00000000
141.14.2.0
Subnetwork
address
10001101 00001110 00000010 00000000
b. With subnetting
Forouzan Notes COSC 6377 - Fall 2000 5-7
Figure 5-7 Special addresses in subnetting
Subnetid Hostid
Any All 0s
Subnetwork address
Any All 1s
Broadcast to all hosts in a specific subnet
All 0s Any
Subnetid all 0s
All 1s Any
Subnetid all 1s
Forouzan Notes COSC 6377 - Fall 2000 5-8
Forouzan Notes COSC 6377 - Fall 2000 5-
Slides from TCP/IP - Forouzan
Figure 5-8 Masks in example 1
Mask 255.0.0.0
Netid Hostid
11111111 00000000 00000000 00000000
a. Without subnetting
Mask 255.255.192.0
Netid Subnetid Hostid
11111111 11111111 11000000 00000000
b. With subnetting
Forouzan Notes COSC 6377 - Fall 2000 5-9
Figure 5-9 Range of addresses in example 1
Special addresses Special addresses
(hostid all 0s) (hostid all 1s)
X.0.0.0 X.0.0.1 ...
Special addresses (subnetid all 0s)
X.0.63.254 X.0.63.255
1st subnet X.0.64.0 X.0.64.1 ... X.0.127.254 X.0.127.255
2nd subnet
..
X.0.128.0 X.0.128.1 ... X.0.191.254
..
X.0.191.255
1022nd subnet
.
X.255.128.0 X.255.128.1 ... .
X.255.191.254 X.255.191.255
X.255.192.0 X.255.192.1 ... X.255.255.254 X.255.255.255
Special addresses (subnetid all 1s)
Forouzan Notes COSC 6377 - Fall 2000 5-10
Forouzan Notes COSC 6377 - Fall 2000 5-
Slides from TCP/IP - Forouzan
Figure 5-10 Subnetworks in example 1
X.0.64.2 X.0.127.254
X.0.64.1
...
X.0.64.0
Subnetwork X.0.128.2 X.0.191.254
To the rest of
X.0.128.1
...
the Internet R1 X.0.128.0
Subnetwork
...
X.255.128.2 X.255.191.254
Site
X.255.128.1
...
X.255.128.0
X.0.0.0 Subnetwork
Forouzan Notes COSC 6377 - Fall 2000 5-11
Figure 5-11 Mask in example 2
Mask 255.255.0.0
Netid Hostid
11111111 11111111 00000000 00000000
a. Without subnetting
Mask 255.255.240.0
Netid Subnetid Hostid
11111111 11111111 1111 0000 00000000
b. With subnetting
Forouzan Notes COSC 6377 - Fall 2000 5-12
Forouzan Notes COSC 6377 - Fall 2000 5-
Slides from TCP/IP - Forouzan
Figure 5-12 Range of addresses in example 2
Special addresses Special addresses
(hostid all 0s) (hostid all 1s)
X.Y.0.0 X.Y.0.1 ...
Special addresses (subnetid all 0s)
X.Y.15.254 X.Y.15.255
1st subnet X.Y.16.0 X.Y.16.1 ... X.Y.31.254 X.Y.31.255
2nd subnet
..
X.Y.32.0 X.Y.32.1 ... X.Y.47.254
..
X.Y.47.255
14th subnet X.Y.224.0
. X.Y.224.1 ... X.Y.239.254 X.Y.239.255
.
X.Y.240.0 X.Y.240.1 ...
Special addresses
X.Y.255.254 X.Y.255.255
(subnetid all 1s)
Forouzan Notes COSC 6377 - Fall 2000 5-13
Figure 5-13 Subnetworks in example 2
X.Y.16.2 X.Y.31.254
X.Y.16.1
...
X.Y.16.0
Subnetwork X.Y.32.2 X.Y.47.254
To the rest of
R1
X.Y.32.1
...
the Internet X.Y.32.0
Subnetwork
...
X.Y.224.2 X.Y.239.254
Site
X.Y.224.1
...
X.Y.224.0
X.Y.0.0 Subnetwork
McGraw-Hill
Forouzan Notes
COSC 6377 - Fall 2000 The McGraw-Hill Companies, Inc., 2000
5-14
Forouzan Notes COSC 6377 - Fall 2000 5-
Slides from TCP/IP - Forouzan
Figure 5-14 Masks in example 3
Mask 255.255.255.0
Netid Hostid
11111111 11111111 11111111 00000000
a. Without subnetting
Mask 255.255.255.224
Netid Subnetid Hostid
11111111 11111111 11111111 111 00000
b. With subnetting
Forouzan Notes COSC 6377 - Fall 2000 5-15
Figure 5-15 Range of addresses in example 3
Special addresses Special addresses
hostid all 0s hostid all 1s
Special addresses
1st subnet
X.Y.Z.0 X.Y.Z.1 ...
subnetid all 0s
... X.Y.Z.30 X.Y.Z.31
2nd subnet
X.Y.Z.32
..
X.Y.Z.64
X.Y.Z.33
X.Y.Z.65 ... X.Y.Z.62
X.Y.Z.94
X.Y.Z.63
..
X.Y.Z.95
. ... .
...
6th subnet X.Y.Z.192 X.Y.Z.193 X.Y.Z.222 X.Y.Z.223
X.Y.Z.224 X.Y.Z.225 X.Y.Z.254 X.Y.Z.255
Special addresses
subnetid all 1s
Forouzan Notes COSC 6377 - Fall 2000 5-16
Forouzan Notes COSC 6377 - Fall 2000 5-
Slides from TCP/IP - Forouzan
Figure 5-16 Subnetworks in example 3
X.Y.Z.34 X.Y.Z.62
X.Y.Z.33
...
X.Y.Z.32
Subnetwork X.Y.Z.66 X.Y.Z.94
To the rest of
X.Y.Z.65
...
the Internet R1 X.Y.Z.64
Subnetwork
...
X.Y.Z.194 X.Y.Z.222
Site
X.Y.Z.193
...
X.Y.Z.192
X.Y.Z.0
Subnetwork
Forouzan Notes COSC 6377 - Fall 2000 5-17
Figure 5-17 Variable-length subnetting
Site 62 hosts
X.Y.Z.0
62 hosts
First mask
255.255.255.192
62 hosts
30 hosts
Second mask
Router 255.255.255.224
30 hosts
Forouzan Notes COSC 6377 - Fall 2000 5-18
Forouzan Notes COSC 6377 - Fall 2000 5-
Slides from TCP/IP - Forouzan
Figure 5-18 Supernetwork
First class C address Second class C address
X.Y.32.254 X.Y.33.1
X.Y.32.2 X.Y.33.253
X.Y.32.1 X.Y.33.254
To the rest of Supernetwork
the Internet
R1
X.Y.32.0
X.Y.35.254 X.Y.34.1
X.Y.35.253 X.Y.34.2
X.Y.35.1 X.Y.34.254
Fourth class C address Third class C address
Forouzan Notes COSC 6377 - Fall 2000 5-19
Figure 5-19 Supernet mask
Netid Hostid
11111111 11111111 11111111 00000000
Netid Subnetid Hostid
11111111 11111111 11111111 11000000
a. Subnetting 4 subnets out of
1 network
Netid Hostid
11111111 11111111 11111111 00000000
Supernetid Hostid
11111111 11111111 111111 00 00000000
b. Supernetting 1 supernet out
of 4 networks
Forouzan Notes COSC 6377 - Fall 2000 5-20
Forouzan Notes COSC 6377 - Fall 2000 5-
Slides from TCP/IP - Forouzan
Figure 5-20 Two ways of defining a supernet
X.Y.32.0 , 255.255.252.0
Same
X.Y.32.0 , 1024
Forouzan Notes COSC 6377 - Fall 2000 5-21
Figure 5-21 Example of supernetting
X.Y.33.4 X.Y.39.12
xxxxxxxx yyyyyyyy 00100001 00000100 xxxxxxxx yyyyyyyy 00100111 00001100
11111111 11111111 11111100 00000000 11111111 11111111 11111100 00000000
xxxxxxxx yyyyyyyy 00100000 00000000 xxxxxxxx yyyyyyyy 00100100 00000000
X.Y.32.0 X.Y.36.0
Forouzan Notes COSC 6377 - Fall 2000 5-22
Forouzan Notes COSC 6377 - Fall 2000 5-
Slides from TCP/IP - Forouzan
Figure 5-22 CIDR
Default Network Next hop
mask address address
255.255.255.0 X.Y.32.0 ...........
255.255.255.0 X.Y.33.0 ...........
255.255.255.0 X.Y.34.0 ...........
255.255.255.0 X.Y.35.0 ...........
.. .. ..
. . .
a. Routing table without supernet mask
Default Network Next hop
mask address address
255.255.252.0 X.Y.32.0 ...........
.. .. ..
. . .
b. Routing table with supernet mask
Forouzan Notes COSC 6377 - Fall 2000 5-23
Forouzan Notes COSC 6377 - Fall 2000 5-