Professional Documents
Culture Documents
What is subnetting?
You only get one public IP (1 network address and many hosts) and you want to have many subnets
inside of it?
Then you have to subnet this network segment and break it into smaller pieces!.
Subnetting is a Technique used to allow a single IP network address to span multiple physical networks. IP hosts
should support subnetting. Subnetting is done by using some of the bits of the host-id part of the IP address as a
physical network identifier. The subnet mask is used to determine the bits of the network identifier. All hosts on the
same network should have the same subnet mask.
ANDING With Default subnet masks
Every IP address must be accompanied by a subnet mask. By now you should be able to look at an IP address and tell what
class it is. Unfortunately your computer doesn’t think that way. For your computer to determine the network and subnet portion
of an IP address it must “AND” the IP address with the subnet mask.
In order for you computer to get the same information it must AND the IP address with the subnet mask in binary
ANDING with the default subnet mask allows your computer to figure out the network portion of the address.
As we know, for example class C contains IPs like this : NET.NET.NET.HOST so its default subnet
mask is 255.255.25
Riphah International University, Islamabad
Faculty of Computing
See this:
192 . 168 . 1 . 1
Examples
1- You have been allocated a class A network address of 29.0.0.0. You need to create at least 20 networks
and each network will support a maximum of 160 hosts. Would the following two subnet masks Work?
255.255.0.0 and or 255.255.255.0
Mask 255.255.0.0 has 8 bits for the subnet and 16 bits for the host
Mask 255.255.255.0 has 16 bits for the subnet and 8 bits of the host.
2. – You have been allocated a class B network address of 135.1.0.0 and and need to create 4 subnets each
with around 200 hosts what is the easiest mask to use to satisfy the criteria?
Easiest is to sub net on a byte boundary which would mean a subnet mask of 255.255.255.0
We need to accommodate around 200 hosts which requires 8 bits which we have.
We need 4 subnets which require 4 bits and we have 8 bits. So we have more than enough.
6-
Riphah International University, Islamabad
Faculty of Computing
Example
For example, we can express the idea that the IP address 192.168.0.1 is associated with the
netmask 255.255.255.0 by using the CIDR notation of 192.168.0.1/24, where 24 represents the number of
network bits in the IP address (IPv4 address has 32 bits, so the network can be between 0 and 32).
7-
Riphah International University, Islamabad
Faculty of Computing
During the era of classful addressing, subnetting was introduced. If an organization was
granted a large block in class A or B, it could divide the addresses into several contiguous
groups and assign each group to smaller networks (called subnets) or, in rare cases,
share part of the addresses with neighbors. Subnetting increases the number of Is in the
mask, as we will see later when we discuss classless addressing.
Classful addressing, which is almost obsolete, is replaced with classless addressing.
Classless Addressing
To reduce the wastage of IP addresses in a block, we use sub-netting. What we do is that we
use host id bits as net id bits of a classful IP address. We give the IP address and define the
number of bits for mask along with it (usually followed by a ‘/’ symbol), like, 192.168.1.1/28.
Here, subnet mask is found by putting the given number of bits out of 32 as 1, like, in the given
address, we need to put 28 out of 32 bits as 1 and the rest as 0, and so, the subnet mask would
be 255.255.255.240.
8-
Riphah International University, Islamabad
Faculty of Computing
Example : Given IP Address – 172.16.0.0/25, find the number of subnets and the number of
hosts per subnet. Also, for the first subnet block, find the subnet address, first host ID, last host
ID and broadcast address.
Solution : This is a class B address. So, no. of subnets = 2 (25-16) = 29 = 512.
No. of hosts per subnet = 2(32-25) – 2 = 27 – 2 = 128 – 2 = 126
For the first subnet block, we have subnet address = 0.0, first host id = 0.1, last host id = 0.126
and broadcast address = 0.127
Example
The largest network LAN A requires 60 hosts. From the Host section (row) of our
subnetting chart below, the closest to the required 60 hosts is 64, which corresponds to
4 subnets and a new CIDR value of /26 (the column is in bold). From this relevant
information, we will build a new table containing Network ID, Subnet Mask in CIDR
notation, Usable, and Name of Local Area Network affected. Keep in mind the first host
identifier is reserved for the network ID and the last host ID is reserved for the
broadcast ID, so the total number of usable host IDs for each subnet in this particular
case is 62 (64-2).
9-
Riphah International University, Islamabad
Faculty of Computing
Now let’s list a network ID for each subnet. Keep in mind that only the fourth octet
changes; the first three octets remain the same:
Here is the pattern: The first network ID is always the original one. The next network ID
is obtained by adding 64 to the previous one. We can assign any of these for subnets
to LAN A since they are all equal in size, but for the sake of simplicity, we assign the
first subnet (192.168.4.0) to LAN A. The other three available subnets can be marked
as unassigned and reserved for future use. We have completed the task of designing
the IP plan for the largest LAN – LAN B.
10 -
Riphah International University, Islamabad
Faculty of Computing
192.168.4.62
192.168.4.64 /26 192.168.4.65 62 192.168.4.127
192.168.4.126
192.168.4.128 /26 192.168.4.129 62 192.168.4.191
192.168.4.190
192.168.4.192 /26 192.168.4.193 62 192.168.4.255
192.168.4.254
4 subnet, 64 each subnet have 64 Host ID’s including network id and broadcast id, /26 is new
subnet mask
First host id is reserved for network id
Last host id is reserved for broadcast id
64-2= 62 usable
192.168.4.1
192.168.4.62
0 is reserve for network id and 63 is reserved for broadcast id.
11 -