Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

CN Lab 3

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

Riphah International University,Lahore

Riphah School of Computing and Innovation

LAB MANUAL
Computer Networks
Name: Talha Khalid _
SAP Number: 27380
Semester: 5C _

By putting your name on this page, you agree NOT to misuse the knowledge
acquired in the Computer Communication and Networks course and the labs
under any circumstances.
LAB 3

OBJECTIVES:

1. To understand the classes of IP addresses


2. To become familiar with decimal and binary conversion of IP addresses

Lab Performance
No. Title Marks Obtained
Marks
1 Ability to Solve Problems 10
2 Implementation of skills 10

Remarks (if any): ………………………………….

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. The address indicates where the connected device resides with
the majority of hosts/devices still using the IPv4 (Internet Protocol Version 4) form of
addressing. A significant limitation of the legacy IPv4 addressing is that it supports less
than 4.3 billion total addresses. Based on the rapid growth of the Internet and related
technologies, the use of IPv4 is not sustainable for the long term. 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. The Internet Assigned Numbers Authority
(IANA) is responsible under the IETF for management of the IP address space allocation
globally. Beneath the IANA, there are five regional Internet registries (RIRs) that are
responsible for allocating IP address blocks to Internet service providers (ISPs) and other
trusted organizations.
IP Address Classes

There were five IP address classes in use before the majority of industry switched to
classless routing. There were A, B, C, D, and E. Class A addresses were used for networks
with a very large number of total hosts. Class B was designed for use on medium to large
networks, and C for small local area networks (LANs). Class D and E were set aside for
multicast and experimental purposes. In the following table, the four octets that make up
an IP address (a, b, c, and d respectfully) are displayed in how they were distributed in
classes A, B, and C.

Classes IP Network Host ID


Address ID
A a.b.c.d a b.c.d
B a.b.c.d a.b c.d
C a.b.c.d a.b.c d

The 5 Different Classes of IP Addresses


Class A 1.0.0.0.0 to 127.255.255.255
Class B 128.0.0.0 to 191.255.255.255
Class C 192.0.0.0 to 223.255.255.255
Class D 244.0.0.0 to 239.255.255.255
Class E 240.0.0.0 to 255.255.255.255

Class A IP Address

Class A IP addresses were used for networks that had a large number of hosts on the
network. The class permitted up to 126 networks by using the first octet of the address
for the network identification. The first bit in this octet was always fixed or set to be zero.
The following seven bits in the octet were then set to one which would complete the
network identification. The
remaining octets (24 bits) represented the hosts ID and would allow up to 126 networks
with 17 million hosts per network. In a Class A address, the network number values
start at the number 1 and end at 127.

Class B IP Address

Class B IP address were assigned to medium to large networks. They allow 16,384 networks
by using the first two octets in the address for the network identification. The first two
bits of the first octet are fixed to 1 0. The next 6 bits along with the following octet then
complete the network identification. The third and fourth octet (16 bits) then represents
the host ID. This allows approximately 65,000 hosts per network. Class B network number
values start at 128 and finish at 191.

Class C IP Address

Class C IP addresses were used in small LAN configurations. They allow for approximately 2
million networks by using the first three octets of the address for the network
identification. In a Class C address, the first three bits are fixed to 1 1 0. In the following
three octets, 21 bits make up the network identification. The last octet then represents the
host identification. This allows for 254 hosts per network. A Class C network number
value starts at 192 and ends at 223.

Class D IP Address

Class D IP addresses were reserved for multicasting purposes. These addresses begin with
an octet in the 224-239 range. They would have leading bits of 1 1 1 0 and includes
addresses from 224.0.0.0 to 239.255.255.255.

Class E IP Address

Class E IP addresses are reserved for experimental use. The first octet of these addresses
ranges between 240 and 255. This range is reserved by the IETF and similar to Class D
networks, should not be assigned to a host device.
Private IP Addresses

While we are used to writing out streets and house numbers on envelopes, inside your
computer IP Addresses are usually represented in what is known as dotted-decimal
format such as 124.62.112.7 as this is the system that is understood by computers. As you
can see, the address is split into 4 sections known as "octets" and each of the four octets
can be numbered from 0- 255, providing a total of 4,294,967,296 potentially unique IP
Addresses.

Now, while 4.2 Billion might seem like a lot, for many years large amounts of these have
been allocated and used by large network such as backbone providers, ISPs and large
Universities that made up the early Internet While other groups still have been reserved for
special purposes and are not usable, so in practice the real amount is far less than 4.2
billion. The problem that we face today is that with many homes owning more than one
computer and with cell phones, PDAs and even fridges being enabled for Internet access
these days, IP Addresses are running out.

When I mentioned above that some blocks of addresses had been reserved for special
purposes, one of these purposes was for private networking and it is these private
addresses that help to relieve the pressure on the remaining address space and make
possible many of the cable and DSL routers that people have at home today to share
their Internet connection amongst many PCs.

Private IP address ranges


The ranges and the amount of usable IP's are as follows:

10.0.0.0 - 10.255.255.255
Addresses: 16,777,216

172.16.0.0 - 172.31.255.255
Addresses: 1,048,576

192.168.0.0 - 192.168.255.255
Addresses: 65,536
Classless IP Addressing

After the invention of the Domain Name System (DNS), industry realized that the use
of IP address classes would limit the scalability of the Internet. As a result, the IETF
published RC 1518 and 1519 in 1993 to define the classless method of routing IPv4
data packets. The most recent definition of the standard occurred in 2006 under RFC
4632. Classless IP addressing was introduced as a more efficient means to make use of
the IP address space when compared to Classful addressing. In classless addressing,
the IP address is treated as a 32 bit stream where the boundary between the network
identification and host can be at any of the bit positions. The network portion of the
address is determined by the number of 1’s that are in the subnet mask being applied to
the address. A subnet mask is used locally on the hosts connected to the network and are
never transmitted in an IPv4 data packet or datagram. All of the hosts on the same
network are configured to use the same subnet mask with the host section of the IP
address being unique to the host. The classless version of address is referred to as
Classless Inter-Domain Routing (CIDR) and allows networks to be divided into different-
sized subnets.
The system avoids wasting IP addresses through the use of the subnet mask.

How Does a Subnet Mask Work?

In classless IP address, a subnet mask is used on a network to define how many bits are
used for the network address and how many are used for the host address. The subnet
mask is the same for all users on a specific network. When overlay on a host address, it
tells the host or device what part of the IP address is the network address and which is
used for the host. Subnet masks will typically start with 255.*.*.* with the remaining digits
specific to the network. Every subnet address on a large network will have its own subnet
mask which in essence means the specific subnet has a subnet mask. This allows for the
current form of classless IP addressing that has been in use for IPv4 networks since the
1990s.

The following table shows the IP Addresses that you should avoid using:

IP Address Function
Network 0.0.0.0 Refers to the default route. This route
is to simplify routing tables used by IP.
Network 127.0.0.0 Reserved for Loopback. The Address
127.0.0.1 is often used to refer to the
local
host. Using this Address, applications
can address a local host as if it were
a remote host.
IP Address with all host bits set to Refers to the actual network itself. For
"0" (Network Address) e.g. example, network 192.168.0.0 (Class C) can
192.168.0.0 be used to identify network 192.168.0.0
This type of notation is often used within
routing tables.
IP Address with all node bits set to IP Addresses with all node bits set to
"1" (Subnet / Network Broadcast) "1" are local network broadcast
e.g. addresses and must NOT be used.
192.168.255.255
Some examples: 125.255.255.255 (Class A),
190.30.255.255 (Class B), 203.31.218.255
(Class C). See "Multicasts" & "Broadcasts"
for more info.

IP Address with all bits set to "1" The IP Address with all bits set to "1"
(Network Broadcast) e.g. is a broadcast address and must NOT
255.255.255.255 be used. These are destined for all
nodes on a network, no matter what IP
Address they might have.

Task 1: Classful IP Addressing Practice Exercises

1. Complete the following table which provides practice in converting a number


from binary notation to decimal format.

Binary 128 64 32 16 8 4 2 1 Decimal

11001100 1 1 0 0 1 1 0 0 128+64+8+4=204
10101010 1 0 1 0 1 0 1 0 128+32+8+2=170
11100011 1 1 1 0 0 0 1 1 128+64+32+2+1=227

10110011 1 0 1 1 0 0 1 1 128+32+16+2+1=179
2. Complete the following table which provides practice in converting a number
from decimal notation to binary format.

Decimal 128 64 32 16 8 4 2 1 Binary

192 1 1 0 0 0 0 0 0 192=32+16=11000000
168 1 0 1 0 1 0 0 0 168=128+32+8=10101000

1 0 0 0 0 0 0 0 1 1=00000001

37 0 0 1 0 0 1 0 1 37=32+4+1=00100101

3. Express 145.32.59.24 in binary format and identify the address class:

145=128+16+1=10010001
32=32=00100000
59=32+16+8+2+1=00111011
24=16+8=00011000

It is in B class as(128-191)

4. Express 200.42.129.16 in binary format and identify the address class:

200=128+64+8=11001000
42=32+8+2=00101010
129=128+1=10000001
16=16=00010000

It is in C class as (192-223)
5. Express 14.82.19.54 in binary format and identify the address class:

14=8+4+2=00001110
82=64+16+2=01010010
19=16+2+1=00010011
54=32+16+4+2=00110110

It is in A class as (1-126)

You might also like