Vous êtes sur la page 1sur 35

Exp No:1

Date:
SIMULATION OF CSMA/CD
Aim:
To simulate the CSMA/CD protocol using ViRtSim software and study its characteristics.
Theory:
Carrier sense multiple access is a network access method used on shared network topologies
such as Ethernet to control access to the network. Devices attached to the network cable
listen(carrier sense) before transmitting. If the channel is in use, devices wait before transmitting.
All devices have equal access to use the network when it is clear.
Collusion detection defines what happens when two devices sense a clear channel, then
attempt to transmit at the same time. A collision occurs and both devices stop transmission, wait
for a random amount of time and then retransmit. This is the technique used to access the 802.3
Ethernet network channel. This method handles collision as they occur, but if the bus is
constantly busy, collision can occur so often that the performance drops drastically.

data to B

collision

data to

OUTPUT:

Collision in a network
A

B
Data to B

C
After specified interval

data to C
C

Algorithm:

Declare two frame variables and assign them the data frames to be transmitted.
Initialize the CSMA/CD function.
Send data from node a to node b and sense multiple access.
Send data from node b to node c and sense multiple access.
Check if collision occurs.
If collision occurs wait for 1000ms and then retransmit the two data from the nodes one

after the other.


Stop the execution.

Procedure:

select program ViRtsim simulation CSMA CSMA/CD


Enter the program, save and run it

Result:
Thus the CSMA/CD protocol was simulated using ViRtsim software and its
characteristics was studied
Exp No: 2

Date:
SIMUATION OF CSMA/CA
Aim:
To simulate the CSMA/CA protocol using ViRtSim software .
Theory:
Carrier sense multiple access is a network access method used on shared network
topologies such as Ethernet to control access to the network .devices attached to the network
cable listen(carrier sense) before transmitting. If the channel is in use, device wait before
transmitting. Multiple access indicates that many device can connect to and share the same
network. All devices have equal access to use the network when it is clear.
Collision avoidance defines what happens when two devices sense a clear channel, then
attempt to transmit the same time .a collision occurs and both devices stop transmission, wait for
a random amount of time and retransmit. This is technique used to access the 802.3 Ethernet
network channel .This method handles collision as they occur, but if the bus is constantly busy,
collision can occur so often that the performance drops drastically.
A

RT

C
Request to send (RTS) sent to A

Output :

CT

Clear to send (CTS) sent to A


A

data

C
Data transmitted to B
A

ACK

Acknowledge (ACK) sent to A

Algorithm:

Declare a frame variable and assign them the data frame to be transmitted.
Initialize the CSMA/CA function.
Nodes keep listening to the channel.
Send request to send frame from node a to node b.
Send clear to send frame from node b to node a.
Send data from node a to node b and sense multiple access.
Send acknowledge frame from node b to node a.
Stop the execution.

Procedure:

select program ViRtsim simulation CSMA CSMA/CA


Enter the program, save and run it

Result
Thus the CSMA/CA protocol was simulated using ViRtSim software.

Output:

Exp No: 3
Date:

IMPLEMENTATION OF DISTANCE VECTOR ROUTING


Aim:
To implement and test the distance vector routing using ViRtSim.
Theory:
In distance vector router shares its knowledge about the entire network with information
from its neighbors in a step procedure. Once this is complete it will have a complete idea about
the network. The table consists of network ID, cost and next hop. The cost refers to the number
of hop count (least) to reach a particular destination. Routers using distance-vector algorithms
send all or part of their routing table entries to adjacent routers on a periodic basis. This happens
even if there are no changes in the network. By receiving a routing update, a router can verify all
the know routes and make changes to its routing table. This process is also known as routing by
rumor.
Procedure:

Open ViRtSim and select simulationdistance vector routing.


Design the required network by including the routers, links and corresponding weights on
the links
Select the sender and destination node and click the find path.
Click the calculate button which displays all the route details and shows the shortest
route.

Result:
Thus the distance vector routing algorithm was implemented and simulated using
ViRtSim software.

Output:

Exp No:4
Date:

IMPLEMENTATION OF LINK STATE ROUTING


Aim:
To implement and test the link state routing using ViRtSim.
Theory:
In link state routing every router shows its knowledge about its neighbor to the entire
network and ultimately all routers will have a routing table within the link state database. Linkstate routing protocols respond quickly to network changes sending trigger updates only when a
network change has occurred. Link-state routing protocols send periodic updates, known as linkstate refreshes, at longer time intervals, such advertisement (LSA) is concerning that link. The
LSA is then transmitted to all neighboring devices. Each routing device takes a copy of the LSA,
updates its link-state database, and forwards the LSA to all neighboring devices. This flooding of
LSAs is required to ensure that all routing devices create database that accurately reflect the
network topology before updating their routing tables
Procedure:

Open ViRtSim and select simulation Link state routing.


Design the required network by including the routers and links.
Select the sender and destination node and click the find path.
Click the calculate button which displays all the route details and shows the shortest
route

Result:
Thus the link state routing algorithm was implemented and simulated using ViRtSim
software.

Ex No:5
Date:

FILE ENCRYPTION AND DECRYPTION USING PC TO PC COMMUNICATION

Aim:
To encrypt and decrypt file using pc to pc communication.

Theory:
It is unlikely that system can completely present unauthorized access to transmission media. The
media used today is called encryption, means that the sender transform the original information
to another form and send resulting unintelligence message over the network. Decryption reverses
back the original message. The sender uses an encryption algorithm and a key to transform plain
text into cipher text.

Procedure:
Step 1: Open Vi-Rt sim and choose PC TO PC -> File Encryption.
Step 2: Choose another pc for decryption.
Step 3: Connect both PCs using LAN network kit and process on the encryption side and send
file.
Step 4: Enter password for the file.
Step 5: Receive the file at decryption side by entering password.

Result:
Thus a scenario was created and encryption and decryption was performed.

Ex No:6
Date:

SIMULATION OF RING TOPOLOGY USING LAN TRAINER KIT

Aim:
To simulate the ring topology using LAN trainer kit and study its characteristics.
Theory:
In ring topology, each device has a dedicated point to point line configuration with the
two devices on either side of it. A signal is passed along the ring in one direction from device to
device until it reaches its destination. Each device in the ring incorporates a repeater. When a
device receives a signal intended for another device its repeater regenerates the bit and passes
them along unidirectional traffic.

VI LAN TRAINER KIT - RING TOPOLOGY

Procedure:

Step 1: Switch on the LAN trainer kit and give connections as shown in the block diagram. The
NIC 1 is placed in programming mode.
Step 2: select ViRtSim in the PC and then the utilities.
Step 3: select ARM downloader and click read device ID.
Step 4: reset the NIC 1 and then the device ID will be read successfully.
Step 5: to load the ARM processor, select the respective hex bit file and click load flash.
Step 6: to load the FPGA processor, go to Start all programs Xilinx Accessories and
click on IMPACT
Step 7: Create a new project on Boundary scan configuration, select the respective hex bit file
and load the FPGA chip
Step 8: when program is successfully loaded switch the kit to execution made and
reset.
Step 9: Select on the ViRtSim window PC to PC Ping. Enter the host information
and test the connectivity.
Step 10: OSI LAN TRAINER Topology Ring
Step 1l: Connect the PC with the kit and send the data
Step 12: once data reaches the destination stop the execution.

Result:
Thus ring topology was implemented and simulated using VI-LAN trainer kit and ViRtSim
software.

Ex No: 7

Date:

SIMULATION OF BUS TOPOLOGY USING LAN TRAINER KIT


Aim:
To simulate the bus topology using LAN trainer kit and study its characteristics.
Theory:
The bus topology connects each station on the network into something called the segment
trunk. A bus is usually referred to a cable that connects end to end and this is used to transmit the
signals from one end to the other end. At every end a terminator is placed so that it understands
in which direction the data is travelling and also terminator is used to absorb the signals. If the
terminator does not absorb the signal then the same signal is reflected back to the bus confusing
the whole data flow.
VI LAN TRAINER KIT- BUS TOPOLOGY

Procedure:
Step 1: Switch on the LAN trainer kit and give connections as shown in the block diagram. The
NIC 1 is placed in programming mode.

Step 2: select ViRtSim in the PC and then the utilities.


Step 3: select ARM downloader and click read device ID.
Step 4: reset the NIC 1 and then the device ID will be read successfully.
Step 5: to load the ARM processor, select the respective hex bit file and click load flash.
Step 6: to load the FPGA processor, go to Start all programs Xilinx Accessories and
click on IMPACT
Step 7: Create a new project on Boundary scan configuration, select the respective hex bit file
and load the FPGA chip
Step 8: when program is successfully loaded switch the kit to execution mode and reset.
Step 9: Select on the ViRtSim window PC to PC Ping. Enter the host information and test the
connectivity.
Step 10: OSI LAN TRAINER Topology bus
Step 11: Connect the PC with the kit and send the data
Step 12: once data reaches the destination stop the execution.

Result:
Thus bus topology was implemented and simulated using VI-LAN trainer kit and ViRtSim
software.

Ex No:8

Date:
SIMULATION OF STAR TOPOLOGY USING LAN TRAINER KIT
Aim:
To simulate the star topology using LAN trainer kit and study its characteristics.
Theory:
In a star topology each device has a dedicated point to point link only to a central
controller, usually called hub. The devices are not directly linked to each other. Unlike a mesh
topology a star topology does not allow direct traffic between devices. The controller act as an
exchange, it sends the data to the controller which then relays the data to the other connected
device. Its advantage includes robustness. If one link fails only that link is affected and all other
link remains active.

VI LAN TRAINER KIT STAR TOPOLOGY

NIC1

NIC2

NIC3

Node A

Node
B

Node C

Node
C

Procedure:
Step 1: Switch on the LAN trainer kit and give connections as shown in block diagram. The NCI
1 is placed in programming mode.
Step 2: Select ViRtSim in the PC and then the utilities.
Step 3: Select ARM downloader and click read device ID.
Step 4: Reset the NIC 1 and then the device ID will be read successfully.

Step 5: To load the ARM processor, select the respective hex bit file and click load flash.

Step 6: To load the FPGA processor, go to Start


Accessories

all programmes

Xilinx

and click on IMPACT

Step 7: Create a new project on Boundary scan configuration, select the respective hex bit file
and load the FPGA chip.
Step 8: When program is successfully loaded switch the kit to execution mode and reset.
Step 9 : Select on the ViRtSim window PC to PC
the connectivity.
Step 10: OSI LAN TRAINER

Topology

Ping. Enter the host information and test

Star

Step 11: Connect the PC with the kit and send the data
Step 12: Once the data reaches the destination stop the execution.

Result:
Thus star topology was implemented and stimulated using VI LAN trainer kit and ViRtSim software.

Ex No:9
Date:

IMPLEMENTATION OF STOP AND WAIT PROTOCOL


Aim:
To implement and test the stop and wait protocol using LAN trainer kit and ViRtSim.
Theory:
Stop and wait protocol is an efficient way of dealing errors during transmission. The
stop and wait protocol stop the transmission of packets when the loss of data or any other
error causes a negative acknowledgment to reach the transmitting computer (ie) the
transmitting computer wait for a kind of acknowledgment from the receiving computer. If
the receiving computer acknowledges the send data, the transmitting computer sends the
next data. If the receiver sends a negative acknowledgement then the transmitter
retransmits the data. This way the transmission is reliable.
Stop and Wait
Node A

Node B

1
Node

Node

Node

AC

Node

2
Node

Node
Node

Node

NAC
2

Node
Node

AC
Node
Node
Node

3
AC

Node
Node
Node

Procedure:
Step 1: connect the master/server to the computer NIC port.
Step 2: Select ViRtSim in the PC and then the utilities.
Step 3: Select ARM downloader and click read device ID.
Step 4: Reset the NIC 1 then the device ID will be read successfully.
Step 5: To load the ARM processor, select the respective hex bit file and click load flash.
Step 6: To load the FPGA processor, go to start
click on IMPACT.

all programs

Xilinx, Accessories and

Step 7: Create a new project on Boundary scan configuration, select the respective hex bit
File and load the FPGA chip.
Step 8: When is successfully loaded switch the kit to execution mode and reset.
Step 9: Select on the ViRtSim window to PC

Ping. Enter the host information and test

the connectivity.
Step 10: OSI LAN TRAINER

Protocol

Stop and Wait.

Step 11: connect the PC with the kit and send the data.
Step 12: While transmitting, enter the error by deleting the error bit -.
Step 13: A NAK frame will be transmitted to the sender and transmission will be stopped.
Step 14: error is then removed by resending the error bit -, the transmission is resumed.
Step 15: once data reaches the destination stop the execution.

Result:
Thus the stop and wait protocol was implemented and simulated using VI-LAN trainer kit and
ViRtSim software.

Ex No:10
Date:
IMPLEMENTATION OF GO BACK N PROTOCOL
Aim:
To implement and test the Go back N protocol using LAN trainer kit and ViRtSim.
Theory:
In Go back N protocol if one frame is damaged or lost, all frames send since the lost
frame acknowledged is retransmitted. The receiver sends an acknowledge frame for a group of
data frames. Only one acknowledgement is enough for a group of transmitted data. In case of lost
data frames the transmitter sends a negative acknowledgement with data frame that is damaged
or lost. Once the sender receives a NAQ, it retransmits the data. If there is a repetition the
receiver discards one of the data.
Procedure:
Step 1: Connect the master/server to the computer NIC port.
Step 2: Select ViRtSim in the PC and then the utilities.
Step 3: Select ARM downloader and click read device ID.
Step 4: Reset the NIC 1 and then the device ID will read successfully.
Step 5: To load the ARM processor, select the respective hex bit file and click load flash.
Step 6: To load the FPGA processor, go to start
and click on IMPACT.

all programs

Xilinx

Accessories

Step 7: Create a new project on Boundary scan configuration, select the respective hex bit
File and load the FPGA chip.
Step 8: When is successfully loaded switch the kit to execution mode and reset.
Step 9: Select on the ViRtSim window to PC

Ping. Enter the host information and test

the connectivity.
Step 10: OSI LAN TRAINER Protocol

Go back - N.

Step 11: connect the PC with the kit and send the data.
Step 12: While transmitting, enter the error by pressing the error button on the LAN kit as
many times as the number of frames in data.
Step 13: A NAK frame will be transmitted to the sender and transmission will be stopped.
Step 14: The transmission is resumed when the data is again send.
Step 15: Once data reaches the destination stop the execution.

Result:
Thus the Go back - N protocol was implemented and simulated using VI-LAN trainer kit
and ViRtSim software.

Exp No: 11

Date:

Study of Networksimulator (NS) and Simulation of Congestion


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

Theory:
NET WORK SIMULATOR (NS2)
Ns overview
Ns programming: A Quick start
Case study I: A simple Wireless network
Case study II: Create a new agent in Ns
Ns overview
Ns Status
Periodical release (ns-2.26, Feb 2003)
Platform support
FreeBSD, Linux, Solaris, Windows and Mac
Ns functionalities
Routing, Transportation, Traffic sources,Queuing disciplines, QoS
Wireless
Ad hoc routing, mobile IP, sensor-MAC
Tracing, visualization and various utilitie
NS(Network Simulators)
Most of the commercial simulators are GUI driven, while some network simulators
areCLI driven. The network model / configuration describes the state of the network
(nodes,routers, switches, links) and the events (data transmissions, packet error etc.). An
important output of simulations are the trace files. Trace files log every packet, every event that
occurred in the simulation and are used for analysis. Network simulators can also provide other
tools to facilitate visual analysis of trends and potential trouble spots.
Most network simulators use discrete event simulation, in which a list of pending "events"
is stored, and those events are processed in order, with some events triggering futureevents
such as the event of the arrival of a packet at one node triggering the event of the arrival of that
packet at a downstream node.
Simulation of networks is a very complex task. For example, if congestion is high, then
estimation of the average occupancy is challenging because of high variance. To estimate the

likelihood of a buffer overflow in a network, the time required for an accurate answer can be
extremely large. Specialized techniques such as "control variates" and "importance sampling"
have been developed to speed simulation.

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
There are a wide variety of network simulators, ranging from the very simple to the very
complex. Minimally, a network simulator must enable a user to represent a topology, Specifying
the nodes on the network, the links between those nodes and the traffic between the nodes. More
complicated systems may allow the user to specify everything about the protocols used to handle
traffic in a network. Graphical applications allow users to easily visualize the workings of their
simulated environment. Text-based applications may provide a less intuitive interface, but may
permit more advanced forms of customization.

Packet loss
Occurs when one or more packets of data travelling across a computer networkfail to reachtheir
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 highband widths. 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.

Exp No: 12
Date:
Study of Socket Programming & Client Server Model
Aim:
To implement socket programming date and time display from client to server using TCP
Sockets
ALGORITHM:
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 servers date and time to the client.
4.Read clients 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.
Client
1.Create a client socket and connect it to the servers 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.

PROGRAM:
//TCP Date Server--tcpdateserver.java
import java.io.*;
import java.util.*;
class tcpdateserver
{
public static void main(String arg[])
{
ServerSocket ss = null; Socket cs; PrintStream ps; BufferedReader dis; String inet; try
{
ss = new ServerSocket(4444); System.out.println("Press Ctrl+C to quit"); while(true)
{
cs = ss.accept();
ps = new PrintStream(cs.getOutputStream());

Date d = new Date()


ps.println(d);
dis = new BufferedReader(new InputStreamReader(cs.getInputStream())); inet = dis.readLine();
System.out.println("Client System/IP address is :"+ inet); ps.close(); dis.close();
}
}
catch(IOException e)
{ System.out.println("The exception is :" + e);
}
}
}
// TCP Date Client--tcpdateclient.java
import java.net.*;
import java.io.*; class tcpdateclient
{
public static void main (String args[]) { Socket soc; BufferedReader dis; String sdate;
PrintStream ps;
try { InetAddress ia = InetAddress.getLocalHost(); if (args.length == 0)
soc = new Socket(InetAddress.getLocalHost(),4444);

else soc = new Socket(InetAddress.getByName(args[0]),4444);


dis = new BufferedReader(new InputStreamReader(soc.getInputStream()));
sdate=dis.readLine(); System.out.println("The date/time on server is : " +sdate); ps = new
PrintStream(soc.getOutputStream());
ps.println(ia);
ps.close(); catch(IOException e)
{
System.out.println("THE EXCEPTION is :" + e);
}
}
}

RESULT:
Thus the program for implementing to display date and time from client to server using
TCP Sockets was executed successfully and output verified using various samples.

OUTPUT :
$ javac tcpdateserver.java $ java tcpdateserver
Press Ctrl+C to quit Client System/IP address is : localhost.localdomain/127.0.0.1
Client System/IP address is : localhost.localdomain/127.0.0.1
javac tcpdateclient.java $ java tcpdateclient The date/time on server is: Wed Jul 06
07:12:03 GMT 2011
Every time when a client connects to the server, servers date/time will be
returned to the client for synchronization.

Vous aimerez peut-être aussi