0% found this document useful (0 votes)
120 views

Experiment 3

The document discusses IP addresses and subnetting. It defines IP address classes and private IP ranges. It then provides an example of subnetting a Class C network into 9 subnets using binary operations and borrows 4 host bits to create the subnets.

Uploaded by

shaheer ali
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
120 views

Experiment 3

The document discusses IP addresses and subnetting. It defines IP address classes and private IP ranges. It then provides an example of subnetting a Class C network into 9 subnets using binary operations and borrows 4 host bits to create the subnets.

Uploaded by

shaheer ali
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Experiment No.

3
Understanding IP addresses and learning subnetting
OBJECTIVE
 Understanding IP addresses and learning subnetting
IP Address
An Internet Protocol (IP) address is a numeric label consisting of a 32-bit number assigned to
a network capable device that uses IP for communication. The address fundamentally serves
two purposes: location addressing and computer host or network interface identification. In
the mid-1990’s, the new IPv6 technique was developed which makes use of 128 bits for the
IP address. IPv6 technology continues to be deployed, albeit slowly.
IP Address Classes
There were five IP address classes in use before the majority of industry switched to classless
routing. In the following table, the four octets that make up an IP address are displayed in
how they were distributed in classes A, B, C,D and E.
Class A–E Addresses
Leading First Octet in
Class Notes
Bit Pattern Decimal

0 is invalid 127 reserved


A 0xxxxxxx 0-127
for loopback testing
B 10xxxxxx 128-191
C 110xxxxx 192-223
D 1110xxxx 224-239 Reserved for multicasting
E 1111xxxx 240-255 Reserved for future use/testing

Class 1st Octet 2nd Octet 3rd Octet 4th Octet Default Subnet Mask

Class A Address N H H H 255.0.0.0

Class B Address N N H H 255.255.0.0

Class C Address N N N H 255.255.255.0

Formulae
N
2 Where N is equal to number of bits borrowed Number of total subnets created
N
2 –2 Number of valid subnets created
H
2 Where H is equal to number of host bits Number of total hosts per subnet
H
2 –2 Number of valid hosts per subnet
N = Network bits
H = Host bits
All 0s in host portion = Network or subnetwork address
All 1s in host portion = Broadcast address
Combination of 1s and 0s in host portion = Valid host address

Private IP address ranges


Class Private Network Subnet Mask Address Range

A 10.0.0.0 255.0.0.0 10.0.0.0 - 10.255.255.255

B 172.16.0.0 - 172.31.0.0 255.255.0.0 172.16.0.0 –


172.31.255.255

C 192.168.0.0 – 255.255.255.0 192.168.0.0-


192.168.255.0 192.168.255.255

Converting Between Decimal Numbers and Binary


In any given octet of an IP address, the 8 bits can be defined as follows:

7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2
128 64 32 16 8 4 2 1

To convert a decimal number into binary, you must turn on the bits (make them a 1)
that would add up to that number, as follows:

187 = 10111011 = 128+32+16+8+2+1


224 = 11100000 = 128+64+32

To convert a binary number into decimal, you must add the bits that have been turned
on (the 1s), as follows:
10101010 = 128+32+8+2 = 170
11110000 = 128+64+32+16 = 240

The IP address 138.101.114.250 is represented in binary as

10001010.01100101.01110010.11111010

The subnet mask of 255.255.255.192 is represented in binary as

11111111.11111111.11111111.11000000

Subnetting a Class C Network Using Binary


You have a Class C address of 192.168.100.0 /24. You need nine subnets. What is the
IP plan of network numbers, broadcast numbers, and valid host numbers? What is the
subnet mask needed for this plan?
You cannot use N bits, only H bits. Therefore, ignore 192.168.100. These numbers
cannot change.
Step1: Determine how many H bits you need to borrow to create nine valid subnets.
2 –2≥9
N

N = 4, so you need to borrow 4 H bits and turn them into N bits.

Start with 8 H bits HHHHHHHH

Borrow 4 bits NNNNHHHH

Step 2 Determine the first valid subnet in binary.

0001HHHH Cannot use subnet 0000 because it is invalid. Therefore,


you must start with the bit pattern of 0001

00010000 All 0s in host portion = subnetwork number

00010001 First valid host number

00011110 Last valid host number

00011111 All 1s in host portion = broadcast number

Step 3 Convert binary to decimal.

00010000=16 Subnetwork number

00010001=17 First valid host number

00011110=30 Last valid host number

00011111=31 All 1s in host portion = broadcast number

Step 4 Determine the second valid subnet in binary.


0010HHHH 0010 = 2 in binary = second valid subnet

00100000 All 0s in host portion = subnetwork number

00100001 First valid host number

00101110 Last valid host number

00101111 All 1s in host portion = broadcast number

Step 5 Convert binary to decimal.

00100000=32 Subnetwork number

00100001=33 First valid host number

00101110=46 Last valid host number

00101111=47 All 1s in host portion = broadcast number

Step 6 Create an IP plan table.

Valid Subnet Network Number Range of Valid Hosts Broadcast Number

1 16 17–30 31

2 32 33–46 47

3 48 49–62 63

Step 7 Verify the pattern in binary. (The third valid subnet in binary is used here.)

0011HHHH 0011 = 3 in binary = 3rd valid subnet


00110000=48 Subnetwork number

00110001=49 First valid host number

00111110=62 Last valid host number

00111111=63 Broadcast number

Step 8 Finish the IP plan table.


Subnet Network Address Range of Valid Hosts Broadcast Address
(NNNN) (0000) (0001–1110) (1111)
0 (0000) 192.168.100.1–
192.168.100.0 192.168.100.15
invalid 192.168.100.14

192.168.100.17–
1 (0001) 192.168.100.16 192.168.100.31
192.168.100.30
192.168.100.33–
2 (0010) 192.168.100.32 192.168.100.47
192.168.100.46
192.168.100.49–
3 (0011) 192.168.100.48 192.168.100.63
192.168.100.62
192.168.100.65–
4 (0100) 192.168.100.64 192.168.100.79
192.168.100.78
192.168.100.81–
5 (0101) 192.168.100.80 192.168.100.95
192.168.100.94
192.168.100.97–
6 (0110) 192.168.100.96 192.168.100.111
192.168.100.110
192.168.100.113–
7 (0111) 192.168.100.112 192.168.100.127
192.168.100.126
192.168.100.129–
8 (1000) 192.168.100.128 192.168.100.143
192.168.100.142
192.168.100.145–
9 (1001) 192.168.100.144 192.168.100.159
192.168.100.158
192.168.100.161–
10 (1010) 192.168.100.160 192.168.100.175
192.168.100.174
192.168.100.177–
11 (1011) 192.168.100.176 192.168.100.191
192.168.100.190
192.168.100.193–
12 (1100) 192.168.100.192 192.168.100.207
192.168.100.206
192.168.100.209–
13 (1101) 192.168.100.208 192.168.100.223
192.168.100.222
192.168.100.225–
14 (1110) 192.168.100.224 192.168.100.239
192.168.100.238
15 (1111) 192.168.100.241–
192.168.100.240 192.168.100.255
invalid 192.168.100.254
Quick Always an even First valid host is Always an odd
Check number always an odd # number

Last valid host is always


an even #

Use any nine subnets—the rest are for future growth.

Step 9 Calculate the subnet mask.


The default subnet mask for a Class C network is as follows:

Decimal Binary

255.255.255.0 11111111.11111111.11111111.00000000

1 = Network or subnetwork bit


0 = Host bit
You borrowed 4 bits; therefore, the new subnet mask is the following:

11111111.11111111.11111111.11110000 255.255.255.240

NOTE: You subnet a Class B or a Class A network with exactly the same
steps as for a Class C network; the only difference is that you start with more
H bits.
Network Number and Broadcast Address of an IP Address
Binary ANDing
Recall that the truth table of binary ANDing:
0 and 0 = 0
1 and 0 = 0
0 and 1 = 0
1 and 1 = 1
You use ANDing most often when comparing an IP address to its subnet mask. The
end result of ANDing these two numbers together is to yield the network number of
that address.
Finding Network Number
What is the network number of the IP address 192.168.100.115 if it has a subnet mask
of 255.255.255.240?

Step 1 Convert both the IP address and the subnet mask to binary:
192.168.100.115 = 11000000. 10101000. 01100100. 01110011
255.255.255.240 = 11111111. 11111111. 11111111. 11110000
Step 2 Perform the AND operation to each pair of bits—1 bit from the address
ANDed to the corresponding bit in the subnet mask. Refer to the truth table for the
possible outcomes:
192.168.100.115 = 11000000. 10101000. 01100100. 01110011
255.255.255.240 = 11111111. 11111111. 11111111. 11110000
ANDed result = 11000000. 10101000. 01100100. 01110000
Step 3 Convert the answer back into decimal:
11000000.10101000.01100100.01110000 = 192.168.100.112
The IP address 192.168.100.115 belongs to the 192.168.100.112 network when a
mask of 255.255.255.240 is used.
So Why AND?
Good question. The best answer is to save you time when working with IP addressing
and subnetting. If you are given an IP address and its subnet, you can quickly find out
what subnetwork the address belongs to. From here, you can determine what other
addresses belong to the same subnet. Remember that if two addresses are in the same
network or subnetwork, they are considered to be local to each other and can therefore
communicate directly with each other. Addresses that are not in the same network or
subnetwork are considered to be remote to each other and must therefore have a Layer
3 device (like a router or Layer 3 switch) between them to communicate.
Finding Broadcast Address
What is the broadcast address of the IP address 192.168.100.164 if it has a subnet
mask of 255.255.255.248?
Step 1 Convert both the IP address and the subnet mask to binary:
192.168.100.164 = 11000000.10101000.01100100.10100100
255.255.255.248 = 11111111.11111111.11111111.11111000
Step 2 Perform the AND operation to each pair of bits—1 bit from the address
ANDed to the corresponding bit in the subnet mask. Refer to the truth table for
the possible outcomes:
192.168.100.164 = 11000000.10101000.01100100.10100100
255.255.255.248 = 11111111.11111111.11111111.11111000
ANDed result = 11000000.10101000.01100100.10100000
= 192.168.100.160 (Subnetwork #)
Step 3 Separate the network bits from the host bits:
255.255.255.248 = /29 = The first 29 bits are network/subnetwork bits;
therefore,
11000000.10101000.01100100.10100000. The last three bits are host
bits.
Step 4 Change all host bits to 1. Remember that all 1s in the host portion are the
broadcast number for that subnetwork:
11000000.10101000.01100100.10100111
Step 5 Convert this number to decimal to reveal your answer:
11000000.10101000.01100100.10100111 = 192.168.100.167
The broadcast address of 192.168.100.164 is 192.168.100.167 when the
subnet mask is 255.255.255.248.
Shortcuts in Binary ANDing
Remember when I said that this was supposed to save you time when working with IP
addressing and subnetting? Well, there are shortcuts when you AND two numbers
together:
 An octet of all 1s in the subnet mask will result in the answer being the same
octet as in the IP address.
 An octet of all 0s in the subnet mask will result in the answer being all 0s in that
octet.

Example:
To what network does 172.16.100.45 belong, if its subnet mask is
255.255.255.0?
Answer
172.16.100.0 (There is no need to convert here. The mask is either 255s or 0s.)
EXERCISES
1) You have a Class B address of 172.18.0.0 /16. You need nine subnets. What is the
IP plan of network numbers, broadcast numbers, and valid host numbers? What is
the subnet mask needed for this plan? Note: Show the results only as in STEP 8
and 9.

Subnet Mask; 255.255.0.0

Number of Subnets; 0

Number of Hosts; 65534


2) You have a Class C address of 209.50.1.0/24. You need 50 hosts per subnet. What
is the IP plan of network numbers, broadcast numbers, and valid host numbers?
What is the subnet mask needed for this plan? Note: Show the results only as in
STEP 8 and 9.
2 – 2 ≥ 54
H
Hint (
H = 6, so you need 6 H bits and turn the rest into N bits
(NNHHHHHH)
)
N=6 we need 6H bits to borrow and convert into N bits

Start with 8H bits =HHHHHHHH

Borrow 6 bits = NNHHHHHH

01HHHHHH =because we cannot use 00000 it is used for invalid

01000000 all 0s in host portion =subnetwork number

01000001= First valid host number

01111110=last valid host number

01111111=all 1 in host portion =broad cast number

Convert binary to decimal

01000000 = 64 =subnetwork number

01000001 = 65 =First valid host number

01111110 = 126 = Last valid host number

0111111 = 127 = Broad cast number

Determine the second valid subnet in binary.


0010 = 2 in binary = second valid subnet = 10HHHHHH

10000000 all 0s in host portion =subnetwork number

10000001= First valid host number

10111110=last valid host number

10111111=all 1 in host portion =broad cast number

10111111=all 1 in host portion =broad cast number

Convert binary to decimal

10000000 all 0s in host portion =subnetwork number = 128


10000001= First valid host number = 129

10111110=last valid host number = 190

10111111=all 1 in host portion =broad cast number = 191

Step 6 Create an IP plan table.

Valid Subnet Network Number Range of Valid Hosts Broadcast Number

1 64 65–126 127

2 128 129–190 191

3 192 193–254 255

Step 7 Verify the pattern in binary. (The third valid subnet in binary is used here.)

11HHHHHH 0011 = 3 in binary = 3rd valid subnet

11000000= 192 Subnetwork number

11000001=193 First valid host number

11111110=254 Last valid host number

11111111= 255 Broadcast number

Step 8 Finish the IP plan table.


Subnet Network Address Range of Valid Hosts Broadcast Address
(NNNN) (0000) (0001–1110) (1111)
0 (0000) 192.168.100.1–
192.168.100.0 192.168.100.15
invalid 192.168.100.14

192.168.100.65–
1 (0001) 192.168.100.64 192.168.100.127
192.168.100.126
192.168.100.129–
2 (0010) 192.168.100.128 192.168.100.191
192.168.100.190

192.168.100.193–
3 (0011) 192.168.100.192 192.168.100.255
192.168.100.254
192.168.100.257–
4 (0100) 192.168.100.256 192.168.100.319
192.168.100.318
192.168.100.321–
5 (0101) 192.168.100.320 192.168.100.383
192.168.100.382
192.168.100.385–
6 (0110) 192.168.100.384 192.168.100.447
192.168.100.446
192.168.100.449–
7 (0111) 192.168.100.448 192.168.100.511
192.168.100.510
192.168.100.513–
8 (1000) 192.168.100.512 192.168.100.575
192.168.100.574
192.168.100.577–
9 (1001) 192.168.100.576 192.168.100.639
192.168.100.638
192.168.100.641–
10 (1010) 192.168.100.640 192.168.100.703
192.168.100.702
192.168.100.705–
11 (1011) 192.168.100.704 192.168.100.767
192.168.100.766
192.168.100.769–
12 (1100) 192.168.100.768 192.168.100.831
192.168.100.830
192.168.100.833–
13 (1101) 192.168.100.832 192.168.100.895
192.168.100.894
192.168.100.897–
14 (1110) 192.168.100.896 192.168.100.959
192.168.100.958
15 (1111) 192.168.100.961–
192.168.100.960 192.168.100.1023
invalid 192.168.100.1022
Quick Always an even First valid host is Always an odd
Check number always an odd # number

Last valid host is always


an even #

Use any nine subnets—the rest are for future growth.

Step 9 Calculate the subnet mask.


The default subnet mask for a Class C network is as follows:

Decimal Binary

255.255.255.0 11111111.11111111.11111111.00000000

1 = Network or subnetwork bit


0 = Host bit
You borrowed 6 bits; therefore, the new subnet mask is the following:

11111111.11111111.11111111.11111100 255.255.255.252

NOTE: You subnet a Class B or a Class A network with exactly the same
steps as for a Class C network; the only difference is that you start with more
H bits.
3) To what network does 68.43.100.18 belong, if its subnet mask is 255.255.255.0?

Ans=68.43.100.0

4) To what network does 131.186.227.43 belong, if its subnet mask is 255.255.240.0


also find its Broadcast Address?

ANS .1ST convert ip and subnet in to binary


131.186.227.43 =10000011.10111010.11100011.101011

255.255.255.240 = 11111111.11111111.11111111.11110000

Then perform and operation


And result = 10000011.10111010.11100011.101010000

Convert it back into decimal =131.186.227.42 ANS .

5) Find the class of each address.


a. 00000001 00001011 00001011 11101111
Class A
b. 11000001 10000011 00011011 11111111
Class C
c. 14.23.120.8
Class A
d. 252.5.15.111
Class E
6) A block of addresses is granted to a small organization. We know that one of the
addresses is 205.16.37.39/28. Find
a. Network Address
b. The first usable address
c. The last usable address
d. The broadcast address
e. The number of addresses.

ANSWER:The binary representation of the given address is 11001101


00010000 00100101 00100111. If we set 32 - 28 rightmost bits to 0, we get
11001101 000100000100101 0010000 or 205.16.37.32.
 The first address can be found by ANDing the given addresses with the mask.
ANDing here is done bit by bit. The result of ANDing 2 bits is 1 if both bits are Is;
the result is 0 otherwise.

o Address : 11001101 00010000 00100101 00100111

o Mask : 11111111 11111111 11111111 11110000

o First address: 11001101 00010000 00100101 00100000 or


205.16.37.32.
 The last address can be found by ORing the given addresses with the
complement of the mask. ORing here is done bit by bit. The result of ORing 2 bits
is 0 if both bits are Os; the result is 1 otherwise. The complement of a number is
found by changing each 1 to 0 and each 0 to 1

o Address : 11001101 00010000 00100101 00100111

o Mask : 00000000 00000000 00000000 00001111

o Last address : 11001101 00010000 00100101 00101111 or


205.16.37.47.
 The number of addresses can be found by complementing the mask, interpreting
it as a decimal number, and adding 1 to it.

o Mask complement : 000000000 00000000 00000000 00001111


o Number of addresses: 15 + 1 = 16

 1st address is called the network address

7) Calculate
a. total No. of subnets
b. total No. of valid subnets
c. total No. of hosts per subnets
d. total No. of valid hosts per subnets

in class A, B and C.

ANSWER.
in class c subnet=16

Hosts =14

For class b subnet = 16,384

Hosts = 2

Subnet 64.0 128.0

Class A
Number of
Network Bits Subnet Mask Number of Hosts
Subnets
/8 255.0.0.0 0 16777214
/9 255.128.0.0 2 (0) 8388606
/10 255.192.0.0 4 (2) 4194302

Class B
Number of
Network Bits Subnet Mask Number of Hosts
Subnets
/16 255.255.0.0 0 65534
/17 255.255.128.0 2 (0) 32766
/18 255.255.192.0 4 (2) 16382
/19 255.255.224.0 8 (6) 8190

Class C
Network Number of
Subnet Mask Number of Hosts
Bits Subnets
/24 255.255.255.0 0 254
/25 255.255.255.128 2 (0) 126
/26 255.255.255.192 4 (2) 62
/27 255.255.255.224 8 (6) 30
PLO
Criteria Beginning (1) Developing (2) Accomplished (3) Exemplary (4)
No.

With instructor/
With instructor/
Apply Student is unable to apply supervisor’s Student is able to apply all
supervisor’s guidance,
Procedural described procedure to guidance, student is procedural knowledge to
student is able to apply
Knowledge perform activity despite able to apply all independently perform
1 some of the described
to perform instructor/ supervisor’s described procedure activity without instructor/
procedure to partially
an activity guidance. to fully perform supervisor’s guidance.
perform activity.
activity.

Student has shown little to With instructor/


With instructor/
Follow no regard for personal and supervisor’s guidance, Student has followed all
supervisor’s
personal and equipment safety student followed some of safety rules and protocols
6 guidance, student
equipment regulations despite the personal and without instructor/
followed all safety
Safety Rules instructor/ supervisor’s equipment safety supervisor’s guidance.
rules.
guidance. regulations

Student is able to Student is able to


Effectively
Student is unable to Student is able to partially effectively effectively and
document/
effectively document/ document/ communicate document/ independently document/
10 communicat
communicate performed performed activities with communicate communicate performed
e performed
activities despite guidance. guidance. performed activities activities form without any
activities
with guidance. guidance.

Rubrics Evaluation Criteria


Activity Name  Understanding IP addresses and learning
sub-netting
Group No.  07

Student Roll No.  8015 8017 8018 8025

CL PL Domain + Awarded Score (out of 4 for each cell)


No. O O Taxonomy Criteria
(Absent student will get zero mark)

Apply Procedural Knowledge to perform an


1 4 1 P3
activity

Total

You might also like