Computer Networks Lab Manual
Computer Networks Lab Manual
Syllabus
1. Familiarization with
Networking cables (CAT5, UTP)
Connectors (RJ45, T-connector)
Hubs, Switches, Router, Gateway
Basic Networking Commands(Windows/Linux)
2. Implementation of
Data Link Layer Error Detection Mechanism (Parity Check)
Data Link Layer Error Detection Mechanism (Cyclic Redundancy Check)
Data Link Layer Error Detection Mechanism (Check Sum)
3. TCP/UDP Socket Programming
Ionospheric and
Line of Sight (LOS) Propagation.
DESCRIPTOR
Fiber Optic relies on pulsed as light to carry information. Two types of plastic or glass with
different physical properties are used (the inner core and the outer cladding) to allow a beam of
light to reflect off the boundary between the core and cladding. Some fiber optic cables allow
many different paths other allow one single mode.
REPEATER
A Repeater is a purely electrical device that extends maximum distance a LAN cable can span by
Amplifying signals passing through it. A Repeater connects two segments and broadcasts
packets between them. Since signal loss is a factor in the maximum length of a segment, a
Repeater is used to amplify the signal and extend the usable length. A common Ethernet rule is
that no more than four repeaters may be used to join segments together. This is a physical
limitation designed to keep collision detection working properly. Repeaters operate at layer 1
(Physical layer) of the OSI model.
BRIDGES
This networks bridge provides an inexpensive and easy way to connect network segments. A
bridge provides Amplification function of a repeater plus, ability to select filter packets based on
their addresses. When network grows in size, it is often necessary to partition it in to smaller
group of nodes to help isolate traffic and improve performance. One way to do this is to use
bridge, the operation of it is to keep one segment traffic to that side and other side will cross the
bridge, The bridge learns which packets should cross it as it is used.
ROUTERS
A router is a device that connects two LANs together to form an inter-network. A router is the
basic building block of the Internet. Each router connects two or more networks together by
providing an interface for an Ethernet network and ring network to which it is connected. The
router examines each packet of information to detection weather the packet must be translated
form on one network to another network performing a function similar to a bridge. Unlike a
bridge, a router can connect network that use different technologies, addressing methods, media
type, frame format and speeds. A router is a special purpose device designed to interconnect
networks. Such that three networks can be connected using two routers. Routers maintain routing
tables in their memories to store information about the physical connection on the network; the
router examines each packet of data, checks the routing table and then forwards the packet if
necessary. Every other router in the path (between any state destinations) performs a similar
procedure. Note that a router does not maintain any state information about the packets; it simply
moves them along the network. Routers are operated at layer 3(network) of OSI model.
GATEWAYS
A node on a network that serves as an entrance to another network. In enterprises, the gateway
node often acts as a proxy server and a firewall. The gateway is also associated with both a
switch, which provides the actual path for the packet in and out of the gateway. It is also known
as a computer system located on earth that switches data signals and voice signals between
satellites and terrestrial networks. A gateway can operate at any layer of the OSI/RM. The hob of
a gateway, also called a protocol converter, is much more complex than that of a router or
switch. Typically a gateway must convert from one protocol stack to another.An Application
Level Gateway provide much stricter form of security that packet filters, but they are designed to
regulate access only for a particular application. TANSCEIVERS A transceiver converts from
one media type to another. It is common to use more than one media type an installation, so
many different kinds of transceivers are available.
HUBS
Hubs are also called concentrators; expand one Ethernet connection into many. For example, a
four-port hub connects up to four machines via UTP cables. The hub provides a star connection
for the four ports. One pot is desired to operate in either straight through or crossover mode,
selected by a switch on the hub. Hubs that can connect in this fashion are called stackable hubs.
A hub is similar to a repeater, expect it broadcasts data received by any port to all other ports on
the hub. Most hubs contain a small amount of intelligence as well. Examining received packets
and checking them for integrity. If a bad packet arrives or the hub determines that a port is
unreliable. It will shut down the line under the error condition is appears. The hub also acts like a
repeater.
There are three types of HUB-passive hub, active hub and intelligent hub. The Passive hubs do
not process data signals with only purpose to combine the signal form several networks cables
segments. All devices attached to the passive hub receive another packets that pass through the
hub .Hub does not clear up or amplify the signals, on the contrary absorbs a small part of the
signals that is why the distance between a hub and a computer should not be more than half of
the permissible distance between two computers. Passive hubs have limited functionality so are
inexpensive and easy to configure. It has four ports with four BNC (British Naval Connectors)
female connectors to configure networks station or terminated with a 93 BNC Terminator. The
active hubs incorporate electronic components that amplify and cleanup the signals, that flaw
between devices on the network. The process of cleaning up signal is called signal
regeneration. The benefits of signals regeneration are:
A network is more robust i.e. less sensitive errors.
Distance between devices can be increased.
Active hubs cost is considerable more than passive hub (active hub function impart as multiport
repeaters). Intelligent hubs are enhanced active hubs the following functions add intelligence to a
hub. Intelligent Hubs are units have form of integrated management capability. Hub
Management A hub supports networks network management protocols that enable the hub to
send packets to central network console. Theses protocols enable network console to manage or
control hub. Switching hubs include circuitry that quickly routes signals between ports on the
hub. Insured of repeating a packet to all ports on the hub, it repeats a packet only to the port that
connects to the destination computer for the packet.
SWITCHES
It is similar to a bridge, with some important enhancement. First, as witch may have multiple
ports, thus directing packets to several different segments further partitioning and isolating
network traffic in as way similar to router. For ex., if 8-port n way switch is there it can route
packets from any input to any output. Some or all of incoming packet is called store and forward,
which stores the received packet before examining it to for error before retransmitting. Bad
packets are not forwarded. A switch typically has auto-sensing 10/100 mbps ports and will just
the speed of each port accordingly; furthermore, a managed switch supports SNMP for further
control over network traffic. Switches operated at layer 2 (Data Link) of OSI model
Action/Display
ls
ls a
ls l
ls t
adduser
passwd
date
date +%m
date +%h
cal
who
ps
command > filename
cat > filename
cat >> filename
cat filename
wc filename
command1 | command2
echo $PATH
man command
echo message
tty
echo $HOME
pwd
mkdir dirname
cd dirname
cd
rmdir dirname
cp file1 file2
rm filename
mv file1 fil2
cmp file1 file2
comm file1 file2
gzip filename
gunzip zipfile
tar cvf filename.tar file1 file2
tar xvf filename.tar
zip filename.zip file1 file2
unzip filename.zip
chmod permission filename
head filename
tail filename
cut c columns filename
sort filename
grep option pattern filename(s)
ERROR DETECTION:
Error detection uses the concept of redundancy, which means adding extra bits for detecting errors at the
destination.
A parity bit, or check bit, is a bit added to the end of a string of binary code that indicates
whether the number of bits in the string with the value one is even or odd. Parity bits are used as
the simplest form of error detecting code.
There are two variants of parity bits: even parity bit and odd parity bit. In case of even parity,
the parity bit is set to 1 if the count of ones in a given set of bits (not including the parity bit) is
odd, making the count of ones in the entire set of bits (including the parity bit) even. If the count
of ones in a given set of bits is already even, it is set to a 0. When using odd parity, the parity bit
is set to 1 if the count of ones in a given set of bits (not including the parity bit) is even, making
the count of ones in the entire set of bits (including the parity bit) odd. When the count of set bits
is odd, then the odd parity bit is set to 0.
In parity check, a parity bit is added to every data unit so that the total number of 1s is even
(or odd for odd-parity).
Even-parity concept
printf("Original data\n");
for(i=1;i<r;i++)
printf("%d",b[i]);
}
else
printf("\nSingle bit error");
getch();
}
A checksum is a simple type of redundancy check that is used to detect errors in data.
Errors frequently occur in data when it is written to a disk, transmitted across a network or
otherwise manipulated. The errors are typically very small, for example, a single incorrect bit,
but even such small errors can greatly affect the quality of data, and even make it useless.
In its simplest form, a checksum is created by calculating the binary values in a packet or other
block of data using some algorithm and storing the results with the data. When the data is
retrieved from memory or received at the other end of a network, a new checksum is calculated
and compared with the existing checksum. A non-match indicates an error; a match does not
necessarily mean the absence of errors, but only that the simple algorithm was not able to detect
any.
getch();
}
}
else
{
arr[i] = arr[i]^gen[0];
arr[i+1]=arr[i+1]^gen[1];
arr[i+2]=arr[i+2]^gen[2];
arr[i+3]=arr[i+3]^gen[3];
}
}
printf("\nThe CRC is :");
for(i=n;i<a;++i)
printf("%d",arr[i]);
s=n+a;
for(i=n;i< s;i++)
q[i]=arr[i];
printf("\n");
printf("The data that is sent to the receiver side is:");
for(i=0;i< a;i++)
printf("%d",q[i]);
printf("\n");
printf("****************************************************************\nReceive
r side:");
printf("\nEnter the data that is sent along with the Cyclic Redundancy Code:" );
for(i=0;i<n+(g-1);i++)
scanf("%d",&q[i]);
for(i=0;i< n;++i)
{
if(q[i]==0)
{
for(j=i;j< g+i;++j)
q[j] = q[j]^0;
}
else
{
q[i] = q[i]^gen[0];
q[i+1]=q[i+1]^gen[1];
q[i+2]=q[i+2]^gen[2];
q[i+3]=q[i+3]^gen[3];
}
}
printf("\n\tThe CRC is :");
for(i=n;i < a;++i)
printf("%d",q[i]);
getch();
return 0;
}