CN Lab Manual R18
CN Lab Manual R18
CSE I-Sem
Course Objectives
Course Outcomes
1. Implement data link layer farming methods
2. Analyze error detection and error correction codes.
3. Implement and analyze routing and congestion issues in network design.
4. Implement Encoding and Decoding techniques used in presentation layer
5. To be able to work with different network tools
List of Experiments
1. Implement the data link layer framing methods such as character, character-stuffing and bit stuffing.
2. Write a program to compute CRC code for the polynomials CRC-12, CRC-16 and CRC CCIP
3. Develop a simple data link layer that performs the flow control using the sliding window protocol, and
loss recovery using the Go-Back-N mechanism.
4. Implement Dijsktra’s algorithm to compute the shortest path through a network
5. Take an example subnet of hosts and obtain a broadcast tree for the subnet.
6. Implement distance vector routing algorithm for obtaining routing tables at each node.
7. Implement data encryption and data decryption
8. Write a program for congestion control using Leaky bucket algorithm.
9. Write a program for frame sorting technique used in buffers.
10. Wireshark
i. Packet Capture Using Wire shark
ii. Starting Wire shark
iii. Viewing Captured Traffic
iv. Analysis and Statistics & Filters.
11. How to run Nmap scan
12. Operating System Detection using Nmap
13. Do the following using NS2 Simulator
i. NS2 Simulator-Introduction
ii. Simulate to Find the Number of Packets Dropped
iii. Simulate to Find the Number of Packets Dropped by TCP/UDP
iv. Simulate to Find the Number of Packets Dropped due to Congestion
v. Simulate to Compare Data Rate& Throughput.
vi. Simulate to Plot Congestion for Different Source/Destination
vii. Simulate to Determine the Performance with respect to Transmission of Packets
1. Implement the data link layer framing methods such as character, character-stuffing and bit
stuffing.
// CHARACTER STUFFING PROGRAM
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<process.h>
void main()
int i=0,j=0,n,pos;
char a[20],b[50],ch;
clrscr();
printf("enter string\n");
scanf("%s",&a);
n=strlen(a);
printf("enter position\n");
scanf("%d",&pos);
if(pos>n)
scanf("%d",&pos);
scanf("%s",&ch);
b[0]='d';
b[1]='l';
b[2]='e';
b[3]='s';
b[4]='t';
b[5]='x';
j=6;
while(i<n)
if(i==pos-1)
b[j]='d';
b[j+1]='l';
b[j+2]='e';
b[j+3]=ch;
b[j+4]='d';
b[j+5]='l';
b[j+6]='e';
j=j+7;
b[j]='d';
b[j+1]='l';
b[j+2]='e';
j=j+3;
b[j]=a[i];
i++;
j++;
b[j]='d';
b[j+1]='l';
b[j+2]='e';
b[j+3]='e';
b[j+4]='t';
b[j+5]='x';
b[j+6]='\0';
printf("%s",b);
getch();
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
int a[20],b[30],i,j,k,count,n;
clrscr();
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
while(i<n)
if(a[i]==1)
b[j]=a[i];
j++;
b[j]=a[k];
count++;
if(count==5)
j++;
b[j]=0;
i=k;
}}
else
b[j]=a[i];
i++;
j++;
for(i=0;i<j;i++)
printf("%d",b[i]);
getch();
}
2. Write a program to compute CRC code for the polynomials CRC-12, CRC-16 and CRC CCIP
#include<stdio.h>
#include<conio.h>
remainder(int fr[]);
int gen[4],genl,frl,rem[4];
void main()
int i,j,fr[8],dupfr[11],recfr[11],tlen,flag;
clrscr();
frl=8; genl=4;
printf("enter frame:");
for(i=0;i<frl;i++)
scanf("%d",&fr[i]);
dupfr[i]=fr[i];
printf("enter generator:");
for(i=0;i<genl;i++)
scanf("%d",&gen[i]);
tlen=frl+genl-1;
for(i=frl;i<tlen;i++)
dupfr[i]=0;
remainder(dupfr);
for(i=0;i<frl;i++)
{
recfr[i]=fr[i];
for(i=frl,j=1;j<genl;i++,j++)
recfr[i]=rem[j];
remainder(recfr);
flag=0;
for(i=0;i<4;i++)
if(rem[i]!=0)
flag++;
if(flag==0)
else
getch();
remainder(int fr[])
int k,k1,i,j;
for(k=0;k<frl;k++)
if(fr[k]==1)
{
k1=k;
for(i=0,j=k;i<genl;i++,j++)
rem[i]=fr[j]^gen[i];
for(i=0;i<genl;i++)
fr[k1]=rem[i];
k1++;
}
3. Develop a simple data link layer that performs the flow control using the sliding window
protocol, and loss recovery using the Go-Back-N mechanism.
#include<stdio.h>
int main()
{
int w,i,f,frames[50];
for(i=1;i<=f;i++)
scanf("%d",&frames[i]);
printf("\nWith sliding window protocol the frames will be sent in the following manner (assuming no corruption
of frames)\n\n");
printf("After sending %d frames at each stage sender waits for acknowledgement sent by the receiver\n\n",w);
for(i=1;i<=f;i++)
{
if(i%w==0)
{
printf("%d\n",frames[i]);
printf("Acknowledgement of above frames sent is received by sender\n\n");
}
else
printf("%d ",frames[i]);
}
if(f%w!=0)
printf("\nAcknowledgement of above frames sent is received by sender\n");
return 0;
}
4. Implement Dijsktra’s algorithm to compute the shortest path through a network
#include<stdio.h>
#include<conio.h>
void main()
int path[5][5],i,j,min,a[5][5],p,st=1,ed=5,stp,edp,t[5],index;
clrscr();
for(i=1;i<=5;i++)
for(j=1;j<=5;j++)
scanf("%d",&a[i][j]);
scanf("%d",&p);
for(i=1;i<=p;i++)
for(j=1;j<=5;j++)
scanf("%d",&path[i][j]);
for(i=1;i<=p;i++)
t[i]=0;
stp=st;
for(j=1;j<=5;j++)
edp=path[i][j+1];
t[i]=t[i]+a[stp][edp];
if(edp==ed)
break;
else
stp=edp;
}
min=t[st];index=st;
for(i=1;i<=p;i++)
if(min>t[i])
min=t[i];
index=i;
for(i=1;i<=5;i++)
printf("--> %d",path[index][i]);
if(path[index][i]==ed)
break;
getch();
}
5. Take an example subnet of hosts and obtain a broadcast tree for the subnet.
#include<stdio.h>
int a[10][10],n;
void main()
{
int i,j,root;
output:
Enter adjacent matrix
1
Enter connecting of 1>2::1
2
6. Implement distance vector routing algorithm for obtaining routing tables at each node.
#include<stdio.h>
struct node
{
unsigned dist[20];
unsigned from[20];
}rt[10];
int main()
{
int dmat[20][20];
int n,i,j,k,count=0;
printf("\nEnter the number of nodes : ");
scanf("%d",&n);
printf("\nEnter the cost matrix :\n");
for(i=0;i<n;i++)
for(j=0;j<n;j++)
{
scanf("%d",&dmat[i][j]);
dmat[i][i]=0;
rt[i].dist[j]=dmat[i][j];
rt[i].from[j]=j;
}
do
{
count=0;
for(i=0;i<n;i++)
for(j=0;j<n;j++)
for(k=0;k<n;k++)
if(rt[i].dist[j]>dmat[i][k]+rt[k].dist[j])
{
rt[i].dist[j]=rt[i].dist[k]+rt[k].dist[j];
rt[i].from[j]=k;
count++;
}
}while(count!=0);
for(i=0;i<n;i++)
{
printf("\n\nState value for router %d is \n",i+1);
for(j=0;j<n;j++)
{
printf("\t\nnode %d via %d Distance%d",j+1,rt[i].from[j]+1,rt[i].dist[j]);
}
}
printf("\n\n");
}
output:
Enter the number of nodes : 3
1 2 3
4 5 6
7 8 9
#include <stdio.h>
int main()
{
int i, x;
char str[100];
case 2:
for(i = 0; (i < 100 && str[i] != '\0'); i++)
str[i] = str[i] - 3; //the key for encryption is 3 that is subtracted to ASCII value
default:
printf("\nError\n");
}
return 0;
}
output:
for encryption:
Please enter a string: hi
Encrypted string: kl
for decryption:
Please enter a string: kl
Decrypted string: hi
8. Write a program for congestion control using Leaky bucket algorithm.
#include<stdio.h>
int main(){
int incoming, outgoing, buck_size, n, store = 0;
printf("Enter bucket size, outgoing rate and no of inputs: ");
scanf("%d %d %d", &buck_size, &outgoing, &n);
while (n != 0) {
printf("Enter the incoming packet size : ");
scanf("%d", &incoming);
printf("Incoming packet size %d\n", incoming);
if (incoming <= (buck_size - store)){
store += incoming;
printf("Bucket buffer size %d out of %d\n", store, buck_size);
} else {
printf("Dropped %d no of packets\n", incoming - (buck_size - store));
printf("Bucket buffer size %d out of %d\n", store, buck_size);
store = buck_size;
}
store = store - outgoing;
printf("After outgoing %d packets left out of %d in buffer\n", store,
buck_size);
n--;
}
}
output:
Enter bucket size, outgoing rate and no of inputs: 10
10
Dropped 2 no of packets
After outgoing -
2 packets left out of 10 in buffer
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct frame
{
int sno;
char msg[15];
int flag;
};
int main()
{
int i,j,n,r,k;
printf("enter no of frames\n");
scanf("%d",&n);
struct frame fr[n];
int s[n];
for(i=0;i<n;i++)
{
s[i]=-1;
fr[i].sno=-1;
}
printf("enter the message \n");
for(i=0;i<n;i++)
{
scanf("%s",fr[i].msg);
fr[i].sno=i;
}
for(j=0;j<n;j++)
{
r=rand()%n;
if(s[r]==-1)
{
fr[j].flag=r;
s[r]=1;
}
else if(s[r]==1)
{
for(k=0;k<n;k++){
r=k;
if(s[r]==-1)
{
fr[j].flag=r;
s[r]=1;
break;
}
}
}
}
output:
enter no of frames
today
you
have
to
go
sno msg
3 to
1 you
2 have
0 today
4 go
sno msg
0 today
1 you
2 have
3 to
4 go
10. Wireshark
i. Packet Capture Using Wire shark
ii. Starting Wire shark
iii. Viewing Captured Traffic
iv. Analysis and Statistics & Filters.
1. Click View > Wireless Toolbar. The Wireless Toolbar will appear just below the Main
toolbar.
2. Use the Wireless Toolbar to configure the desired channel and channel width.
3. Under Capture, click on AirPcap USB wireless capture adapter to select the capture
interface.
Note: If the AirPcap isn't listed, press F5 to refresh the list of available packet capture
interfaces.
Note: The AirPcap has been discontinued by RiverBed and is 802.11n only.
Note: .Pcap and .Pcap-ng are good filetypes to use for the capture if you plan to use Eye
P.A. to open the capture.
3. Eye P.A. can now open the capture file.
11. How to run Nmap scan
1. Download the Nmap installer. This can be found for free from the developer’s website. It is
highly recommended that you download directly from the developer to avoid any potential
viruses or fake files. Downloading the Nmap installer includes Zenmap, the graphical interface
for Nmap which makes it easy for newcomers to perform scans without having to learn
command lines.
The Zenmap program is available for Windows, Linux, and Mac OS X. You can find the
installation files for all operating systems on the Nmap website.
2.Install Nmap. Run the installer once it is finished downloading. You will be asked which
components you would like to install. In order to get the full benefit of Nmap, keep all of these
checked. Nmap will not install any adware or spyware.
3. Run the “Nmap – Zenmap” GUI program. If you left your settings at default during
installation, you should be able to see an icon for it on your desktop. If not, look in your Start
menu. Opening Zenmap will start the program.
4. Enter in the target for your scan. The Zenmap program makes scanning a fairly simple
process. The first step to running a scan is choosing your target. You can enter a domain
(example.com), an IP address (127.0.0.1), a network (192.168.1.0/24), or a combination of those.
Depending on the intensity and target of your scan, running an Nmap scan may be against
the terms of your internet service provider, and may land you in hot water. Always
check your local laws and your ISP contract before performing Nmap scans on targets
other than your own network.
5. Choose your Profile. Profiles are preset groupings of modifiers that change what is scanned.
The profiles allow you to quickly select different types of scans without having to type in the
modifiers on the command line. Choose the profile that best fits your needs:[1]
6. Click Scan to start scanning. The active results of the scan will be displayed in the Nmap
Output tab. The time the scan takes will depend on the scan profile you chose, the physical
distance to the target, and the target’s network configuration.
7. Read your results. Once the scan is finished, you’ll see the message “Nmap done” at the
bottom of the Nmap Output tab. You can now check your results, depending on the type of scan
you performed. All of the results will be listed in the main Nmap Output tab, but you can use the
other tabs to get a better look at specific data.[2]
Ports/Hosts - This tab will show the results of your port scan, including the services
for those ports.
Topology - This shows the traceroute for the scan you performed. You can see how
many hops your data goes through to reach the target.
Host Details - This shows a summary of your target learned through scans, such as
the number of ports, IP addresses, hostnames, operating systems, and more.
Scans - This tab stores the commands of your previously-run scans. This allows you
to quickly re-scan with a specific set of parameters.
12. Operating System Detection using Nmap
Nmap, short for Network Mapper, is a network discovery and security auditing tool. It is known
for its simple and easy to remember flags that provide powerful scanning options. Nmap is
widely used by network administrators to scan for:
Let’s move ahead in this nmap tutorial and discuss the various types of scans.
A variety of scans can be performed using Nmap. Below are the types of scans:
TCP SCAN
A TCP scan is generally used to check and complete a three-way handshake between you and a
chosen target system. A TCP scan is generally very noisy and can be detected with almost little
to no effort. This is “noisy” because the services can log the sender IP address and might trigger
Intrusion Detection Systems.
UDP SCAN
UDP scans are used to check whether there is any UDP port up and listening for incoming
requests on the target machine. Unlike TCP, UDP has no mechanism to respond with a positive
acknowledgment, so there is always a chance for a false positive in the scan results. However,
UDP scans are used to reveal Trojan horses that might be running on UDP ports or even reveal
hidden RPC services. This type of scan tends to be quite slow because machines, in general, tend
to slow down their responses to this kind of traffic as a precautionary measure.
SYN SCAN
This is another form of TCP scan. The difference is unlike a normal TCP scan, nmap itself crafts
a syn packet, which is the first packet that is sent to establish a TCP connection. What is
important to note here is that the connection is never formed, rather the responses to these
specially crafted packets are analyzed by Nmap to produce scan results.
ACK SCAN
ACK scans are used to determine whether a particular port is filtered or not. This proves to be
extremely helpful when trying to probe for firewalls and their existing set of rules. Simple packet
filtering will allow established connections (packets with the ACK bit set), whereas a more
sophisticated stateful firewall might not.
FIN SCAN
Also a stealthy scan, like the SYN scan, but sends a TCP FIN packet instead. Most but not all
computers will send an RST packet (reset packet) back if they get this input, so the FIN scan can
show false positives and negatives, but it may get under the radar of some IDS programs and
other countermeasures.
NULL SCAN
Null scans are extremely stealthy scan and what they do is as the name suggests — they set all
the header fields to null. Generally, this is not a valid packet and a few targets will not know how
to deal with such a packet. Such targets are generally some version of windows and scanning
them with NULL packets may end up producing unreliable results. On the other hand, when a
system is not running windows this can be used as an effective way to get through.
XMAS SCAN
Just like null scans, these are also stealthy in nature. Computers running windows will not
respond to Xmas scans due to the way their TCP stack is implemented. The scan derives its name
from the set of flags that are turned on within the packet that is sent out for scanning. XMAS
scans are used to manipulate the PSH, URG and FIN flags that can be found in the TCP header.
RPC SCAN
RPC scans are used to discover machines that respond to Remote Procedure Call services (RPC).
RPC allows commands to be run on a certain machine remotely, under a certain set of
connections. RPC service can run on an array of different ports, hence, it becomes hard to infer
from a normal scan whether RPC services are running or not. It is generally a good idea to run an
RPC scan from time to time to find out where you have these services running.
IDLE SCAN
IDLE scan is the stealthiest of all scans discussed in this nmap tutorial, as the packets are
bounced off an external host. Control over the host is generally not necessary, but the host needs
to meet a specific set of conditions. It is one of the more controversial options in Nmap since it
only has a use for malicious attacks.
Nmap Commands
In this section of Nmap Tutorial, I’ll be listing down the various commands you can use in Nmap
along with their flag and usage description with an example on how to use it.
Scanning Techniques
Host Discovery
rt Specification
NSE Scripts
i . SIMULATION-INTRODUCTION
Simulation is only of use if the results are accurate, an inaccurate simulator is not useful
at all. Most network simulators use abstractions of network protocols, rather than the real thing,
making their results less convincing. S.Y. Wang reports that the simulator OPNET uses a
simplified finite state machine to model complex TCP protocol processing. [19] NS-2 uses a
model based on BSD TCP, it is implemented as a set of classes using inheritance. Neither uses
protocol code that is used in real world networking
1. Set up environment variables: Before the user can run up the dispatcher, coordinator, or
NCTUns GUI program he/she must set up the NCTUNSHOME environment variable.
2. Start up the dispatcher on terminal 1.
3. Start up the coordinator on terminal 2.
4. Start up the NCTUns client on terminal 3.
After the above steps are followed, the starting screen of NCTUns disappears and the user is
presented with the working window as shown below:
Drawing A Network Topology
To draw a new network topology, a user can perform the following steps:
Choose Menu->File->Operating Mode-> and make sure that the “Draw Topology” mode is
checked. This is the default mode of NCTUns when it is launched. It is only in this mode that a
user can draw a new network topology or change an existing simulation topology. When a user
switches the mode to the next mode “Edit Property”, the simulation network topology can no
longer be changed.
Therefore the application programs now may use wrong IP addresses to communicate with their
partners.
When a user finishes editing the properties of network nodes and specifying application
programs to be executed during a simulation, he/she can start running the simulation.
1. In order to do so, the user must switch mode explicitly from “Edit Property” to “Run
Simulation”. Entering this mode indicates that no more changes can (should) be made to the
simulation case, which is reasonable. This simulation is about to be started at this moment; of
course, any of its settings should be fixed.
2. Whenever the mode is switched to the “ Run Simulation” mode, the many simulation files
that collectively describe the simulation case will be exported. These simulation files will be
transferred to the (either remote or local) simulation server for it to execute the simulation.
These files are stored in the “ main File Name.sim” directory, where main Filename is the
name of the simulation case chosen in the “Draw Topology” mode.
After the simulation is finished, the simulation server will send back the simulation
result files to the GUI program after receiving these files, the GUI program will store these
files in the “results directory” .It will then automatically switch to “play back mode”.
1. These files include a packet animation trace file and all performance log files that the user
specifies to generate. Outputting these performance log files can be specified by checking
some output options in some protocol modules in the node editor. In addition to this,
application programs can generate their own data files.
2. The packet animation trace file can be replayed later by the packet animation player. The
performance curve of these log files can be plotted by the performance monitor.
Post Analysis
1. When the user wants to review the simulation results of a simulation case that has been
finished before, he /she can run up the GUI program again and then open the case's topology
file.
2. The user can switch the mode directly to the “Play Back” mode. The GUI program will then
automatically reload the results (including the packet animation trace file and performance log
file.
3. After the loading process is finished, the user can use the control buttons located at the bottom
of the screen to view the animation.
Simulation Commands
Reconnect: The Reconnect command can be executed to reconnect to a simulation job that was
previously disconnected. All disconnected jobs that have not finished their simulations or
have finished their simulations but the results have not been retrieved back to be a GUI
program by the user will appear in a session table next to the “Reconnect” command. When
executing the reconnect command, a user can choose a disconnected job to reconnect from
this session table.
Disconnect: Disconnect the GUI from the currently running simulation job. The GUI now can
be used to service another simulation job. A disconnected simulation will be given a session
name and stored in a session table.
ii . Simulate to Find the Number of Packets Dropped
AIM:
Simulate a three-node point-to-point network with a duplex link between them. Set the queue size
and vary the bandwidth and find the number of packets dropped.
2. Select/click the HUB icon on the toolbar and click the left mouse button on the editor, to place
HUB1 on the editor.
3. Click on the LINK icon on the toolbar and connect HOST1 to HUB1 and HUB1 to HOST2
4. Click on the “E” icon on the toolbar to save the current topology
e.g: file1.tpl (Look for the ******.tpl extension.)
NOTE: Changes cannot / (should not) be done after selecting the “E” icon
Step2: Configuration
1. Double click the left mouse button while cursor is on HOST1 to open the HOST window.
2. Select Add button on the HOST window to invoke the command window and provide the
following command in the command textbox.
stg –u 1024 100 1.0.1.2
3. Click OK button on the command window to exit and once again click on the OK button on the
HOST window to exit.
4. Double click the left mouse button while cursor is on HOST2 to open the HOST window.
5. Select Add button on the HOST window to invoke the command window and provide the
following command in the command textbox.
rtg –u –w log1
7. Click NODE EDITOR Button on the HOST window and select the MAC tab from the modal
window that pops up.
8. Select LOG STATISTICS and select checkboxes for Number of Drop Packet and Number of
Collisions in the MAC window
9. Click OK button on the MAC window to exit and once again click on the OK button on the
HOST window to exit.
2. Click NODE EDITOR Button on the HOST window and select the FIFO tab from the modal
window that pops up.
4. Click OK button on the FIFO window to exit and once again click on the OK button on the
HOST window to exit.
Step3: Simulate
i. Click “R” icon on the tool bar
ii. Select Simulation in the menu bar and click/ select RUN in the dropdown list to execute the
simulation.
iii. venTo start playback select “►” icon located at the bottom right corner of the editor.
iv. To view results, Open up new TERMINAL window, move to file1.results folder and open
collision and drop log files in separate TERMINAL window.
Changing configurations
Change 1
1. Open the above file,
2. Do not change the topology or any other configuration,
3. Select E icon on the toolbar
4. Reduce the bandwidth at link2 by double clicking the left mouse button while cursor is on
link2 .(Change bandwidth on both tabs Uplink/Downlink)
5. Repeat Step3 (Simulate)
Change 2
1. Open the above file,
2. Remove HUB and replace it with SWITCH.
3. Do not change anything in the configuration
Repeat Step3(Simulate)
iii. Simulate to Find the Number of Packets Dropped by TCP/UDP
AIM:
Simulate a four-node point-to-point network and connect the link as follows: Apply a TCP agent
between n0 to n3 and apply a UDP agent between n1 and n3. Apply relevant applications over
TCP and UDP agents changing the parameters and determine the number of packets sent by two
agents.
Topology:-
Sender:-
stcp –p 3000 –l 1024 1.0.1.3
stg –u 1024 1.0.1.3
Receiver:-
rtcp –p 3000 –l 1024
rtg –u 3000
Parameters:-
Throughput of incoming and outgoing Packets
2. Select Add button on the HOST window to invoke the command window and provide the
following command in the command textbox.
stcp –p 21 –l 1024 1.0.1.3
4. Click NODE EDITOR Button on the HOST window and select the MAC tab from the modal
window that pops up.
5. Select LOG STATISTICS and select checkbox for output throughput in the MAC window
6. Click OK button on the MAC window to exit and once again click on the OK button on the
HOST window to exit.
7. Double click the left mouse button while cursor is on HOST2 to open the HOST window.
8. Select Add button on the HOST window to invoke the command window and provide the
following command in the command textbox.
stg –u 1024 100 1.0.1.3
10. Click NODE EDITOR Button on the HOST window and select the MAC tab from the modal
window that pops up.
11. Select LOG STATISTICS and select checkbox for output throughput in the MAC window
12. Click OK button on the MAC window to exit and once again click on the OK button on the
HOST window to exit
13. Double click the left mouse button while cursor is on HOST3 to open the HOST window.
14. Select Add button on the HOST window to invoke the command window and provide the
following command in the command textbox.
rtcp –p 21 –l 1024
17. Click NODE EDITOR Button on the HOST window and select the MAC tab from the modal
window that pops up.
18. Select LOG STATISTICS and select checkbox for input and output throughput in the MAC
window
19. Click OK button on the MAC window to exit and once again click on the OK button on the
HOST window to exit.
Step3: Simulate
i. Click “R” icon on the tool bar
ii. Select Simulation in the menu bar and click/ select RUN in the dropdown list to execute the
simulation.
iii. To start playback select “►” icon located at the bottom right corner of the editor.
iv. To view results, Open up new TERMINAL window, move to file2.results folder and open
input and output throughput log files in separate TERMINAL window.
Caution: file2 is the hypothetical name given to this simulation.
(Refer Step 1.4)
iv. Simulate to Find the Number of Packets Dropped due to Congestion
AIM:
Simulate the transmission of ping messages over a network topology consisting of 6 nodes
and find the number of packets dropped due to congestion.
Topology:-
Sender:-
stcp –p 2000 –l 1024 1.0.1.4
Receiver:-
rtcp –p 2000 –l 1024
Command Console:-
Goto tools-> simulation time and change Simulation time to 100. During run mode, double
click host 2 and then click command console. And execute the following command.
ping 1.0.1.4
Parameters:-
Drop Packets and Collision Packets.
2. A pop up window appears requesting the number of nodes and radius for the subnet
Set number of nodes=6;
Set radius of subnet >150
3. Click on the “E” icon on the toolbar to save the current topology e.g: file4.tpl
(Look for the ******.tpl extension.)
NOTE: Changes cannot / (should not) be done after selecting
Step2: Configuration
1. Double click the left mouse button while cursor is on a HOST to open the HOST window.
2. Click NODE EDITOR Button on the HOST window and select the INTERFACE tab (1st tab)
from the
modal window that pops up.
4. Click OK button on the INTERFACE window to exit and once again click on the OK button on
the HOST window to exit.
6. Also click NODE EDITOR Button on the HOST window and select the MAC tab from the
modal window that pops up.
7. Select LOG STATISTICS and select checkbox for drop and collision log statistics in the MAC
window
8. Click OK button on the MAC window to exit and once again click on the OK button on the
HOST window to exit.
10. Select G_Setting from the menu bar and select Simulation from the drop down list
Set simulation time>600sec
Step3: Simulate
i. Click “R” icon on the tool bar
ii. Select Simulation in the menu bar and click/ select RUN in the dropdown list to execute the
simulation.
iii. During simulation, open a new terminal window.
iv. Type ping IP address of a host in the subnet at the command prompt.
v. To view results, Open up new TERMINAL window, move to file4.results folder and open drop
and collision log files in separate TERMINAL window.
Caution: file4 is the hypothetical name given to this simulation.
(Refer Step 1.3)
v. Simulate to Compare Data Rate& Throughput.
AIM:
Simulate an Ethernet LAN using N nodes (6-10), change error rate and data rate and compare
throughput.
Topology:-
Sender:-
stcp –p 2000 –l 1024 1.0.1.4
Receiver:-
rtcp –p 2000 –l 1024
Double click on receiver link and change BER to 0.000001, Run Again.
Parameters:-
Throughput of outgoing Packets
2. Select/click the HUB icon on the toolbar and click the left mouse button on the editor, to place
HUB1 on the editor.
Repeat the above procedure and place another host “HUB2” on the editor
3. Click on the LINK icon on the toolbar and connect HOST1, HOST2 and HOST3 to HUB1,
HOST4, HOST5 and HOST6 to HUB2.
4. Select/click the SWITCH icon on the toolbar and click the left mouse button on the editor, to
place SWITCH1 on the editor.
5. Click on the LINK icon on the toolbar and connect HUB1 to SWITCH1 and HUB2 to
SWITCH1.
6. Click on the “E” icon on the toolbar to save the current topology e.g: file5.tpl (Look for the
******.tpl extension.)
NOTE: Changes cannot / (should not) be done after selecting the “E” icon.
Step2: Configuration
1. Double click the left mouse button while cursor is on HOST1 to open the HOST window.
2. Select Add button on the HOST window to invoke the command window and provide the
following command in the command textbox.
stcp –p 21 –l 1024 1.0.1.4
3. Click OK button on the command window to exit and once again click on the OK button on the
HOST window to exit.
4. Repeat this step at HOST 2 and HOST3, but use different commands
stcp –p 21 –l 1024 1.0.1.5 at HOST2
stcp –p 21 –l 1024 1.0.1.6 at HOST3
5. Double click the left mouse button while cursor is on HOST4 to open the HOST window.
6. Select Add button on the HOST window to invoke the command window and provide the
following command in the command textbox.
rtcp –p 21 –l 1024
8. Click NODE EDITOR Button on the HOST window and select the MAC tab from the modal
window that pops up.
9. Select LOG STATISTICS and select checkbox for output throughput in the MAC window
10. Click OK button on the MAC window to exit and once again click on the OK button on the
HOST window to exit.
11. Repeat this step at HOST 5 and HOST6, but use different commands
rtcp –p 21 –l 1024 at HOST5
rtcp –p 21 –l 1024 at HOST6
12. Double click the left mouse button while cursor is on HOST5 to open the HOST window.
13. Click NODE EDITOR Button on the HOST5 window and select the PHYSICAL tab from the
modal window that pops up.
15. Click OK button on the PHYSICAL window to exit and once again click on the OK button to
return to the HOST window
16. Click NODE EDITOR Button on the HOST window and select the MAC tab from the modal
window that pops up.
17. Select LOG STATISTICS and select checkbox for output throughput in the MAC window
18. Click OK button on the MAC window to exit and once again click on the OK button on the
HOST window to exit.
19. Repeat this step HOST6, Change Bandwidth this time while undoing the change in Bit Error
Rate, also select the output throughput at HOST6.
Step3: Simulate