subnetting - kasetsart universitynguan/class/204421/slides/subnet.pdfapplied network research group...
TRANSCRIPT
Applied Network Research Group Department of Computer Engineering, Kasetsart University
1/37
Subnetting
Surasak [email protected]
http://www.cpe.ku.ac.th/~nguan
Last updated: 27 June 2002
Applied Network Research Group Department of Computer Engineering, Kasetsart University
2/37
Topics
The Basics of SubnettingSubnet MaskComputing subnets and hostsSubnet RoutingCreating a SubnetExample of Subnetting
Applied Network Research Group Department of Computer Engineering, Kasetsart University
3/37
Addressing without Subnets
A class B “Flat Network”, more than65000 hosts
How to manage?Performance?
172.16.1.2 172.16.1.3 172.16.254.254172.16.2.1
172.16.0.0
Applied Network Research Group Department of Computer Engineering, Kasetsart University
4/37
Addressing with Subnets172.16.1.2
172.16.3.3172.16.3.2
172.16.1.3
A class B “subdivided network”, smaller groupswith routers
172.16.2.2 172.16.2.3
172.16.4.2 172.16.4.3
172.16.1.0
172.16.3.0
172.16.2.0
172.16.4.0
Applied Network Research Group Department of Computer Engineering, Kasetsart University
5/37
Subnetwork
Subnetwork benefits
Subdivide on IP network numberis an important initial task of
network managers
Increase the network manager's control over
the address space
Smaller networksare easier to manage
and troubleshootOverall traffic is reduced, performance
may improve
Applied Network Research Group Department of Computer Engineering, Kasetsart University
6/37
Subnet Address
A subnet address is created by borrowing bitfrom the Host ID and designated it as a SubnetID field
Network ID Subnet ID Host ID
Network ID Host ID
After Subnetting
Before Subnetting
Applied Network Research Group Department of Computer Engineering, Kasetsart University
7/37
How to assign subnetEach class can have different size of subnet field
Network Subnet Host
choose appropriate size
Class A : 2 to 22 bits Class B :
2 to 14 bits
Class C : 2 to 6 bits
Define physical subnetwork Define individual hosts
Applied Network Research Group Department of Computer Engineering, Kasetsart University
8/37
Subnet Example
Class B address such as 172.16.0.0 mightuse its third byte to identify subnet
172. 16. 1. 0
172. 16. 2. 0
172. 16. 3. 0
172. 16. 254. 0
#1 172.16.1.1-172.16.1.254
#2
#3
#254
172.16.2.1-172.16.2.254
172.16.3.1-172.16.3.254
172.16.254.1-172.16.254.254
Subnet Network Address Address Range
Applied Network Research Group Department of Computer Engineering, Kasetsart University
9/37
Example : A class B network with 24 bits mask
Subnet masksubnet mask is a 32 bit number, use to identify a subnet
255. 0.255.255.
subnet mask= 255.255.255.0
1111 1111 0000 00001111 11111111 1111
Network ID Subnet ID Host ID
Set the bitcovering thenetwork andsubnet ID to 1
1
zero bit are used to mask out the host number resulting the network address
2
Applied Network Research Group Department of Computer Engineering, Kasetsart University
10/37
1 1 0 01 0 1 0 1 0 0 00 0 0 0 0 1 0 00 0 0 0 0 0 0 00 0 0 0
Masking
1 1 0 01 0 1 0 0 0 0 00 0 0 1 0 1 0 00 0 0 0 0 0 1 00 0 0 0
1 1 1 11 1 1 1 0 0 0 00 0 0 01 1 1 11 1 1 1 1 1 1 11 1 1 1& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &
&172.16.4.2 255.255.255.0
172.16.4.0
A “bitwise-and” between IP address and subnet mask yields a network address. Note that zeros bit are used to mask out the host number
resulting the network address
Applied Network Research Group Department of Computer Engineering, Kasetsart University
11/37
Subnet mask in Prefix formatThe number of routing bits (network and subnet bits) in eachsubnet mask can also be indicated by the "/n " format.
0000 0000 0000 00000000 00001111 1111
1100 0000 0000 00001111 11111111 1111
255.255.192.0
1111 1111 0000 00001111 11111111 1111
255.255.255.0
255.0.0.0
1111 1111 1111 00001111 11111111 1111
255.255.255.240
/8
/18
/24
/28
172.16.0.0/24172.16.0.0 255.255.255.0 =
Applied Network Research Group Department of Computer Engineering, Kasetsart University
12/37
Subnet routing
if dest_ip_addr & subnet_mask = = my_ip_addr & subnet_masksend pkt on local network %dest ip addr is on the same subnet
else send pkt to router %dest ip addr is on diff subnet
Traffic is routed to a host by looking “bit-wise and”results
Applied Network Research Group Department of Computer Engineering, Kasetsart University
13/37
Routing
Hosts and routers perform logical AND to send packets
172.16.1.2
172.16.3.3172.16.3.2
172.16.1.3 172.16.2.2 172.16.2.3
172.16.4.2 172.16.4.3
172.16.1.0/24
172.16.3.0/24
172.16.2.0/24
172.16.4.0/24
To 172.16.4.2
172.16.1.3 has a packet for 172.16.4.2 and determinethat it is on other subnetworkThe packet is sent to the routerThe router performs a subnet masking and sends thepacket to the destination network
1
2
3
Applied Network Research Group Department of Computer Engineering, Kasetsart University
14/37
Subnet interpretation
IP Address subnet mask Interpretation
15.20.15.2 255.255.0.0 host 15.2 on subnet 15.20.0.0
130.122.34.3 255.255.255.192 host 3 on subnet 130.122.34.0
130.122.34.132 255.255.255.192 host 4th on subnet 130.122.34.128
158.108.2.71 255.255.255.0 host 71 on subnet 158.108.2.0
200.190.155.66 255.255.255.192 host 2nd on subnet 200.190.155.64
Applied Network Research Group Department of Computer Engineering, Kasetsart University
15/37
Default Subnet maskA default subnet mask : a subnet mask with nosubnetting
0000 0000 0000 00000000 00001111 1111
Class A 255.0.0.0
0000 0000 0000 00001111 11111111 1111
Class B 255.255.0.0
1111 1111 0000 00001111 11111111 1111
Class C 255.255.255.0
Applied Network Research Group Department of Computer Engineering, Kasetsart University
16/37
Range of bitA default subnet mask : a subnet mask with nosubnetting
0 016172
IP
0 0255255
Default subnet
255 0255255
New subnet
Define a subnet mask by extending thenetwork portion to the right, 8 bits inthis example
Applied Network Research Group Department of Computer Engineering, Kasetsart University
17/37
Computing subnet mask
Decimal equivalents of bit patterns
1 0 0 0 0 0 0 01 1 0 0 0 0 0 01 1 1 0 0 0 0 01 1 1 1 0 0 0 01 1 1 1 1 0 0 01 1 1 1 1 1 0 01 1 1 1 1 1 1 01 1 1 1 1 1 1 1
128192224240248252254255
Binary mask Octet value
128 64 32 16 8 4 2 1
Applied Network Research Group Department of Computer Engineering, Kasetsart University
18/37
Compute Net and hostHow many subnet and host are there with172.16.0.0/24
1111 1111 0000 00001111 11111111 1111
255. 0.255.255.
Network ID Subnet ID Host ID
8 bit subnet ID = 28=256 => 254 subnets8 bit host ID = 28=256 => 254 hosts per subnet
Applied Network Research Group Department of Computer Engineering, Kasetsart University
19/37
Network and Host relationshipSample class C
71%1803063
77%19614144
49%1246222
49%1242626
71%1806305
Percentsused
Totalnumber of
hosts
Number ofhosts
per subnet
Number ofsubnetscreated
Number ofsubnet
bits
Applied Network Research Group Department of Computer Engineering, Kasetsart University
20/37
Subnetting Special Addresses
Subnetwork AddressAll 0sany
PurposeHostIDNetID
Subnet-directed BroadcastAll 1sany
Reserved addresses that are not allowed to be assigned to any node
Example: 172.16.2.0/24 Subnetwork 172.16.2.0
Example: 172.16.2.255/24 Directed broadcast of the subnetwork 172.16.2.0
Applied Network Research Group Department of Computer Engineering, Kasetsart University
21/37
Subnet Net Block Diagram
Block diagramsubnetting class C
No subnetting 2 bits
3 bits 4 bits
Network Address Broadcast Address
Applied Network Research Group Department of Computer Engineering, Kasetsart University
22/37
Contiguous and Noncontiguous mask
Noncontiguous leads to complex subnetting and routing
It is strongly recommend to use contiguous subnet mask
1111 1111 0000 00001111 11111111 1111
Contiguous subnet mask
0001 1111 0000 00001111 11111111 1111
Noncontiguous subnet mask
no intermedite 0 gaps in the subnet mask
intermedite 0 gaps in the subnet mask
Applied Network Research Group Department of Computer Engineering, Kasetsart University
23/37
Subnet Class A Example
subnet mask Interpretation
255.0.0.0 1 network with 1677214 hosts (default subnet)
255.255.0.0 254 subnets each with 65534 hosts
255.255.128.0 510 subnets each with 32768 hosts
255.255.192.0 1022 subnets each with 16382 hosts
255.255.255.0 65534 subnets each with 254 hosts
Applied Network Research Group Department of Computer Engineering, Kasetsart University
24/37
#254
#2
#1
Example : Class A Subnet Address Table
10.0.0.0 10.0.0.1 10.0.255.254 10.0.255.255
10.1.0.0 10.1.0.1 10.1.255.254 10.1.255.255
10.254.0.0
10.255.0.0
10.254.0.1
10.255.0.1
10.254.255.254 10.254.255.255
10.255.255.254 10.255.255.255
10.2.0.0 10.2.0.1 10.2.255.254 10.2.255.255
IP Address : 10.0.0.0/16
Netw
ork Address
SubnetID all 0s
SubnetID all 1s
Broadcast A
ddress
Applied Network Research Group Department of Computer Engineering, Kasetsart University
25/37
Class A Subnet with router10.1.0.0
10.2.0.0
10.3.0.0
10.255.0.0
10.1.0.1 to 10.1.255.254
10.2.0.1 to 10.2.255.254
10.3.0.1 to 10.3.255.254
10.255.0.1 to 10.255.255.254
10.0.0.0/16254 subnets each with 65534 hosts
#1
#2
#3
#254
Applied Network Research Group Department of Computer Engineering, Kasetsart University
26/37
Subnet Class B Example
subnet mask Interpretation
255.255.0.0 1 network with 65534 hosts (default subnet)
255.255.192.0 2 subnets each with 16382 hosts
255.255.252.0 62 subnets each with 1022 hosts
255.255.255.0 254 subnets each with 254 hosts
255.255.255.252 16382 subnets each with 2 hosts
Applied Network Research Group Department of Computer Engineering, Kasetsart University
27/37
#254
#2
#1
Example : Class B Subnet Address Table
172.16.0.0 172.16.0.1 172.16.0.254 172.16.0.255
172.16.1.0 172.16.1.1 172.16.1.254 172.16.1.255
172.16.254.0
176.16.255.0
172.16.254.1
176.16.255.1
176.16.254.254 176.16.254.255
176.16.255.254 176.16.255.255
172.16.2.0 172.16.2.1 172.16.2.254 172.16.2.255
IP Address : 176.16.0.0 /24
SubnetID all 0s
SubnetID all 1s
Netw
ork Address
Broadcast A
ddress
Applied Network Research Group Department of Computer Engineering, Kasetsart University
28/37
Class B Subnet with router172.16.1.0
172.16.2.0
172.16.3.0
172.16.254.0
172.16.1.1 to 172.16.1.254
172.16.2.1 to 172.16.2.254
172.16.3.1 to 172.16.3.254
172.16.254.1 to 172.16.254.254
172.16.1.0/24254 subnets each with 65534 hosts
#1
#2
#254
#3
Applied Network Research Group Department of Computer Engineering, Kasetsart University
29/37
Subnet Class C Example
subnet mask Interpretation
255.255.255.0 1 network with 254 hosts (default subnet)
255.255.255.192 2 subnets each with 62 host
255.255.255.224 6 subnets each with 30 hosts
255.255.255.240 14 subnets each with 14 hosts
255.255.255.252 62 subnets each with 2 hosts
Applied Network Research Group Department of Computer Engineering, Kasetsart University
30/37
#6
#2
#1
Example : Class C Subnet Address Table
192.68.0.0 192.68.0.1 192.68.0.30 192.68.0.31
192.68.0.32 192.68.0.33 192.68.0.62 192.68.0.63
192.68.0.192
192.68.0.224
192.68.0.193
192.68.0.225
192.68.0.222 192.68.0.223
192.68.0.254 192.68.0.255
192.68.0.64 192.68.0.65 192.68.0.94 192.68.0.95
IP Address : 192.68.0.0 /27
Netw
ork Address
SubnetID all 0s
Broadcast A
ddress
SubnetID all 1s
Applied Network Research Group Department of Computer Engineering, Kasetsart University
31/37
Class C Subnet with router192.68.0.32
192.68.0.64
192.68.0.96
192.68.0.192
192.68.0.33 to192.68.0.62
192.68.0.65 to 192.68.0.94
192.68.0.97 to 192.68.0.126
192.68.0.193 to 192.68.0.222
192.68.0.0/276 subnets each with 30 hosts
#1
#2
#6
#3
Applied Network Research Group Department of Computer Engineering, Kasetsart University
32/37
Subnet Exercise (1)Given IP address 161.200, find out the following to yield notmore than 256 hosts per subnet
net mask= ??start net id =??end net id=??#of subnet =??
Applied Network Research Group Department of Computer Engineering, Kasetsart University
33/37
Subnet Exercise (2)Given IP address 192.150.251, find out the following to yieldnot more than 32 hosts per subnet
net mask= ??start net id =??end net id=??#of subnet =??
Applied Network Research Group Department of Computer Engineering, Kasetsart University
34/37
Type of Subnetting
all subnets in the subnetted network usethe same subnet mask
pros: simply to implement, easy tomaintaincons: wasted address space (consider anetwork of 4 hosts with 255.255.255.0wastes 250 IP)
the subnets may use different subnetmasks
pros: utilize address spacescons: required well-management
Static Subnetting
Variable Lengh Subnetting
Applied Network Research Group Department of Computer Engineering, Kasetsart University
35/37
Problem of Static subnetting
Inefficient allocation ofthe address space
192.68.0.32/27used 20 hosts, waste 10 hosts
192.68.0.64/27used 20 hosts, waste 10 hosts
192.68.0.96/27used 25 hosts, waste 5 hosts
192.68.0.128/27used 25 hosts, waste 5 hosts
192.68.0.192/27used 10 hosts, waste 20 hosts
192.68.0.224/27used 10 hosts, waste 20 hosts
Applied Network Research Group Department of Computer Engineering, Kasetsart University
36/37
Variable-Length Subnetting192.68.0.32/27used 20 hosts,waste 10 hosts
192.68.0.64/27used 20 hosts,waste 10 hosts
192.68.0.96/27used 25 hosts,waste 5 hosts
192.68.0.128/27used 25 hosts,waste 5 hosts
192.68.0.192/28used 10 hosts,waste 4 hosts
192.68.0.224/28used 10 hosts,waste 4 hosts
192.68.0.208/28unused subnetAvailable 14 hosts
192.68.0.240/28unused subnetAvailable 14 hosts
General Idea of VLSMA small subnet with only afew hosts needs a subnetmask that accommodateonly few hostsA subnet with many hostsneed a subnet mask toaccommodatethe large number of hosts
General Idea of VLSMA small subnet with only afew hosts needs a subnetmask that accommodateonly few hostsA subnet with many hostsneed a subnet mask toaccommodatethe large number of hosts
Applied Network Research Group Department of Computer Engineering, Kasetsart University
37/37
VLSM - An Examplethree different VLSM of 172.16.0.0
255.255.255.0
CPC
CPE
255.255.255.192
255.255.255.252
255.255.255.252
255.255.255.252
255.255.255.252
255.255.255.0
RDI
point-to-point link