Ambo University Woliso Campus, Technology and Informatics School Department of Computer Science
Ambo University Woliso Campus, Technology and Informatics School Department of Computer Science
Ambo University Woliso Campus, Technology and Informatics School Department of Computer Science
Subnetting
IP Addressing 1
The need for sub netting
• Classes of IP addresses offer a range from 256 to 16.8 million
hosts.
• Subnetting separates a network into multiple logically
defined segments, or subnets.
• To efficiently manage a limited supply of IP addresses, all
classes can be subdivided into smaller sub networks or
subnets.
• This process is known as subnetting.
2
The sub - netting process
• To create the sub network structure, host bits must be
reassigned as network bits which is often referred to as
borrowing bits.
• The starting point for this process is always the leftmost bit of
the host.
– the one closest to the last network octet.
– a host field. 3
• The subnet field and the host field are created from the original
host portion of the major IP address.
• This is done by assigning bits from the host portion to the
original network portion of the address.
• Subnets have sub network ID (subnet ID) just as networks have
network IDs.
• Subnet IDs are found by replacing all host fields with 0s.
4
Sub netting Advantages
• Make a network more manageable
5
How many bits should be borrowed?
• To determine the number of bits to be used, the network
designer needs to calculate how many hosts the largest sub
network requires and the number of sub networks needed
• Large number of subnets means fewer hosts and a large number
of hosts means fewer subnets
• Total number of subnets is 2^bits borrowed
(2^5) 6
Positional value of bits
• Example
A 0 + 64 + 0 + 16 + 0 + 4 + 2 + 0 = 86
7
Usable subnets
• Among the available subnets, it is not advised to use the
following two subnets:
– The subnet with all 0’s in the subnet field
• If subnet zero (all 0’s in the subnet field) is used, it means that
a network and a subnet have the same address
• If the last subnet (all 1’s in the subnet field) is used, it means
that the network broadcast address and a subnet have the
same address
8
Usable subnets & Usable Hosts
• Hence usable subnets will be 2^bits borrowed – 2
9
Subnet masks
• For the subnet address scheme to work, every machine on
the network must know which part of the host address will be
used as the subnet address
• This is accomplished by assigning a subnet mask to each
machine.
• A subnet mask is a 32-bit value that allows the recipient of IP
packets to distinguish the network portion of the IP address
from the host portion of the IP address
10
Subnet masks
• A subnet mask is composed of 1s and 0s where:
11
Default subnet masks
• Not all networks need subnets, meaning they use the default
subnet mask
• This is basically the same as saying that a network doesn’t
have a subnet address. Here is default subnet mask for Classes
A, B, and C
• Class A - network.node.node.node Subnet mask: 255.0.0.0
• For example, /24 indicates that the total bits that were used
for the network and sub network portion is 24
• The subnet mask 255.255.255.224 in slash format is /27
• (224=11100000)
13
Subnet mask (contd.)
14
Sub netting Class C addresses - Example 1
A The ones which do not have all 0’s or all 1’s in the subnet field,
namely 192.168.10.64 and 192.168.10.128
16
Sub netting Class C addresses - Example 1
Q What’s the broadcast address for the valid subnets?
A The valid subnets start with 01 and 10. The broadcast address
for these two addresses will have 01111111 and 10111111.
Which are 127 and 191. So the broadcast addresses will be
192.168.10.127 and 192.168.10.191. As a shortcut you can
follow this rule: The number right before the value of the next
subnet is all host bits turned on and equals the broadcast
address
17
Sub netting Class C addresses - Example 1
Q What are the valid hosts?
18
Sub netting Class C addresses - Example 2
• Now let us subnet the network address 192.168.10.0,
this time with a subnet mask 255.255.255.224 or in slash
format /27
A We vary the borrowed bits (000, 001, 010, 011, 100, 101, 110,
111). So the subnets are 192.168.10.0, 192.168.10.32,
192.168.10.64, 192.168.10.96, 192.168.10.128,
192.168.10.160, 192.168.10.192, 192.168.10.224
20
Sub netting Class C addresses - Example 2
Q What’s the broadcast address for the valid subnets?
A The number right before the value of the next subnet is all host bits turned on
and equals the broadcast address – 192.168.10.63, 192.168.10.95,
192.168.10.127, 192.168.10.159, 192.168.10.191, 192.168.10.223
21
Sub netting Class C addresses - Example 3
• Subnet the network address 192.168.10.0, with a subnet
mask 255.255.255.248 (/28)
22
Sub netting Class C addresses - Example 3
Q What are the subnet IDs?
24
Sub netting Class C addresses - Example 3
Q What are the valid hosts?
25
Example 3 (contd.)
26
Calculating class A and B networks
• The Class A and B sub netting procedure is identical to the
process for Class C, except there may be significantly more
bits involved
• Assigning 12 bits of a Class B address to the subnet field
creates a subnet mask of 255.255.255.240 or /28.
• All eight bits were assigned in the third octet resulting in 255,
the total value of all eight bits. Four bits were assigned in the
fourth octet resulting in 240
27
Possible Class B subnet masks
255.255.128.0 (/17) 255.255.255.0 (/24)
• A 2^2 – 2 = 2.
29
Sub netting Class B addresses – Example 1
• Q Broadcast address for each subnet and valid hosts?
30
Sub netting Class B addresses – Example 2
A 2^4 – 2 = 14
2^12 – 2 = 4094
31
Sub netting Class B addresses – Example 2
32
Possible Class A subnet masks
33
Possible Class A subnet masks
255.255.0.0 (/16) 255.255.255.224 (/27)
34
Sub netting Class A addresses – Example 1
Q Subnets?
A 2^8 – 2 = 254
Q Hosts?
A 2^16 – 2 = 65,534
Q Valid subnets?
36
Sub netting Class A addresses – Example 2
Q Subnets?
2^12 – 2 = 4094
Q Hosts?
A 2^12 – 2 = 4094
37
Sub netting Class A addresses – Example 2
Q Valid subnets?
38
ANDing
• The subnet mask gives routers the information required to
determine in which network and subnet a particular host resides
• Routers make an AND operation between the subnet mask and
the destination address (ANDing) to determine the subnet ID of
the destination address. This information is required for routing
purposes
39
ANDing (contd.)
• Another Example
40