Experiment 3
Experiment 3
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
Class 1st Octet 2nd Octet 3rd Octet 4th Octet Default Subnet Mask
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
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:
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
10001010.01100101.01110010.11111010
11111111.11111111.11111111.11000000
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.)
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
Decimal Binary
255.255.255.0 11111111.11111111.11111111.00000000
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.
Number of Subnets; 0
1 64 65–126 127
Step 7 Verify the pattern in binary. (The third valid subnet in binary is used here.)
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
Decimal Binary
255.255.255.0 11111111.11111111.11111111.00000000
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
255.255.255.240 = 11111111.11111111.11111111.11110000
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
Hosts = 2
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.
Total