KCS 653 Computer Networks Lab Manual-2021-2022 - N (1) - Removed
KCS 653 Computer Networks Lab Manual-2021-2022 - N (1) - Removed
Objective: To learn handling and configuration of networking hardware like RJ-45 connector, CAT-
6 cable and crimping tool etc.
Brief Theory
RJ 45- Registered Jack 45 (RJ45) is a standard type of physical connector for network cables. RJ45
connectors are most commonly seen with Ethernet cables and networks. Modern Ethernet cables
feature small plastic plugs on each end that are inserted into the RJ45 jacks of Ethernet devices.
CAT-6 Cable- Category 6 Cable (Cat 6), is a standardized twisted pair cable for Ethernet and other
network physical layers.
Crimping Tool- Crimping Tool is a device used to conjoin two pieces of metal by deforming one or
both of them in a way that causes them to hold each other.
Step 1. Start by stripping off about 2 inches of the plastic jacket off the end of the cable. Be very
careful at this point, as to not nick or cut into the wires, which are inside. Doing so could alterthe
characteristics of your cable, or even worse render is useless. Check the wires, one more time for nicks
or cuts. If there are any, just whack the whole end off, and start over.
Step 2. Spread the wires apart, but be sure to hold onto the base of the jacket with your other hand.
You do not want the wires to become untwisted down inside the jacket. Category 5 cable must only
have 1/2 of an inch of 'untwisted' wire at the end; otherwise it will be 'out of spec'. At this point, you
obviously have ALOT more than 1/2 of an inch of un-twisted wire.
Step 3. You have 2 end jacks, which must be installed on your cable. If you are using a pre-madecable,
with one of the ends whacked off, you only have one end to install - the crossed over end. Below are
two diagrams, which show how you need to arrange the cables for each type of cable end. Decide at
this point which end you are making and examine the associated picture below.
Diagrams for preparing Cross wired connection
Figure 1.2: Color coding sequence for RJ45 connectors at both ends in cross wired connection
Diagram for preparing straight through wired connection
Figure1.3: Straight through wired connection
Figure 1.4: Color coding sequence for RJ45 connectors at both ends in straight through wiredconnection
Result- Configuration of networking hardware like RJ-45 connector, CAT-6 cable, crimpingtool, etc. is
learned
Experiment-2
Objective: Configuration of router, hub, switch etc. (using real device or simulators)
Procedure:
Configuration of Hub using Star Topology
Step 1:- Open Cisco packet Tracer Software and choose Generic Hub on workspace.
Step 4:- Now select Simple Message(PDU) from right side of window and click over sendernode and on
receiver node.
Step 1:- Open Cisco packet Tracer Software and choose Generic Switch on workspace.
Configuration of Router
3. Global Configuration Mode to Fast Ethernet Interface Mode: Router (config)# interface
FastEthernet 0/0
Step 3: Now click on each end device and enter IP address such as 10.0.0.1 and label the device with
corresponding IP address using text tool available in cisco packet tracer. Be ensure that router should connect
two different networks
Figure 2.11:IP configuration in end devices
Step 4: Double click router and type router commands to configure router at interface fa0/0 andfa0/1
Router>enable Router#configure
terminal Router(config)#hostname R1
Router(config)#interface fastethernet 0/0
Router(config-if )# 10.0.0.1 255.0.0.0 Router(config-if
)# no shut down
Step 5 :- Now select Simple Message from right side of window and click over sender node andon receiver
node.
Procedure: In this experiment students must understand basic networking commands e.g. ping, tracert
etc.
All commands related to Network configuration which includes how to switch to privilege mode and
normal mode and how to configure router interface and how to save this configuration to flash memory
or permanent memory.
This commands includes
• Configuring the Router commands • General Commands to configure network • Privileged Mode
commands of a router • Router Processes & Statistics • IP Commands • Other IP Command e.g. show ip
route etc.
ping:
Verifies IP-level connectivity to another TCP/IP computer by sending Internet Control Message Protocol
(ICMP) Echo Request messages. The receipt of corresponding Echo Reply messages is displayed, along
with round-trip times. Ping is the primary TCP/IP command used to troubleshoot connectivity,
reachability, and name resolution.
You can use ping to test both the computer name and the IP address of the computer. If pingingthe IP
address is successful, but pinging the computer name is not, you might have a name resolution problem.
In this case, ensure that the computer name you are specifying can be resolved through the local Hosts
file, by using Domain Name System (DNS) queries, or through NetBIOS name resolution techniques.
Traceroute:
Determines the path taken to a destination by sending Internet Control Message Protocol(ICMP)
Echo Request messages to the destination with incrementally increasing Time to Live
(TTL) field values. The path displayed is the list of near-side router interfaces of the routers inthe path
between a source host and a destination. The near-side interface is the interface of therouter that is closest
to the sending host in the path. Used without parameters, tracert displays help.
To trace the path to the host named www.google.co.in use following commandtracert
www.google.co.in
Arp
Displays and modifies entries in the Address Resolution Protocol (ARP) cache, which containsone or more
tables that are used to store IP addresses and their resolved Ethernet or Token Ringphysical addresses.
There is a separate table for each Ethernet or Token Ring network adapterinstalled on your computer.
To display the ARP cache tables for all interfaces use following command
arp -a
Nslookup (stands for “Name Server Lookup”) is a useful command for getting information from DNS
server. It is a network administration tool for querying the Domain Name System (DNS) to obtain domain
name or IP address mapping or any other specific DNS record. It is also used to troubleshoot DNS related
problems.
Netstat
Displays active TCP connections, ports on which the computer is listening, Ethernet statistics,the IP
routing table, IPv4 statistics (for the IP, ICMP, TCP, and UDP protocols), and IPv6 statistics (for the
IPv6, ICMPv6, TCP over IPv6, and UDP over IPv protocols).
Experiment No - 4
Objective:-Network simulation using tools like Cisco Packet Tracer, NetSim, OMNeT++,NS2, NS3,
etc.
Brief Theory-
Cisco Packet Tracer- Packet Tracer allows users to create simulated network topologies by dragging
and dropping routers, switches and various other types of network devices. A physical connection
between devices is represented by a 'cable' item. Cisco Systems claims
that Packet Tracer is useful for network experimentation.
NetSim-NetSim is an end-to-end, full stack, packet level network simulator and emulator. It provides
network engineers with a technology development environment for protocol modeling, network R&D
and military communications.
A network simulator enables users to virtually create a network comprising of devices, links, applications
etc, and study the behavior and performance of the Network.
Figure 5.2 NetSim Enviroment
Some example applications of network simulators are
Building the model – Create a network with devices, links, applications etc
Running the simulation - Run the discrete event simulation (DES) and log different
performance metrics
Visualizing the simulation - Use the packet animator to view the flow of packets
Analyzing the results - Examine output performance metrics such as throughput, delay, lossetc. at
multiple levels - network, link, queue, application etc.
Developing your own protocol / algorithm - Extend existing algorithms by modifying the
simulator’s source C code
OMNeT++ -OMNeT++ (Objective Modular Network Testbed in C++)is a modular, component-based
C++ simulation library and framework, primarily for building network simulators.OMNeT++ itself is a
simulation framework without models for network protocols like IP or HTTP. The main computer
network simulation models are available in several external frameworks. The most commonly used one
is INETwhich offers a variety of models for all kind of network protocols and technologies like for IPv6,
BGP etc. INET also offers a set of mobility models to simulate the node movement in simulations. The
INET models are licensed under the LGPL or GPL.
Components
NS2- NS2 stands for Network Simulator Version 2. It is an open-source event-driven simulator designed
specifically for research in computer communication networks.Ns2 is an event driven simulator, which
is a open source simulator mainly used for academic research in the areas of Computer Networks,
MANETs, WSNs.NS-2 can be used to implementnetwork protocols such as TCP and UPD, traffic source
behavior such as FTP, Telnet, Web, CBR and VBR, router queue management mechanism such as Drop
Tail, RED and CBQ, routing algorithms and many more. In ns2, C++ is used for detailed protocol
implementation and Otcl is used for the setup.
Features of NS2
2. It provides substantial support to simulate bunch of protocols like TCP, FTP, UDP, httpsand DSR.
NS2 consists of two key languages: C++ and Object-oriented Tool Command Language (OTcl). While
the C++ defines the internal mechanism (i.e., a backend) of the simulation objects, the OTcl sets up
simulation by assembling and configuring the objects as well as scheduling discrete events. The C++ and
the OTcl are linked together using TclCL
NS3- Computer network simulation in the sense connection of two or more computer system linked
together for communication. Networking is the practice of interfacing two or more computing devices
with each other for the purpose of sharing data. Computer networks are built with a combination of
hardware and software.ns-3 is a discrete-event network simulator,targeted primarily for research and
educational use. ns-3 is free software, licensed under the GNU GPLv2 license, and is publicly available
for research, development, and use.
NS-3 is intended to provide better support than in NS-2 for the following items:
• Modularity of components
• Scalability of simulations
• Integration/reuse of externally developed code and software utilities
• Emulation
• Tracing and statistics
• Validation
Result- Network simulation is done using tools like Cisco Packet Tracer, NetSim, OMNeT++,NS2, NS3,
etc.
Experiment – 5
Objective: Configure and connect two PCs using Crossover and Straight forward wire
connection.
Apparatus required (Software): Cisco packet Tracer
Flow Chart:
Browse command prompt and enter ping the other side PCs Ip
address
Pc to Pc connection
established
Procedure:
Step1: Select two end devices (PC, laptop, etc)
Move the cursor to the left corner of environment window and select the option afterclick on
end device PC0 and PC1.
Step2: Connect the end devices via appropriate wire (Cross over or straight forward)
Take straight forward wire and connect switch with PCs through switch. Take crossover wire
to directly connect with other PC.
Figure 7.2 Straight Forward connection for 2 PCs
Step4: Browse command prompt and enter ping the other side PCs Ip address
Go to command prompt of any one of PCs and then enter command Ping IP addressof other
PCS.
Step5: Check on the reply if it appears then ok.
After entering ping if reply shows then connection successfully established.
Objective: Configure a DNS server in along with existing network using Cisco PacketTracer.
Flow Chart:
Take one more HTTP server and add one website on that.
DNS Configuration
Successful
Procedure:
Step1: Select two end devices (PC, laptop, etc)
Move the cursor to the left corner of environment window and select the option afterclick on
end device PC0 and PC1.
Step2: Connect the end devices with server via intermediate switch
Take straight forward wire and connect switch with PCs and Server through switch.
Step3: Take one more HTTP server and add one website on that.
Select HTTP server after assigning IP address move connect it with same switch andnetwork.
After that go on services and add HTTP html pages of the website.
Step4: Add domain name and map it with logical address on DNS server.
On DNS server go to services and select DNS service add here domain name ofwebsite
and map it with IP address.
Step5: Check on the web browser after entering the website domain name inside URL. Go and
check on any one of the web browser and then if website is showing then it issuccessful.
Flow Chart:
Compose mail from any one user to another user over the
network
Email Configuration
Successful
Step2: Connect the end devices with email server via intermediate switch
Take straight forward wire and connect switch with PCs and Server through switch.
Step3: Take one more server and add one website on that.
Select server after assigning IP address move connect it with same switch andnetwork.
After that go on services and add HTTP html pages of the website.
Step4: Register users (PCs) email address and Password on email server.
On email server go to services and select email service register here users IDpassword.
Step5: Compose mail from any one user to another user over the network
Go and check on any one user side after composing an email for another user and thenSend it.
Step6: Check at receiver side if the same mail is appearing.
Go and check on receiving user side if same email have been received then ok.
Output:
Experiment No. 10
Objective: Write a Program to compute Hamming Distance between Two Data word
Theory:
You are given two strings of equal length, you have to find the Hamming Distancebetween these string.
Where the Hamming distance between two strings of equal length is the number of positions at which the
corresponding character are different.
Program:
OUTPUT:
enter the length of data code 6 enter the sender
side data code
1
0
0
Hamming distance is 2
Experiment No. 11
Objective: Write a program for error detecting code using CRC-CCITT (16-bits).
Theory-
It does error checking via polynomial division. In general, a bit string bn-1bn-
2bn-3…b2b1b0 As bn-1Xn-1+ bn-2 Xn-2+ bn-3 Xn-3+ …b2 X2+ b1 X1+ b0
Algorithm:-
1. Given a bit string, append 0S to the end of it (the number of 0s is the same as the degree of the
generator polynomial) let B(x) be the polynomial corresponding to B.
2. Divide B(x) by some agreed on polynomial G(x) (generator polynomial) and determine the
remainder R(x). This division is to be done using Modulo 2 Division.
3. Define T(x) = B(x) –R(x)
(T(x)/G(x) => remainder 0)
4. Transmit T, the bit string corresponding to T(x).
5. Let T’ represent the bit stream the receiver gets and T’(x) the associated polynomial. The
receiver divides T1(x) by G(x). If there is a 0 remainder, the receiver concludes T = T’ and no error
occurred otherwise, the receiver concludes an error occurred and requires a retransmission.
Program :
#include<stdio.h>
#include<string.h>
#include<conio.h> #define N
strlen(g)
char t[128], cs[128], g[]="10001000000100001"; int a, e, c;
void xor()
{
for(c=1;c<N;c++) cs[c]=((cs[c]==g[c])?'0':'1');
} void crc()
{
for(e=0;e<N;e++) cs[e]=t[e]; do {
if(cs[0]=='1') xor();
for(c=0;c<N-1;c++) cs[c]=cs[c+1];
cs[c]=t[e++];
}while(e<=a+N-1);
}
void main() { clrscr(); printf("\nEnter poly : ");
scanf("%s",t); printf("\nGenerating Polynomial is :
%s",g);
a=strlen(t); for(e=a;e<a+N-1;e++)
t[e]='0';
printf("\nModified t[u] is : %s",t); crc();
printf("\nChecksum is : %s",cs); for(e=a;e<a+N-
1;e++) t[e]=cs[e-a]; printf("\nFinal Codeword is : %s",t);
printf("\nTest Error detection 0(yes) 1(no) ? : ");
scanf("%d",&e);
if(e==0) {
printf("Enter position where error is to inserted : ");
scanf("%d",&e);
t[e]=(t[e]=='0')?'1':'0'; printf("Errorneous data :
%s\n",t);
}
crc();
for (e=0;(e<N-1)&&(cs[e]!='1');e++); if(e<N-
1) printf("Error detected."); else printf("No
Error Detected."); getch(); }
OUTPUT :
Enter poly : 1011101
Generating Polynomial is : 10001000000100001
Modified t[u] is : 10111010000000000000000
Checksum is : 1000101101011000
Final Codeword is : 10111011000101101011000
Test Error detection 0(yes) 1(no) ? : 0
Enter position where you want to insert error : 3 Errorneous data
: 10101011000101101011000 Error detected.
Enter poly : 1011101
Generating Polynomial is : 10001000000100001
Modified t[u] is : 10111010000000000000000
Checksum is : 1000101101011000
Final Codeword is : 10111011000101101011000 Test Error
detection 0(yes) 1(no) ? : 1 No Error Detected.
Experiment No. 12
Objective: To write a program to Implement Hamming Code
Theory:
Hamming code is a popular error detection and error correction method in data communication. Hamming
code can only detect 2 bit error and correct a single bit error which means it is unable to correct burst errors
if may occur while transmission of data.
Program:
#include<stdio.h>
voidmain(){
intdata[10];
intdataatrec[10],c,c1,c2,c3,i;
printf("Enter 4 bits of data one by one\n");
scanf("%d",&data[0]);
scanf("%d",&data[1]);
scanf("%d",&data[2]);
scanf("%d",&data[4]);
c1=dataatrec[6]^dataatrec[4]^dataatrec[2]^dataatrec[0];
c2=dataatrec[5]^dataatrec[4]^dataatrec[1]^dataatrec[0];
c3=dataatrec[3]^dataatrec[2]^dataatrec[1]^dataatrec[0];
c=c3*4+c2*2+c1;
if(c==0){
printf("\nNo error while transmission of data\n");
}
else{
printf("\nError on position %d",c);