Вы находитесь на странице: 1из 86

EC6611 Computer Networks Lab Manual

Prepared By: B.Dinesh -AP / ECE Dept / TKEC


EC6611 Computer Networks Lab Manual

THE KAVERY ENGINEERING COLLEGE

DEPARTMENT OF

ELECTRONICS AND COMMUNICATION

ENGINEERING

III YEAR / VI SEM

Lab Manual for

EC6611 COMPUTER NETWORKS LABORATORY

Prepared By,

Mr. B.Dinesh, AP / ECE,

The Kavery Engineering College

Mecheri, Salem – 636 453

Prepared By: B.Dinesh -AP / ECE Dept / TKEC


EC6611 Computer Networks Lab Manual

Prepared By: B.Dinesh -AP / ECE Dept / TKEC


EC6611 Computer Networks Lab Manual

Do’s
1. Be regular to the lab.

2. Follow proper Dress Code.

3. Maintain Silence.

4. Know the theory behind the experiment before coming to the lab.

5. Identify the different leads or terminals or pins of the devices


(diode, transistor, IC, Dongles) before making connection.

6. Know the supply Voltage required for different devices and connect
the power supply voltage and ground accordingly

7. Know the current and voltage rating of the devices before using them
in the experiment.

8. Handle the PC and Trainer Kit properly

9. Insert (Remove) the devices properly in (from) the PC.

10. Take a signature of the staff in-charge before taking the


kits/components

11. After the completion of the experiments switch off the power supply
and return the apparatus.

12. Arrange the chairs/stools and equipment properly before leaving the
Lab.

Don’ts
1. Do not exceed the voltage rating
2. Do not interchange the Trainer while doing the experiment

3. Do not throw the Power Cable to floor.

4. Do not operate the PC and Trainer unnecessarily

Prepared By: B.Dinesh -AP / ECE Dept / TKEC


EC6611 Computer Networks Lab Manual

Prepared By: B.Dinesh -AP / ECE Dept / TKEC


EC6611 Computer Networks Lab Manual

ANNA UNIVERSITY SYLLABUS

EC6611 COMPUTER NETWORKS LABORATORY LTPC


0032

1. Implementation of Error Detection / Error Correction Techniques


2. Implementation of Stop and Wait Protocol and sliding window
3. Implementation and study of Go back-N and selective repeat protocols
4. Implementation of High Level Data Link Control
5. Study of Socket Programming and Client – Server model
6. Write a socket Program for Echo/Ping/Talk commands.
7. To create scenario and study the performance of network with CSMA / CA protocol
And compare with CSMA/CD protocols.
8. Network Topology - Star, Bus, Ring
9. Implementation of distance vector routing algorithm
10. Implementation of Link state routing algorithm
11. Study of Network simulator (NS) and simulation of Congestion Control Algorithms using
NS
12. Encryption and decryption

TOTAL: 45 PERIODS

Prepared By: B.Dinesh -AP / ECE Dept / TKEC


EC6611 Computer Networks Lab Manual

Prepared By: B.Dinesh -AP / ECE Dept / TKEC


EC6611 Computer Networks Lab Manual

EC6611 COMPUTER NETWORKS LABORATORY

LIST OF EXPERIMENTS

1. Implementation of Error Detection / Error Correction Techniques


2. Implementation of Stop and Wait Protocol
3. Implementation and study of Goback-N and selective repeat protocols
4. Study of Socket Programming and Client – Server model
5. Write a socket Program for Echo/Ping/Talk commands.
6. To create scenario and study the performance of network with CSMA / CA protocol
And compare with CSMA/CD protocols.
7. Network Topology - Star, Bus, Ring
8. Implementation of distance vector routing algorithm
9. Implementation of Link state routing algorithm
10. Study of Network simulator (NS) and simulation of Congestion Control Algorithms using
NS
11. Encryption and decryption

Prepared By: B.Dinesh -AP / ECE Dept / TKEC


EC6611 Computer Networks Lab Manual

Prepared By: B.Dinesh -AP / ECE Dept / TKEC


EC6611 Computer Networks Lab Manual

TABLE OF INDEX

S.No Date Experiment Title Page No Mark Sign

Prepared By: B.Dinesh -AP / ECE Dept / TKEC


Output:

Enter the 7-bit data code


1
1
1
0
1
0
0
Complete Code Word is
10101101100
Enter the Received codeword
1
1
1
0
1
1
0
1
1
0
0
Error is at 2
Corrected code word is :
10101101100
Ex.No:1
Implementation of Error Detection and Correction

AIM
To write a java program for Implementation of Error Detection and Correction using Hamming
Code

ALGORITHM
1. Open text file and type the program
2. Save the file with extension “.java”
3. Open command prompt
4. Create java class path and compile the java program
5. Run the java program
7. Enter the valid input and obtain valid output
8. Stop the program.

PROGRAM

import java.util.*;
class Hamming1
{
public static void main(String arg[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the 7-bit data code");
int d[]=new int[7];
for(int i=0;i<7;i++)
{
d[i]=sc.nextInt();
}
int p[]=new int[4];
p[0]=d[0]^d[1]^d[3]^d[4]^d[6];
p[1]=d[0]^d[2]^d[3]^d[5]^d[6];
p[2]=d[1]^d[2]^d[3];
p[3]=d[4]^d[5]^d[6];
int c[]=new int[11];
System.out.println("Complete Code Word is ");
c[0]=p[0];
c[1]=p[1];
c[2]=d[0];
c[3]=p[2];
c[4]=d[1];
c[5]=d[2];
c[6]=d[3];
c[7]=p[3];
c[8]=d[4];
c[9]=d[5];
c[10]=d[6];
for(int i=0; i<11;i++)
{
System.out.print(c[i]+ "");
}
System.out.println();
System.out.println("Enter the Received codeword");
int r[]=new int[11];
for(int i=0;i<11;i++){
r[i]=sc.nextInt();
}
int pr[]=new int[4];
int rd[]=new int[7];
pr[0]=r[0];
pr[1]=r[1];
rd[0]=r[2];
pr[2]=r[3];
rd[1]=r[4];
rd[2]=r[5];
rd[3]=r[6];
pr[3]=r[7];
rd[4]=r[8];
rd[5]=r[9];
rd[6]=r[10];
int s[]=new int[4];
s[0]=pr[0]^rd[0]^rd[1]^rd[3]^rd[4]^rd[6];
s[1]=pr[1]^rd[0]^rd[2]^rd[3]^rd[5]^rd[6];
s[2]=pr[2]^rd[1]^rd[2]^rd[3];
s[3]=pr[3]^rd[4]^rd[5]^rd[6];
int dec=(s[0]*1)+(s[1]*2)+(s[2]*4)+(s[3]*8);
if(dec==0)
System.out.println("No error");
else
{
System.out.println("Error is at "+dec);
if(r[dec-1]==0)
r[dec-1]=1;
else
r[dec-1]=0;
}
System.out.println("Corrected code word is : ");
for(int i=0;i<11;i++)
System.out.print(r[i]+"");
System.out.println();
}
}

Result:
Thus by using the above algorithm Implementation of Error Detection and Correction of
Hamming Code were executed successfully and output was verified successfully
Stop and Wait protocol

Introduction

Stop and Wait is a reliable transmission flow control protocol. This protocol works only in
Connection Oriented (Point to Point) Transmission. The Source node has window size of ONE. After
transmission of a frame the transmitting (Source) node waits for an Acknowledgement from the
destination node. If the transmitted frame reaches the destination without error, the destination transmits
a positive acknowledgement. If the transmitted frame reaches the Destination with error, the receiver
destination does not transmit an acknowledgement. If the transmitter receives a positive
acknowledgement it transmits the next frame if any. Else if its acknowledgement receive timer expires,
it retransmits the same frame.

Algorithm

1. Start with the window size of 1 from the transmitting (Source) node
2. After transmission of a frame the transmitting (Source) node waits for a reply (Acknowledgement)
from the receiving (Destination) node.
3. If the transmitted frame reaches the receiver (Destination) without error, the receiver (Destination)
transmits a Positive Acknowledgement.
4. If the transmitted frame reaches the receiver (Destination) with error, the receiver (Destination) do
not transmit acknowledgement.
5. If the transmitter receives a positive acknowledgement it transmits the next frame if any. Else if the
transmission timer expires, it retransmits the same frame again.
6. If the transmitted acknowledgment reaches the Transmitter (Destination) without error, the
Transmitter (Destination) transmits the next frame if any.
7. If the transmitted frame reaches the Transmitter (Destination) with error, the Transmitter
(Destination) transmits the same frame.
8. This concept of the Transmitting (Source) node waiting after transmission for a reply from the
receiver is known as STOP and WAIT
Output
Ex.No:2
Implementation of stop and wait protocol Using NetSim

Aim:
To Study and implementing the stop and wait protocol using Network Simulator (NetSim)

Hardware / Software Requirements

1. NetSim Academic Version simulation software (for C/C++ programming implementation)


2. PC With Windows XP

Procedure

1. To begin with the experiment, open NetSim Click on Programming from the file panel and select
Transmission Flow Control

2. The scenario will be obtained as shown below. Follow the steps.

3. When you select the User mode, you have to write your own program in C/C++, compile and
link to NetSim software for validation.
4. Click on the “methodology” button for details on how to proceed with your own code.
5. Click on the “P” button to view the file path.

6. Continue with the steps as given for sample mode.


7. Click animate to view the output
Result:

Thus by using the above algorithm and Description the Stop and Wait Protocol using NetSim
was implemented and its output was verified successfully
Go Back N protocols

Go Back N is a connection oriented transmission. The sender transmits the frames continuously.
Each frame in the buffer has a sequence number starting from 1 and increasing up to the window size.
The sender has a window i.e. a buffer to store the frames. This buffer size is the number of frames to be
transmitted continuously. The size of the window depends on the protocol designer.

Algorithm
1. The source node transmits the frames continuously.
2. Each frame in the buffer has a sequence number starting from 1 and increasing up to the window
size.
3. The source node has a window i.e. a buffer to store the frames. This buffer size is the number of
frames to be transmitted continuously.
4. The size of the window depends on the protocol designer.
5. For the first frame, the receiving node forms a positive acknowledgement if the frame is received
without error.
6. If subsequent frames are received without error (up to window size) cumulative positive
acknowledgement is formed.
7. If the subsequent frame is received with error, the cumulative acknowledgment error-free frames are
transmitted. If in the same window two frames or more frames are received with error, the second
and the subsequent error frames are neglected. Similarly even the frames received without error after
the receipt of a frame with error are neglected.
8. The source node retransmits all frames of window from the first error frame.
9. If the frames are errorless in the next transmission and if the acknowledgment is error free, the
window slides by the number of error-free frames being transmitted.
10. If the acknowledgment is transmitted with error, all the frames of window at source are
retransmitted, and window doesn’t slide.
11. This concept of repeating the transmission from the first error frame in the window is called as
GOBACKN transmission flow control protocol.
Output
Ex.No:3(a)
Implementation of Go Back N protocol Using NetSim

Aim:
To Study and implementing the Go Back N protocol using Network Simulator (NetSim)

Hardware / Software Requirements

1. NetSim Academic Version simulation software


2. PC With Windows XP

Procedure

1. To begin with the experiment, open NetSim Click on Programming from the file panel and select
Transmission Flow Control

2. The scenario will be obtained as shown below. Follow the steps.

3. When you select the User mode, you have to write your own program in C/C++, compile and
link to NetSim software for validation.
4. Click on the “methodology” button for details on how to proceed with your own code.
5. Click on the “P” button to view the file path.

6. Continue with the steps as given for sample mode.


7. Click animate to view the output
Result:

Thus by using the above algorithm and Description the Go Back N Protocol using NetSim was
implemented and its output was verified successfully
Selective Repeat
Selective repeat is Similar to Go Back N. However, the sender only retransmits frames for which
an ACK is received. Advantage over Go Back N needs fewer retransmissions. Disadvantages are more
complexity at sender and receiver and Receiver may receive frames out of sequence.

Algorithm
1. The source node transmits the frames continuously.
2. Each frame in the buffer has a sequence number starting from 1 and increasing up to the window
size.
3. The source node has a window i.e. a buffer to store the frames. This buffer size is the number of
frames to be transmitted continuously.
4. The receiver has a buffer to store the received frames. The size of the buffer depends upon the
window size defined by the protocol designer.
5. The size of the window depends according to the protocol designer.
6. The source node transmits frames continuously till the window size is exhausted. If any of the
frames are received with error only those frames are requested for retransmission (with a
negative acknowledgement)
7. If all the frames are received without error, a cumulative positive acknowledgement is sent.
8. If there is an error in frame 3, an acknowledgement for the frame 2 is sent and then only Frame 3
is retransmitted. Now the window slides to get the next frames to the window.
9. If acknowledgment is transmitted with error, all the frames of window are retransmitted. Else
ordinary window sliding takes place. (* In implementation part, Acknowledgment error is not
considered)
10. If all the frames transmitted are errorless the next transmission is carried out for the new
window.
11. This concept of repeating the transmission for the error frames only is called Selective Repeat
transmission flow control protocol.
Output
Ex.No:3(b)
Implementation of Selective Repeat protocol Using NetSim

Aim:
To Study and implementing the Selective Repeat protocol using Network Simulator (NetSim)

Hardware / Software Requirements

1. NetSim Academic Version simulation software


2. PC With Windows XP

Procedure

1. To begin with the experiment, open NetSim Click on Programming from the file panel and select
Transmission Flow Control

2. The scenario will be obtained as shown below. Follow the steps.

3. When you select the User mode, you have to write your own program in C/C++, compile and
link to NetSim software for validation.
4. Click on the “methodology” button for details on how to proceed with your own code.
5. Click on the “P” button to view the file path.

6. Continue with the steps as given for sample mode.


7. Click animate to view the output
Result:

Thus by using the above algorithm and Description the Selective Repeat Protocol using NetSim
was implemented and its output was verified successfully
Data Encryption and Decryption

Encryption
In encryption, each letter position in the file text which is given in encrypt mode is changed
according to the ascending order of the key text.

Algorithm

1. Get the text to be encrypted (plain text) and key text.


2. Find the length of the plain text.
3. For I=1 to length of plain text
4. Find the binary equivalent of Ith character of plain text.
5. Find the binary equivalent of Ith character of key text
6. Find the XOR of above two values.
7. The resulting value will be the encrypted format (cipher text) of the plain text.

Decryption

In decryption each letter position in the encrypted file text is changed according to the ascending
order of the key text.

Algorithm

1. Get the text to be decrypted (cipher text) and key text.


2. Find the length of the cipher text.
3. For I=1 to length of cipher text
4. Find the binary equivalent of Ith character of cipher text.
5. Find the binary equivalent of Ith character of key text
6. Find the XOR of above two values.
7. The resulting value will be the decrypted format (original plain text) of the cipher plain text.
Output
Ex.No:4
Implementation of Data Encryption and Decryption Using NetSim

Aim:
To Study and implementing of Data encryption and decryption using Network Simulator
(NetSim)

Hardware / Software Requirements

1. NetSim Academic Version simulation software


2. PC With Windows XP

Procedure

1. To begin with the experiment, open NetSim Click on Programming from the file panel and select
Transmission Flow Control

2. The scenario will be obtained as shown below. Follow the steps.


a. For Encryption

b. For Decryption
3. When you select the User mode, you have to write your own program in C/C++, compile and
link to NetSim software for validation.
4. Click on the “methodology” button for details on how to proceed with your own code.
5. Click on the “P” button to view the file path.

6. Continue with the steps as given for sample mode.


7. Click animate to view the output

Result:

Thus by using the above algorithm and Description the Data encryption and decryption using
NetSim was implemented and its output was verified successfully
OUTPUT:

Client Program:
THE DATE IN THE SERVER IS: Sun Mar 04 15:30:46 IST 2018

Server Program:
THE CLIENT SYSTEM ADDRESS IS :SIS-PC/192.168.1.101
Ex.No:5
Study of Socket Programming & Client-Server Model

AIM
To implement socket programming date and time display from client to server using TCP
Sockets

ALGORITHM
Client

1. Create a client socket and connect it to the server‟s port number.

2. Retrieve its own IP address using built-in function.


3. Send its address to the server.
4. Display the date & time sent by the server.
5. Close the input and output streams.
6. Close the client socket.
7. Stop
Server
1. Create a server socket and bind it to port.
2. Listen for new connection and when a connection arrives, accept it.

3. Send server‟s date and time to the client.

4. Read client‟s IP address sent by the client.

5. Display the client details.


6. Repeat steps 2-5 until the server is terminated.
7. Close all streams.
8. Close the server socket.
9. Stop.
Program:
// Client:

import java.net.*;
import java.io.*;
import java.net.InetAddress;
import java.net.Socket;
public class csclient
{
public static void main (String args[])
{
Socket soc;
DataInputStream dis;
String sdate;
PrintStream ps;
try
{
InetAddress ia=InetAddress.getLocalHost();
soc=new Socket(ia,8020);
dis=new DataInputStream(soc.getInputStream());
sdate=dis.readLine();
System.out.println("THE date in the server is:"+sdate);
ps=new PrintStream(soc.getOutputStream());
ps.println(ia);
}
catch(IOException e)
{
System.out.println("THE EXCEPTION is :"+e);
}}}

// Server

import java.net.*;
import java.io.*;
import java.util.*;
class dateserver
{
public static void main(String args[])
{
ServerSocket ss;
Socket s;
PrintStream ps;
DataInputStream dis;
String inet;
try
{
ss=new ServerSocket(8020);
while(true)
{
s=ss.accept();
ps=new PrintStream(s.getOutputStream());
Date d=new Date();
ps.println(d);
dis=new DataInputStream(s.getInputStream());
inet=dis.readLine();
System.out.println("THE CLIENT SYSTEM ADDRESS IS :"+inet);
ps.close();
}
}
catch(IOException e)
{
System.out.println("The exception is :"+e);
}}}

Result:
Thus by using the above algorithm socket programming to display date and time from
client to server using TCP were executed and output was verified successfully.
Output:

Client Program:
Enter the IP Address to be Ping : 127.0.0.1

Pinging 127.0.0.1 with 32 bytes of data:


Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:


Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
client
Hai
server:Hai
client
Kavery
server:Kavery
client

Server Program:
msg received and sent back to client
Client:Hai
msg received and sent back to client
Client:Kavery
Ex.No:6
Socket Program for Echo, Ping & Talk Commands

AIM
To write a Socket program for Ping / Echo and Talk Commands using java program

ALGORITHM
CLIENT
1. Start the program
2. Include necessary package in java
3. To create a socket in client to server.
4. The client establishes a connection to the server.
5. The client accept the connection and to send the data from client to server.
6. The client communicates the server to send the end of the message
7. Stop the program.

SERVER

1. Start the program


2. Include necessary package in java
3. To create a socket in server to client
4. The server establishes a connection to the client.
5. The server accept the connection and to send the data from server to client and
6. vice versa
7. The server communicates the client to send the end of the message.
8. Stop the program.
Program
// Client .Java
import java.io.*;
import java.net.*;
public class eclient
{
public static void main(String args[])
{
Socket c=null;
String line;
DataInputStream is,is1;
PrintStream os;
try
{
String str;
System.out.print(" Enter the IP Address to be Ping : ");
BufferedReader buf1=new BufferedReader(new
InputStreamReader(System.in));
String ip=buf1.readLine();
Runtime H=Runtime.getRuntime();
Process p=H.exec("ping " + ip);
InputStream in=p.getInputStream();
BufferedReader buf2=new BufferedReader(new
InputStreamReader(in));
while((str=buf2.readLine())!=null)
{
System.out.println(" " + str);
}
c=new Socket(ip,8080);
}
catch(IOException e)
{
System.out.println(e);
}
try
{
os=new PrintStream(c.getOutputStream());
is=new DataInputStream(System.in);
is1=new DataInputStream(c.getInputStream());
do
{
System.out.println("client");
line=is.readLine();
os.println(line);
if(!line.equals("exit"))
System.out.println("server:"+is1.readLine());
}while(!line.equals("exit"));
}
catch(IOException e)
{
System.out.println("socket closed");
}}}

// Server.Java
import java.io.*;
import java.net.*;
public class eserver
{
public static void main(String args[])throws IOException
{
ServerSocket s=null;
String line;
DataInputStream is=null,is1=null;
PrintStream ps;
Socket c=null;
try
{
s=new ServerSocket(8080);
}
catch(IOException e)
{
System.out.println(e);
}
try
{
c=s.accept();
is=new DataInputStream(c.getInputStream());
ps=new PrintStream(c.getOutputStream());
while(true)
{
line=is.readLine();
System.out.println("msg received and sent back to client");
System.out.println("Client:"+line);
ps.println(line);
}
}
catch(IOException e)
{
System.out.println(e);
}}}

Result:
Thus by using the above algorithm Socket program for Ping / Echo and Talk Commands
using java program were executed successfully and output was verified successfully.
CSMA/CA and CSMA/CD Protocol

Wireless LAN is basically a LAN that transmits data over air, without any physical connection between
devices. The transmission medium is a form of electromagnetic radiation. Wireless LAN is ratified by
IEEE in the IEEE 802.11 standard. The underlying algorithm used in Wireless LAN is known as the
CSMA / CA – Carrier Sense Multiple Access / Collision Avoidance algorithm.

CSMA / CA algorithm
 The node which has data to transmit senses the medium. If the medium has been idle for longer
than the DIFS (DCF Inter Frame Space), it finishes its back off interval & transmits Request To
Send (RTS) signal immediately.
 The access point responds with Clear to Send (CTS) signal .Now the node has reserved the
medium and transmits data.
 If the medium is busy, the node waits for the channel to become idle for the DIFS.
 If two nodes sense the medium at the same time & transmit RTS, simultaneously, RTS collision
occurs and the transmission is retried. Hence data collision is avoided.
 For each retransmission, contention window increases exponentially hence back off time is
selected from larger contention window.
This is explained in the timing diagram given below:

Performance Metrics:
Some of the important performance metrics which are recorded during simulation are given
below.
Throughput (%)
Fraction of link’s capacity devoted to carrying frames.
Formula:
Throughput (%) = (((Pay Load Delivered + Overheads) * Byte Time) / Simulation End Time) * 100.0.
Normalized Throughput (%)
Also called as Goodput (%) Fraction of link’s capacity devoted to carrying non-retransmitted
frames excluding bytes due to protocol overhead, collision and retransmission.
Formula:
Normalized Throughput (%) = (((Pay Load Delivered) * Byte Time) / Simulation End Time) * 100.0.

Mean delay (Micro Second/Frame)


Mean time a frame waits at a station before being successfully transmitted (queuing time and
medium access time) and the transmission time per frame.
Formula:
Mean Delay (Micro Second/Frame) = (Queuing Time + Medium Access Time + Transmission Time) /
(Pay Load Delivered / Maximum Data Size per Frame).

Response Time (Micro Second / Frame)


Also called as Service Time Sum of medium access time and transmission time per frame,
Formula:
Response Time (Micro Second/Frame) = (Medium Access Time + Transmission Time) / (Pay Load
Delivered / Maximum Data Size per Frame)

Collision count
Total number of collisions in the network

The collision avoidance concept in wireless LAN protocol, avoids the possibility of collision of
data frames. The working of wireless LAN is such that when a node transmits to the destination the data
reaches the access point (coordination point) and from there it is transmitted to the destination node. Due
to its nature of double transmission and protocol overheads, the throughput is reduced by 50% when
compared to Ethernet.
Output
Ex.No:7
CSMA / CD vs. CSMA / CA

Aim:

To create scenario and study the performance of network with CSMA / CA protocol and
compare with CSMA/CD protocols.

Hardware / Software Requirements

1. NetSim Academic Version simulation software


2. PC With Windows XP

Procedure

1. To begin with the experiment, open NetSim Click on Simulation from the file panel and select
LAN network and Wireless LAN from the sub menu. The simulation environment is now open

2. Drag and drop the BSS and the Hub on the environment. Connect the BSS and the hub.

3. Drag and drop the node near to the BSS only. Two is the minimum number of nodes required for
transmission to take place

4. Right click on the 1st node and select Point to Point from the transmission option.
OUTPUT: CSMA / CD vs. CSMA / CA
5. Click Configure and Simulate - you will see the performance metrics screen. (Details on how to
model broadcast traffic is available in the “?” file panel)
6. Here click Close and save the experiment. On being prompted whether you want to save the
experiment click Yes. Enter any file name as shown above and click OK

7. Rather then creating new scenarios each time, this can be done as follows
a. After saving the experiment, click or File and Open from the sub menu on the file panel.

b. Select LAN from fig a.


c. Select Wireless LAN- Protocol, Star-Hub Topology and the experiment which you have
saved for the Sample from fig b.
d. Click on the accept button.
e. Now, you will obtain the initial scenario.
f. Set the traffic to Point to Point on one additional node (total of 2 nodes)
g. Click Configure and Simulate. ….
h. Follow the same procedure increasing the number of nodes by 1 every time, till all 6
nodes transmit Point to Point.

Result:
Thus by using the above algorithm and Description the scenario of CSMA / CA protocol
were studied and Performance comparison with CSMA/CD protocols were done.
Output

Bus Topology

Star Topology
Ex.No:8
Network Topology- Bus, Star & Token Ring

Aim:
To Study and implementing the network topology – bus, Star and Token Ring using Network
Simulator (NetSim)

Hardware / Software Requirements

1. NetSim Academic Version simulation software (for C/C++ programming implementation)


2. PC With Windows XP

Procedure

Bus Topology

1. To begin with the experiment, open NetSim


2. Click on Simulation, select LAN network and Ethernet from the sub menu.
3. From the Device selection, select Device- Hub.
4. The simulation environment is now open, Drag and drop the hub on the environment.
5. Drag and drop a node to the hub only .Two is the minimum number of nodes required for
transmission to take place.
6. Right click on the 1st node and select broadcast from the transmission option.
7. Click Configure and Simulate - you will see the performance metrics screen.
8. (Details on how to model broadcast traffic is available in the “?” file panel)
9. Here click Close and save the experiment.
10. On being prompted whether you want to save the experiment click Yes.
11. Enter any file name as shown above and click OK.

Star Topology

1. For Star- Switch experiment, open NetSim Click on Simulation, select LAN network and
Ethernet from the sub menu.
2. From the device selection, select Device- Switch.
3. The simulation environment is now open.
4. Note: Follow the same procedure as given for hub above.
5. Analyze and compare results between an experiment done in Hub and one done with Switch
Token Ring
Token Ring Topology

1. Click on Simulation, select LAN network and Token Ring from the sub menu.
2. The simulation environment is now open.
3. Drag and drop the concentrator on the environment (depending on the number of nodes
required). 8 is the maximum number of nodes which can be connected to the concentrator. Here,
in some cases two concentrators are required.
4. Drag and drop the nodes to the concentrator only. Two is the minimum number of nodes
required for transmission to take place.
5. For a single concentrator click at the ends to make a ring connection. Whereas for two or more
concentrators, click at the ends of each concentrators to make a ring connection.
6. Multiple concentrators Single Concentrator
7. Right click on the 1st node and select Point to Point from the transmission option. Right click on
the 2nd node and again set the traffic to Point to point.
8. Click Configure and Simulate - you will see the performance metrics screen. (Details on how to
model broadcast traffic is available in the “?” file panel)

Result:

Thus by using the above procedure the network topology – Bus, Star and Token Ring were
Implemented and Studied successfully using Network Simulator (NetSim)
Distance Vector Routing Algorithm

Distance Vector Routing is one of the routing algorithms used in a Wide Area Network for
computing shortest path between source and destination. The router is one of the main devices used in a
wide area network. The main task of the router is routing. It forms the routing table and delivers the
packets depending upon the routes in the table – either directly or via an intermediate device (perhaps
another router). Each router initially has information about its all neighbors (i.e., it is directly
connected). After a period of time, each router exchanges its routing table among its neighbors. After
certain number of exchanges, all routers will have the full routing information about the area of the
network. After each table exchange, router re computes the shortest path between the routers, the
algorithm used for this routing is called Distance Vector Routing.

Algorithm

1. Take the Next Router routing table and its neighbor routing table.
2. Add the router entry that is not in your own routing table, but exists in any one of the other
routing tables. If the new router entry exists in more than one neighbor, then find the minimum
cost among them. The minimum cost value details are taken as a new entry: such as source
router, intermediate router, destination router and cost value, etc.
3. Update the source router routing table cost value if both the destination router and the
intermediate router field value have the same value as any one of the neighbors’ routing entry.
4. Update the source router’s routing table entry with the new advertised one if the intermediate
router value in the source table is not same, but the cost value is greater than the its neighbor’s
entry.
5. Write the next stage of routing table into the file.
Repeat steps 1 to 5 for all routers. Until there is no change in the routing table for all routers and check
whether any changes are made in any of the routers
Output
Ex.No:10
Implementation of Distance Vector Routing Algorithm Using NetSim

Aim:
To Study and implementing the Distance Vector Routing Algorithm using Network Simulator
(NetSim)

Hardware / Software Requirements

1. NetSim Academic Version simulation software


2. PC With Windows XP

Procedure

1. To begin with the experiment, open NetSim Click on Programming from the file panel and select
Transmission Flow Control

2. The scenario will be obtained as shown below. Follow the steps.

3. When you select the User mode, you have to write your own program in C/C++, compile and
link to NetSim software for validation.
4. Click on the “methodology” button for details on how to proceed with your own code.
5. Click on the “P” button to view the file path.

6. Continue with the steps as given for sample mode.


7. Click animate to view the output
Result:

Thus by using the above algorithm and Description the Distance Vector Routing Algorithm
using NetSim was implemented and its output was verified successfully
Link state routing Algorithm

The router is one of the main devices used in a wide area network. The main task of the router is
routing. It forms the routing table and delivers the packets depending upon the routes in the table –
either directly or via an intermediate device (perhaps another router). Link state algorithm is a method
used to find the shortest path between a source router and a destination router based on the distance and
route the packets through that route.

Algorithm

1. Start with the router: the root of the tree


2. Assign a cost of 0 to this router and make it the first permanent router.
3. Examine each neighbor router of the router that was the last permanent router.
4. Assign a cumulative cost to each router and make it temporary.
5. Among the list of temporary routers
a. Find the router with the smallest cumulative cost and make it permanent.
b. If a router can be reached from more than one direction
i. Select the direction with the shortest cumulative cost.
6. Repeat steps 3 to 5 until every router becomes permanent.
Output
Ex.No:10
Implementation of Link state routing Algorithm Using NetSim

Aim:
To Study and implementing the Link state routing Algorithm using Network Simulator (NetSim)

Hardware / Software Requirements

1. NetSim Academic Version simulation software


2. PC With Windows XP

Procedure

1. To begin with the experiment, open NetSim Click on Programming from the file panel and select
Transmission Flow Control

2. The scenario will be obtained as shown below. Follow the steps.

3. When you select the User mode, you have to write your own program in C/C++, compile and
link to NetSim software for validation.
4. Click on the “methodology” button for details on how to proceed with your own code.
5. Click on the “P” button to view the file path.

6. Continue with the steps as given for sample mode.


7. Click animate to view the output
Result:

Thus by using the above algorithm and Description the Link state routing Algorithm using
NetSim was implemented and its output was verified successfully
Ex.No:11 STUDY OF NETWORK SIMULATOR (NS).AND SIMULATION OF
CONGESTION CONTROL ALGORITHMS USING NS.

Aim:
To Study of Network simulator (NS).and Simulation of Congestion Control Algorithms using
NS

Introduction:
NS (from network simulator) is a name for series of discrete event network simulators,
specifically ns-1, ns-2 and ns-3. All of them are discrete-event network simulator, primarily used in
research and teaching. Ns-3 is free software, publicly available under the GNU GPLv2 license for
research, development, and use. The goal of the ns-3 project is to create an open simulation
environment for networking research that will be preferred inside the research community
 It should be aligned with the simulation needs of modern networking research.
 It should encourage community contribution, peer review, and validation of the
software.
Since the process of creation of a network simulator that contains a sufficient number of high-
quality validated, tested and actively maintained models requires a lot of work, ns-3 project spreads
this workload over a large community of users and developers.

Ns-1
The first version of ns, known as ns-1, was developed at VJ,GEEKLIME, Madurai (LBNL)
in the 1995-97 timeframe by Steve McCanne, Sally Floyd, Kevin Fall, and other contributors. This
was known as the LBNL Network Simulator, and derived from an earlier simulator known as
REAL by S. Keshav. The core of the simulator was written in C++, with Tcl-based scripting of
simulation scenarios. Long-running contributions have also come from Sun Microsystems, the
UC Berkeley Daedelus, and Carnegie Mellon Monarch projects.it used.

Ns-2
In 1996-97, ns version 2 (ns-2) was initiated based on a refactoring by Steve McCanne. Use
of Tcl was replaced by MIT's Object Tcl (OTcl), an object-oriented dialect Tcl. The core of ns-2 is
also written in C++, but the C++ simulation objects are linked to shadow objects in OTcl and
variables can be linked between both language realms. Simulation scripts are written in the OTcl
language, an extension of the Tcl scripting language. Presently, ns-2 consists of over 300,000
lines of source code, and there is probably a comparable amount of contributed code that is
not integrated directly into the main distribution (many forks of ns-2 exist, both maintained and
unmaintained). It runs on GNU/Linux, FreeBSD, Solaris, Mac OS X and Windows versions that
support Cygwin. It is licensed for use under version 2 of the GNU General Public License

Ns-3
A team led by Tom Henderson, George Riley, Sally Floyd, and Sumit Roy, applied for and
received funding from the U.S. National Science Foundation (NSF) to build a replacement for ns-2,
called ns-3. This team collaborated with the Planete project of INRIA at Sophia Antipolis,
with Mathieu Lacage as the software lead, and formed a new open source project. In the process of
developing ns-3, it was decided to completely abandon backward- compatibility with ns-2. The new
simulator would be written from scratch, using the C++ programming language. Development of ns-
3 began in July 2006. A framework for generating Python bindings (pybindgen) and use of the Waf
build system were contributed by Gustavo Carneiro. The first release, ns-3.1 was made in June 2008,
and afterwards the project continued making quarterly software releases, and more recently has
moved to three releases per year. ns-3 made its eighteenth release (ns-3.18) in the third quarter of
2013.

Current status of the three versions is:

 Ns-1 is no longer developed nor maintained,


 Ns-2 build of 2009 is not actively maintained (and is not being accepted for journal
publications)
 Ns-3 is actively developed (but not compatible for work done on ns-2).

Design

Ns-3 is built using C++ and Python with scripting capability. The ns-3 library is wrapped to
python thanks to the pybindgen library which delegates the parsing of the ns-3 C++ headers to
gccxml and pygccxml to generate automatically the corresponding C++ binding glue. These
automatically-generated C++ files are finally compiled into the ns-3 python module to allow users
to interact with the C++ ns-3 models and core through python scripts. The ns-3 simulator
features an integrated attribute-based system to manage default and per-instance values for
simulation parameters. All of the configurable default values for parameters are managed by this
system, integrated with command-line argument processing, Doxygen documentation, and an XML-
based and optional GTK-based configuration subsystem.
The large majority of its users focus on wireless simulations which involve models for Wi-Fi,
WiMAX, or LTE for layers 1 and 2 and routing protocols such as OLSR and AODV. Ns-3 is
split over couple dozen modules containing one or more models for real-world network
devices and protocols. Ns-3 has more recently integrated with related projects: the Direct Code
Execution extensions allowing the use of C or C++-based applications and Linux kernel code in the
simulations.

Simulation workflow

The general process of creating a simulation can be divided into several steps:

1. Topology definition: to ease the creation of basic facilities and define their
interrelationships, ns-3 has a system of containers and helpers that facilitates this process.
2. Model development: models are added to simulation (for example, UDP, IPv4, point- to-
point devices and links, applications); most of the time this is done using helpers.
3. Node and link configuration: models set their default values (for example, the size of
packets sent by an application or MTU of a point-to-point link); most of the time this is
done using the attribute system.
4. Execution: simulation facilities generate events, data requested by the user is logged.
5. Performance analysis: after the simulation is finished and data is available as a time-
stamped event trace. This data can then be statistically analysed with tools like R to draw
conclusions.
6. Graphical Visualization: raw or processed data collected in a simulation can be
graphed using tools like Gnuplot, matplotlib or XGRAPH.
Examples of network simulators
There are many both free/open-source and proprietary network simulators. Examples of
notable network simulation software are, ordered after how often they are mentioned in research
papers:

1. Ns (open source)
2. OPNET (proprietary software)
3. NetSim (proprietary software)

Uses of network simulators

Network simulators serve a variety of needs. Compared to the cost and time involved
in setting up an entire test bed containing multiple networked computers, routers and data
links, network simulators are relatively fast and inexpensive. They allow engineers,
researchers to test scenarios that might be particularly difficult or expensive to emulate using real
hardware - for instance, simulating a scenario with several nodes or experimenting with a new
protocol in the network. Network simulators are particularly useful in allowing researchers to
test new networking protocols or changes to existing protocols in a controlled and reproducible
environment. A typical network simulator encompasses a wide range of networking technologies
and can help the users to build complex networks from basic building blocks such as a
variety of nodes and links. With the help of simulators, one can design hierarchical networks
using various types of nodes like computers, hubs, bridges, routers, switches, links, mobile
units etc.
Various types of Wide Area Network (WAN) technologies like TCP, ATM, IP etc.
and Local Area Network (LAN) technologies like Ethernet, token rings etc., can all be simulated
with a typical simulator and the user can test, analyze various standard results apart from devising
some novel protocol or strategy for routing etc. Network simulators are also widely used to
simulate battlefield networks in Network-centric warfare

Packet loss
When one or more packets of data travelling across a computer network fail to reach their
destination, Packet loss is distinguished as one of the three main error types encountered in digital
communications; the other two being bit error and spurious packets caused due to noise.
Packets can be lost in a network because they may be dropped when a queue in the network node
overflows. The amount of packet loss during the steady state is another important property of a
congestion control scheme. The larger the value of packet loss, the more difficult it is for transport
layer protocols to maintain high bandwidths, the sensitivity to loss of individual packets, as
well as to frequency and patterns of loss among longer packet sequences is strongly dependent
on the application itself.

Throughput
This is the main performance measure characteristic, and most widely used. In
communication networks, such as Ethernet or packet radio, throughput or network throughput is the
average rate of successful message delivery over a communication channel. The throughput is usually
measured in bits per second (bit/s or bps), and sometimes in data packets per second or data packets per
time slot This measure how soon the receiver is able to get a certain amount of data send by the
sender. It is determined as the ratio of the total data received to the end to end delay. Throughput is
an important factor which directly impacts the network performance
Delay
Delay is the time elapsed while a packet travels from one point e.g., source premise
or network ingress to destination premise or network degrees. The larger the value of delay, the more
difficult it is for transport layer protocols to maintain high bandwidths. We will calculate end to end
delay

Queue Length
A queuing system in networks can be described as packets arriving for service, waiting for
service if it is not immediate, and if having waited for service, leaving the system after being
served. Thus queue length is very important characteristic to determine that how well the active
queue management of the congestion control algorithm has been working.

RESULT
Thus the study of Network simulator (NS2)was studied.

Вам также может понравиться