[go: up one dir, main page]

0% found this document useful (0 votes)
3 views5 pages

Simulating A Local Area Networkdg

Uploaded by

2022ee38d
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views5 pages

Simulating A Local Area Networkdg

Uploaded by

2022ee38d
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Simulating a Local Area Network

Aim :- Simulating a Local Area Network


Introduction
The increasing demand of computers in universities, organizations, offices leads to the
development of local area network(LAN). LAN allows to interconnect a number of independent
devices with each other within a limited area.
In this experiment we will learn about the simulation of different network topology used in
LAN using TCP/UDP connection and how the FTP/CBR will run over it.

Objectives
After completing this experiment you will be able to:
Learn about Local Area Network (LAN); different topologies and protocols uses in LAN
Learn about simulating a LAN using ns2
Time Required
Around 3.00 hours

Local Area Network


A local area network (LAN) provides networking capability to a group of computers in close
proximity to each other such as in an office building, a school, or a home. A LAN is useful for
sharing resources like files, printers, games or other applications. A LAN is often connected to
other LANs, which in turn are connected Internet.
LAN Topologies
Nodes in LAN are interconnected using one of four basic configurations:
Bus topology
Star topology
Ring topology
Mesh topology
Bus topology: In case of a bus topology, each machine is connected to a single cable through
some kind of connector. Terminators (resistors) are required at each end of the bus cable to
prevent the signal from bouncing back and forth on the cable.
Star topology: In local area networks with forming a star topology, each network host is
connected to a central hub (a signal booster or repeater). In contrast to the bus topology, the star
topology connects each node to the hub with a point-to-point connection. All traffic in the
network has to pass through the central hub.
Ring Topology: In local area networks where the ring topology is used, each computer is
connected to the network in form of a closed loop or ring. Each machine has a unique address
for their identification. Ring topologies typically utilize a token passing scheme to control
access to the medium. By utilizing this scheme, only one machine can transmit on the network
at a time.
Mesh Topology: In a mesh network where all nodes are connected to each other through one or
more hops.
MAC Protocols
Medium Access Control (MAC) protocols allows machines to access the communication
medium, and thereby to "take turns" at transmitting data.
MAC protocols could be broadly classified into three types:
Channel partitioning based protocols (TDMA, CDMA)
Random access based protocols (ALOHA, CSMA)
Taking turns (token passing, polling)
Contention Based Protocol: Carrier Sense Multiple Access / Collision Detection (CSMA/CD)
In Carrier Sense Multiple Access with Collision Detection all work stations listen to the shared medium. If there
is no ongoing transmission (by other devices), a workstation can transmit. However, if someone else is
transmitting, the workstation backs off and waits. If two or more workstations sense that the medium is free,
and start transmitting at the same time, a collision occurs! The end devices are however capable of detecting
this collision (from the energy level of the medium), and they stop transmitting under such scenario. Each
workstation waits for a random amount of time and tries again. CSMA/CD is non deterministic protocol. This
works only on wired networks -- collisions can't be detected on a wireless network. CSMA/CA based protocols
are used instead.
Taking turns
In this protocol each workstation takes turn in transmitting. A very common example is token ring LAN. Here a
software token is passed from one device to the next. Token ring is an example of deterministic protocol.
Ethernet
Ethernet is the most popular CSMA/CD protocol. It is standardized as IEEE 802.3. In Ethernet when only one
computer needs to transmit data, it can immediately (almost) access the line. However, when many computers
want to access the medium frequently it generates a high traffic. This results in high average waiting time and
higher chances of collision. In other words, when the size of a LAN increases, it's performance decreases. For
example, an Ethernet network with more than 5% collision rate could indicate that the network is getting
loaded. When the rate crosses 10%, the network could be considerably overloaded [v].
Ethernet Frame Structure

An Ethernet frame
consists of the following fields:
Preamble: 7 bytes with pattern 10101010 followed by one byte with pattern 10101011. It is used to
synchronize the receiver, sender.
Addresses: Destination and source MAC address each 6 bytes long.
Type: It indicates the higher layer protocol.
CRC: Cyclic Redundancy Check is used for error detection, and correction to some extent.
Ethernet Versions
Following are the different categories of Ethernet available commercially:
10Base2: It is commonly called thin Ethernet. It operates at 10 Mbps and its maximum segment length is of
200m.
10Base5: Also known as thick Ethernet. It also operates at 10 Mbps, but could extend upto a maximum distance
of 500m.
10BaseT: An Ethernet standard that transmits at 10 Mbps basebad signal over twisted wire pairs (telephone
wire). Its maximum segment length is of 100m.
10BaseF: This kind of Ethernet use fiber optic cable. Its maximum segment length is of 200m.
GbE: Gigabit Ethernet, which operates at 1000 Mbps.
Simulating a LAN using Network Simulator 2
The network simulator simulates the three levels related to local area network. They are:
Link layer protocols such as ARQ
MAC protocol
Physical Channel
There are seven required parameters to setup a LAN with ns2:
A group of nodes which are to be connected to form a LAN
Delay for the link
Bandwidth of the link
Link layer type e.g. "LL"
Interfacing queue e.g."Queue Drop Tail"
MAC layer type
Channel type
The following code shows how to setup a LAN with three nodes forming a bus topology, CSMA/CD based
MAC protocol and a DropTail queue attached to the link:
1 set lan [$ns newLan "$n3 $n4 $n5" 0.5Mb 40ms LL Queue/DropTail MAC/Csma/Cd Channel]
The nodes $n3, $n4, $n5 must be created as usual before the above statement could be executed. However, the
above creates nodes of a different type: LanNode. This implementation of node helps to simulate the contention
over a shared medium as found in a LAN [i, vi].
Steps for conducting the experiment
General Instructions
Follow are the steps to be followed in general to perform the experiments in Advanced
Network Technologies Virtual Lab.
Read the theory about the experiment
View the simulation provided for a chosen, related problem
Take the self evaluation to judge your understanding (optional, but recommended)
Go to the exercises section, choose a problem, and carefully read the problem description
Write a script (or make necessary changes) to simulate the desired scenario in the code editor just below the
problem statement
Click on the 'Run' button to execute the simulation script
Simulation with ns2: If the simulation was successful, and was instructed to create a trace file, contents of the
trace file would be displayed in the area below the 'Run' button
Simulation with ns3: If the simulation was successful, output of the program would be displayed in the
area below the 'Run' button
A trace file generated as a result of simulation with ns2 could be used for certain kind of analysis, which would
be discussed in a later section
Experiment Specific Instructions
Create the nodes
Set up a LAN using the desired nodes
Create agents and attach them to the nodes
Create applications and attach them to the agents
Define a finish procedure
Run the simulation
After the simulation has run successfully and the trace file is generated, analyze the trace file with the tool
provided at the bottom of the exercise page
Trace File Analysis
A simple tool has been provided as part of this lab to analyze the trace files generated after
simulation with ns2. A summary of the available options, and usage guide is given below.
Features List
Following is a list of functionalities provided by the Trace Analysis tool:
Trace file formats: Following trace file formats are being supported:
Wired
Wireless (new format)
Satellite -- currently redirects to wired mode
Mixed -- when both wired and wireless connections are present in the simulation
General Statistics: To provide some common statistics about the simulation being run. Currently displays only
the simulation duration.
Inputs: None
Output: Text
Average Throughput: Computes total # of bytes received by a node over the entire simulation duration
Inputs: Node #
Output: Number
Bytes Received: Plots cumulative count of bytes received by a node over the entire simulation duration
Inputs: Node #; for wireless scenario, trace levels (AGT, MAC, RTR)
Output: Graph
End-to-end Delay: Plots the end-to-end delay delay encountered by packets while moving from a source node
to the destination node
Inputs: Source node #, destination node #, scaling factor [optional] -- scaling factor helps to amplify the y-axis
values
Output: Graph
Packet Retransmissions: Plots # of retransmission(s) of a given packet occurs between the source and
destination nodes
Inputs: Source node #, destination node #
Output: Graph
Hop Count: Plots the # of hops traveled by a packet to reach the destination node from the source node. It
counts the destination node as well.
Inputs: Source node #, source port #, destination node #, destination port #
Output: Graph
Limitations
For analyzing the problems in the "Satellite Networks" experiment, please use the Wired mode of analysis
Analysis of trace files for mixed mode of simulations (wired & wireless) is not supported currently
Outputs produced do not necessarily have accuracy for scientific publications. In particular, the plot of hop
counts may vary a bit from the original count (in wireless mode) in cases when a packet has been forwarded to
more than one node.
The tool currently allows only a single instance of a given type of plot. For example, this doesn't let you plot
end-to-end delays between multiple (source, destination) node pairs
Simulating link errors

Consider the following topology:


Here node # 2 act as a router. Any traffic to or from the LAN passes through it. Consider node #
1 running a FTP server, and node # 5 is downloading a file of size 4 MB. However, the link
between node # 2 and # 3 is fault. It drops packets with a fixed probability of 0.2. Implement a
link error model to reflect this.
It may be noted here that the file download time will be more than the we had in exercise # 2 of
experiment # 1. Try different values of the simulation time to ensure that the file has been
entirely transferred. Is the plot of bytes received a linear curve or non-linear? Why?
Presence of link errors cause one or more packets to be retransmitted. Verify this from the
"Packet Retransmissions" plot.

Results & Discussions


The "Bytes Received" plot is a cumulative plot of Kbits received by a node. The graph would
be linear when the concerned node receives constant amount of data all the time. However,
presence of link errors make variable amount of data available to the node. Hence the graph is
non-linear.

You might also like