0% found this document useful (0 votes)
30 views3 pages

B1 Subnetting

SPPU SEM5 CNSL

Uploaded by

anshika singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views3 pages

B1 Subnetting

SPPU SEM5 CNSL

Uploaded by

anshika singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Lab Assignment on Unit V

Aim: Write a program to demonstrate subletting and find the subnet masks.

Requirements: Fedora 20 with Pentium IV and above, 1 GB RAM, 120 G.B HDD, Monitor,
Keyboard, Mouse , Modelio, Eclipse, CDT, Python interpreter, Pydev, J2SE

Theory:

1. Subletting
Subletting is when you enter a lease with someone else, known as a subtenant, for an
apartment or other property which you already rent. Subletting is usually used when you're renting a
property and need to leave the property before the lease is up and don't want to spend the money to
continue renting the property which you don't inhabit. Subletting lets you essentially act as a sort of
mini-landlord for the property you were renting to keep yourself from paying for something you're
not using.

2. Netmask

A netmask is a 32-bit mask used to divide an IP address into subnets and specify the
network's available hosts. In a netmask, two bits are always automatically assigned. For example, in
255.255.225.0, "0" is the assigned network address. In 255.255.255.255, "255" is the assigned
broadcast address. The 0 and 255 are always assigned and cannot be used.

Below is an example of a netmask and an example of its binary conversion.


Netmask: 255. 255. 255. 255
Binary: 11111111 11111111 11111111 11111111
Netmask length 8 16 24 32

Counting out the bits in the binary conversion allows you to determine the netmask length. Above is
an example of a 32-bit address. However, this address is a broadcast address and does not allow any
hosts (computers or other network devices) to be connected to it.

A commonly used netmask is a 24-bit netmask, as seen below.


Netmask: 255. 255. 255. 0
Binary: 11111111 11111111 11111111 00000000
Netmask length 8 16 24 --

Using a 24-bit netmask, the network would be capable of 2,097,150 networks or 254 different hosts
with an IP range of 192.0.1.x to 223.255.254.x, which is usually more than enough addresses for
one network.
A simple formula can be used to determine the capable amount of networks a netmask can support.

2^(netmask length -# of used segment) – 2

For example, if we used a netmask length of 24, having a netmask of 255.255.255.0 with 3 used
segments, subtract 3 from the netmask length, e.g. 24-3 = 21. With this number determined, plug it
into the above formula to get 2^ 21 - 2 = 2,097,150 total number of networks. You are subtracting 2
from this number because of the broadcast and network addresses that are already being used.
Another example is a netmask length of 16, having a netmask of 255.255.0.0 with 2 used segments.
Using the above formula, you would get 2^14 - 2 = 16,382 total number of networks.
To determine the amount of hosts a netmask is capable of supporting, use the following formula.
2^(# of zeros) - 2
For example, with a netmask length of 24, as shown in the above chart, there are 8 zeroes. There-
fore, using the formula above, this would be 2^8 - 2 = 254 total number of hosts. Again, 2 is sub-
tracted from this number to account for the broadcast and network addresses.
Again, another example of a netmask length of 16, there would be 16 zeroes. The formula in this
case would be 2^16 - 2 = 65,534 total number of hosts.
Below is a breakdown of each of the commonly used network classes.

Class Netmask length # of networks # of hosts Netmask


Class A 8 126 16,777,214 255.0.0.0
Class B 16 16,382 65,534 255.255.0.0
Class C 24 2,097,150 254 255.255.255.0

3. Subnet Masks
Subnet mask is a mask used to determine what subnet an IP address belongs to. An IP
address has two components, the network address and the host address. For example, consider the
IP address 150.215.017.009. Assuming this is part of a Class B network, the first two numbers
(150.215) represent the Class B network address, and the second two numbers (017.009) identify a
particular host on this network.

Short for subnetwork mask, a subnet mask is data used for bitwise operations on a
network of IP addresses that has been divided into two or more groups. This process, known as
subnetting, divides an IP network into blocks of logical addresses. Subnetting can improve security
and help to balance overall network traffic. A common example of a subnet mask for class C IP
addresses is 255.255.255.0, the default subnet mask for many computers and network routers. When
applied to subnet, a subnet mask shows the routing prefix.

Subnetting enables the network administrator to further divide the host part of the address
into two or more subnets. In this case, a part of the host address is reserved to identify the particular
subnet. This is easier to see if we show the IP address in binary format.

The full address is:


10010110.11010111.00010001.00001001
The Class B network part is:
10010110.11010111
The host address is:
00010001.00001001

If this network is divided into 14 subnets, however, then the first 4 bits of the host address (0001)
are reserved for identifying the subnet.
The subnet mask is the network address plus the bits reserved for identifying the subnetwork -- by
convention, the bits for the network address are all set to 1, though it would also work if the bits
were set exactly as in the network address. In this case, therefore, the subnet mask would be
11111111.11111111.11110000.00000000. It's called a mask because it can be used to identify the
subnet to which an IP address belongs by performing a bitwise AND operation on the mask and the
IP address. The result is the subnetwork address:
Subnet Mask 255.255.240.000 11111111.11111111.11110000.00000000
IP Address 150.215.017.009 10010110.11010111.00010001.00001001
Subnet Address 150.215.016.000 10010110.11010111.00010000.00000000
The subnet address, therefore, is 150.215.016.000.

Outcomes:
The output will be the subnet mask of the given IP address of the host.

You might also like