CN Lab File
CN Lab File
CN Lab File
LAB MANUAL
Computer Networking
1
Page
Department Of Computer Science and Engineering
List of Experiments
1. Study of Different Type of LAN& Network Equipment.
2. Study and Verification of standard Network topologies i.e., Star, Bus, Ring etc.
7. Study and Installation of Standard Network Simulator: N. S-2, N. S-3. OpNet, QualNet etc.
8. Study & Installation of ONE (Opportunistic Network Environment) Simulator for High Mobility
Networks.
9. Configure 802.11WLAN.
11. Study & Simulation of MAC Protocols like Aloha, CSMA, CSMA/CD and CSMA/CA using Standard
Network Simulators.
12. Study of Application layer protocols- DNS, HTTP, HTTPS, FTP and Telnet.
2
Page
Department Of Computer Science and Engineering
Experiment no.-1
Description:
There are so many different types of computer networks in existence, it can be hard to understand the
differences between them, particularly the ones with very similar-sounding names. This lesson explains the
structures and functions of some of the most popular computer networks.
Types of Networks
There are several different types of computer networks. Computer networks can be characterized by their
size as well as their purpose.
The size of a network can be expressed by the geographic area they occupy and the number of computers
that are part of the network. Networks can cover anything from a handful of devices within a single room to
millions of devices spread across the entire globe.
In terms of purpose, many networks can be considered general purpose, which means they are used for
everything from sending files to a printer to accessing the Internet. Some types of networks, however, serve
a very particular purpose. Some of the different networks based on their main purpose are:
A personal area network, or PAN, is a computer network organized around an individual person within a
single building. This could be inside a small office or residence. A typical PAN would include one or more
computers, telephones, peripheral devices, video game consoles and other personal entertainment devices.
3
If multiple individuals use the same network within a residence, the network is sometimes referred to as a
Page
home area network, or HAN. In a very typical setup, a residence will have a single wired Internet connection
Department Of Computer Science and Engineering
connected to a modem. This modem then provides both wired and wireless connections for multiple devices.
The network is typically managed from a single computer but can be accessed from any device.
This type of network provides great flexibility. For example, it allows you to:
Send a document to the printer in the office upstairs while you are sitting on the couch with your
laptop.
If this sounds familiar to you, you likely have a PAN in your house without having called it by its name.
A local area network, or LAN, consists of a computer network at a single site, typically an individual
office building. A LAN is very useful for sharing resources, such as data storage and printers. LANs can be
built with relatively inexpensive hardware, such as hubs, network adapters and Ethernet cables.
The smallest LAN may only use two computers, while larger LANs can accommodate thousands of
computers. A LAN typically relies mostly on wired connections for increased speed and security, but
wireless connections can also be part of a LAN. High speed and relatively low cost are the defining
characteristics of LANs.
LANs are typically used for single sites where people need to share resources among themselves but not
with the rest of the outside world. Think of an office building where everybody should be able to access files
on a central server or be able to print a document to one or more central printers. Those tasks should be easy
for everybody working in the same office, but you would not want somebody just walking outside to be able
to send a document to the printer from their cell phone! If a local area network, or LAN, is entirely wireless,
it is referred to as a wireless local area network, or WLAN.
A metropolitan area network, or MAN, consists of a computer network across an entire city, college
campus or small region. A MAN is larger than a LAN, which is typically limited to a single building or site.
Depending on the configuration, this type of network can cover an area from several miles to tens of miles.
A MAN is often used to connect several LANs together to form a bigger network. When this type of
network is specifically designed for a college campus, it is sometimes referred to as a campus area network,
or CAN.
A wide area network, or WAN, occupies a very large area, such as an entire country or the entire world. A
WAN can contain multiple smaller networks, such as LANs or MANs. The Internet is the best-known
example of a public WAN.
4
Network equipment’s:-
Page
Department Of Computer Science and Engineering
The different type of hardware found in a LAN environment. The following discussion addresses the
suitability for different environments of various types of hardware.
Hubs, Bridges, and Switches. How each piece of hardware functions specifically in an Ethernet
environment.
ROUTER
A router is a device for connecting computer networks to one another, used for handling the routing of
packets between two networks, or to determine the path that a data packet shall take. When a user enters a
URL, the Web client (the browser) queries the domain name server, which shows it the IP address of the
desired machine.
The workstation sends the request to the nearest router, i.e. to the default gateway on the network it is
located on. This router determines the next machine to which the data will be forwarded, in such a way as to
choose the best pathway possible. To do so, the routers keep up-to-date routing
tables, which are like maps showing the paths that can be taken to get to the destination address. There are
numerous protocols designed to handle this process.
In addition to their routing function, routers are also used to manipulate data travelling in the form of
datagram so that they can go from one kind of network to another. As not all networks are able to handle the
same size of data packets, routers are tasked with fragmenting packets so they can travel freely.
HUBS
A hub is often used to connect small LAN segments in which the number of devices is generally 24 or
fewer, and hubs are multiport repeaters. Hubs are used to create collision domains, in which all devices on
5
the network can see each other. In larger designs, signal quality begins to deteriorate as segments exceed
Page
their maximum length, often a couple hundred feet. Hubs provide the signal amplification required to allow
Department Of Computer Science and Engineering
a segment to be extended a greater distance. A hub takes an incoming signal on any one port and repeats it
out all ports to enable users to share the Ethernet network resources.
Ethernet hubs create star topologies in 10-Mbps or 100-Mbps half-duplex Ethernet LANs. It is the hub that
enables several point-to-point segments to be joined together into one single network, and it is this network
of hubs that makes up a shared Ethernet, just as several point-to-point roads join together into the single
large network of roads you use to get around town.
A shared Ethernet LAN means that all members of the network are contending for transmission of data onto
a single network (collision domain); individual members of a shared network get only a percentage of the
available network bandwidth.
Shared Ethernet (Total Bandwidth Shared Among Attached Hosts)
One end of the point-to-point link is attached to the hub, and the other is attached to the network device,
such as a computer or printer. Connecting multiple hubs together expands the shared Ethernet segment but
puts more stress on the line's bandwidth because now more users are trying to use the same bandwidth. This
is similar to building a new neighborhood without adding roads and thus putting stress on existing roads. As
you and your car sit stuck in traffic, so might your data suffer in network congestion.
Network bridges are one way to prevent this congestion. Network bridges function like hubs in that bridges
provide a network connection; however, bridges preserve the separation of these network segments by
keeping network traffic local to its respective segment instead of repeating it all to the world. Bridge
operation is discussed in detail in the following section.
BRIDGES
Repeaters and hubs have no intelligence; they just repeat whatever signal is received from one port out
all ports without looking at what is being sent or received. Bridges add a level of intelligence to the
network by using the MAC address to build a table of hosts, mapping these hosts to a network segment
and containing traffic within these network segments. For example, below Figure illustrates a bridged
network with two network segments.
Segments 1 and 2 contain two workstations each, a file server (for file sharing) and a network printer.
A hub in this scenario is not the preferred method because of the contention for the network bandwidth. In
this scenario, a bridge is a better choice than a hub because the bridge segments the network into two
smaller parts an engineering team segment and a financial team segment keeping traffic local to its
respective segment.
Ethernet bridges map the MAC addresses of the network devices, or nodes, residing on each network
segment. Bridges allow only necessary traffic to pass through the bridge, such as traffic destined for a
segment other than the source. When a frame is received by the bridge, the bridge looks at the frame
header and reads the source and destination MAC addresses, determining the frame sender and
destination. If the frame's source and destination segments are the same, the frame is dropped, or filtered
by the bridge; if the segments differ, the bridge forwards the frame to the correct segment.
Figure illustrates a small bridged network with three network segments.
Bridge Connecting Three LAN Segments
7
Page
Department Of Computer Science and Engineering
If the bridge sees a frame arrive on port 1 from Host 9, the bridge concludes that Host 9 can be reached
through the segment connected to port 1. If the same bridge sees a frame arrive on port 2 from Host 12, the
bridge concludes that Host 12 can be reached through the network segment
connected to port 2, as illustrated in below Figure Through this learning process, bridges build a table, such
as shown in Table
SWITCHES
Hubs create a network environment in which each connected device shares the available network
bandwidth with other devices contending for the same network resources, as illustrated in below Figure .
Shared Network
8
Page
Department Of Computer Science and Engineering
The hub is connecting six workstations together, each sharing the network bandwidth. A finite amount of
network bandwidth is available. For example, 10BASE-T Ethernet provides 10 Mbps, and the more
workstations added to this network, the less bandwidth available for each. Switches address the shared
bandwidth issue and eliminate contention by dedicating a path between the source and the destination, as
illustrated in the below Figure .
Dedicated Network
9
Page
Department Of Computer Science and Engineering
Experiment no.-2
AIM : To study and verification of standard Network Topologies i.e Star, Bus,Ring etc.
Description:
The pattern of interconnection of nodes in a n/w is known as TOPOLOGY.The selection of the topology
for a network can’t be done in isolation as it affects choice of media and access net. There are no. of factors
to consider in making this choice:-
1. Cost.
2. Flexibility.
3. Reliability.
TYPE OF CONNECTIONS:-
A network is two or more device connected through links. A link is communication pathway that
transfer data from one device to another. There are two possible type of connections i.e point to point
and multipoint.
Point to point: This connection provides a dedicated link b/w two devices.The entire capacity of
link is reserved for transmission between those two device. Most point to point connection use as
length of wire or cables to connect two ends, but other option, such as microwave or satellite
links are also possible.
Multipoint: It is also k/n as multi drop connection. Here more than twospecific devices share
a single link.
In a multipoint environment capacity of channel is shared either spatially or temporally. If
several devices can use save link simultaneously, if is a spatially shared connection.If user must
take turns, if is a connection.
STAR TOPOLOGY
In star topology each device for a dedicated to point-to-point link only to a central controller, called a tab.
The device are not directly linked to one another : if one device wants to send data to another, it sends data
to controller, which then relays data to other connected device.
It is less expensive than mesh topology. In star topology each device needs only one link and one i/o part to
connect it to any no. of other.It is robust. If one only that link is affected. All other links remain.
10
Page
Department Of Computer Science and Engineering
BUS TOPOLOGY
It is a multipoint connection. One long cable acts as a backbone to link all devices in a n/w. nodes are
connected to bus cable by drop links and taps. A drop link is a connected running b/w device and main
cable. A tap is a connector that either special into main cable and punctures of a cable to create a contact
with metallic core. As a signal travels along back bone some of its energy is transferred into heat. Here it
becomes weaker and weaker as it travels further and further for this reason there is a limit or no. of taps a
bus can support and on distance between those taps. It is easy to install. It uses less cabling than mesh and
star topologies.
RING TOPOLOGY
In RT , each device has a dedicated point- to- point connection with only one two devices on either side of
it. A signal is passed only ring in one direction, from device to device until it reaches its destination. Each
device in ring in corporate a repeaters. When a device receives a signal intended for another device , its
repeater regenerates bits and passes them along.
In RT is relatively easy to install and .each one device is linked to only its immediate neighbour.
In RT fault isolation is simplified.
In RT a signal is circulating at all ties. If one device does not receive a signal with in a specified
period it can issue on alarm. The alarm alerts n/w operator to problem and its location.
MESH TOPOLOGY
In MT, every device has a dedicated point-to-point link to every other device. The term dedicated means
that link carries traffic only b/w two device it connects. To no. of physical links is a fully connected mesh
n/w with n nodes, we first consider that each node must be connected to every other node. In a mesh
topology we need n(n-1)/2 duplex –node links. To accommodate that many links, every device on n/w must
have (n-1) i/o ports to be connected to other (n-1) stations.
HYBRID TOPOLOGY
A network can be hybrid for eg. We can have main star topology with each branch connecting several
station in a bus topology.
11
Page
Department Of Computer Science and Engineering
Experiment No.-3
AIM: - To study communication guided media system and various types of connectors.
Description:
By communication system, it is meant that connecting cable or connecting media are being talked about.
The cables that correct two or more workstations are communication channels.
a) Guided Media
b) Unguided Media
GUIDED MEDIA
2. Coaxial cable
3. Optical fibers
1. TWISTED PAIR CABLE: It is the most common form of wiring in data communication
applications. As a voice grade medium (VGM), it is the basis for most internal office telephone
wiring. It consists of two identical wires wrapped in a double coated cover.
Different types of twisted pair cable exist, but they all have two things in common: -
Twisting of wires returns crosstalk, which is bleeding of a signed from one wire to another & which can
corrupt signal & cause network errors.
1. Simple
2. Easy to install & maintain.
3. Physically flexible.
12
4. Less weight.
5. Inexpensive.
Page
1. Unshielded Twisted Pair Cable (UTP): It is used for variety of electronic communication. It is
available in five categories.
2. Shielded Twisted Pair Cable (STP): It has shielding of individual pair of wires, which further protect
it from external interference. It also has maximum segment length of 100 meters.
TYPE DESCRIPTION
2.COAXIAL CABLE: It consist of a solid wire core surrounded by one or more foil or wire shields each
separated by some kind of plastic insulator. It is better than twisted pair cable.
1. Its data transmission characteristics is considerably better than those of twisted pair cable.
2. It can be used as basis for a shared cable.
3. It can be used for broadband transmission.
4. Offer higher bandwidth up to 400 Mbps.
b) Thin Net: It is thinner & it can have max segment length of 185 meters.
3.OPTICAL FIBRES: It consist of glass or glass like material which are so constructed that they carry light
from a source at one end of fiber to a detector at other end.
a) Core
b) Cladding
c) Protective coating
3. It can be used for broadband transmission where several channels are handled in parallel & where it
is possible to data from channels with channels for telescope, graphics, TV & sound.
UNGUIDED MEDIA
1. MICRO WAVE: microwave signals are used to transmit data without use of cables. These are
similar to radio & TV signals are used for long distance communication. Its transmission consist of a
transmitter, receiver & atmosphere.
ADVANTAGES OF MICROWAVE
i) Cheaper
ii) Gives freedom from land acquisition that are required for laying, repairing, cables.
iii) It offers ease of communication over different training.
iv) It has the ability to communication over oceans.
2.RADIO WAVE: If transmission use of radio frequency there it is known as radio wave transmission. Any
radio setup has two parts:
a) Transmitter
b) Receiver
a) TRANSMITTER: Transmitter takes some sort of message encodes it onto a sine wave & transmits
it with radio waves.
b) RECEIVER: It receives radio waves & decodes message from sine wave it receives.
It gives mobility.
3.SATELLITE: It is special core of microwave relay system. It uses synchronous satellite to relay radio
signal transmitted from ground station.
ADVANTAGES OF SATELLITE:
ii) COAXIAL CABLE CONNECTORS: To connect coaxial cable to devices, we need coaxial
connectors. Its most common type is BNC connectors. Its most popular types are:
a) BNC connectors
b) BNC T connectors
c) BNC terminator
14
iii) FIBER OPTIC CABLE CONNECTORS: There are 3 types of connectors for fabric cable.
It is used for connecting cable to network devices. It uses a payment locking system and is more reliable
than SC.
3. MT-RJ CONNECTORS:
15
Page
Department Of Computer Science and Engineering
Experiment No.-4
Description:
Some connecting devices can be used to connect LANS in a backbone network. A backbone network
allows several LANS to be connected. In a backbone network, so station is directly connected to
backbone, connects LANS. The backbone is itself a LAN that uses a LAN protocol such as Etternet, each
connection to the backbone is itself another LAN.
Different architectures can be used for a backbone, the two most common are : The Bus & The Star.
BUS BACKBONE:
In a bus backbone, topology is a bus. The backbone itself can use one of the protocols that support a
BUS topology such as10Base5 or 10Base2.
These are normally used as a distribution backbone to connect different buildings in an organization. Each
building can comprise there a SINGLE LAN or another backbone. e.g. A good example of a bus backbone
is one that connects single or multiple floor buildings on a campus. Each single floor building usually has a
single LAN. Each multiple floor building has a backbone that connects each LAN on a floor. A bus
backbone can interconnect these LANS & backbones.
STAR BACKBONE:
It is sometimes also known as COLLAPSED or SWITCHED backbone. Here topology of backbone is a
star. Here backbone is just one switch (that is why it is called, erroneously, a collapsed backbone) that
connects LANS. In this configuration, the switch does the job of the backbone & at the same time connects
the LANS.
These are mostly used as a distribution backbone inside a building. In a multifloor building, we find one
LAN that serves each particular floor. A star backbone connects these LANS. The backbone network, which
is just a switch, can be installation in basement or the first floor & separate cables can run from the switch to
each LAN.
Another common application for a backbone network is to connect remote LANS. This type of backbone
network is useful when a company has several offices with LANS & needs to connect them. The connection
can be done through bridge, sometimes called REMOTE bridges. The bridge act as connecting devices
connecting LAN & point-to-point network such as leased telephone lines or ADSL lines. The point-to-point
network in this case is considered a LAN without stations. The point-to-point lines can use a protocol such
as PPP.
VIRTUAL LANS: -
It is defined as a local area network configured by s/w, not by physical wiring. The whole idea of
VLAN technology is to divide a LAN into logical, instead of physical, segments. A LAN can be
divided into several logical LANS called VLANS. Each VLAN is a work group in the organization.
16
If a person from one group to another, there is no need to change physical configuration. The group
membership in VLANS is defined by S/W not L/W. Any station can be logically moved to another
Page
VLAN. All members belonging to a VLAN can receive broadcast messages sent to that particular
VLAN. This means that if a station
Department Of Computer Science and Engineering
from VLAN1 to VLAN2, it receives broadcast messages sent to VLAN2 but no longer receives
broadcast messages sent to VLAN1. It even allows grouping of stations connected to different switches
in a VLAN.
VLAN group stations belonging to one or more physical LANS into broadcast domains. Stations in a VLAN
communicate with one another
17
Page
Department Of Computer Science and Engineering
Experiment No.-5
Description:
IN error correction we need to know the exact number of bits that are corrupted & more importantly ,their
location in message. The no. errors & size of msg are important factors.
CODING : Redundancy is achieved through various coding schemes. Sender addsredundant bits through a
process that creates a relationship between redundant bit & actual data bits. Receiver checks relationship
between two sets of bits to detect or correct errors. Ratio of redundant bits to data bits & robustness of
process are important factors in any coding scheme.
MODULAR ARITHMETIC: In modular arithmetic we use only a limited rangeof integers. We define an
upper limit, called a modules-N. We then use only integers 0 to N-1 inclusive. This is modulo-N
arithmetic.
BLOCK CODING: In block coding, we derived on msg in to blocks each of K-bits, called data words. We
add r redundant bits to each block to make length [r=k+r]. The resulting r-bit blocks are called code words.
We have a set of data words each of size K & a set of code words, each of size n. With K bits we can create
a combination of 2k data words we can create a combination of 2 k code words. Since n>k, the no of possible
code words is longer then no. of possible data words. Block coding process is always encoded as the save
codeword. This means that we have 2 n-2k codeword are not used. These codeword are known as INVALED
or ILLEGAL.
HAMMING DISTANCE: It is one of central concept in coding for error control.It is the no. of differences
between corresponding bits (between two words). We show Hamming distance between two words x & y as
d(x,y). It can easily be found if we apply XOR operation or the two words & count the no. of 1’s in the reset.
Its value is grater then zero.
MINIMUM HAMMING DISTANCE: It is the smallest hamming distancebetween all possible pairs
in set of words. We use dmin to define the minimum hamming distance in a coding scheme.
LINEAR BLOCK CODES:In a linear code XOR of any two valid code wordscreates another valid code
words.
MINIMUM DISTANCE LINEAR BLOCK CODES: The minimum hamming distance is no. of 1’s in
nonzero valid code words with the smallest number of 1’s.
CYCLIC CODE: These are special linear block codes with are extra property. Ina cyclic code, if a code
word is cyclically shifted (rotated) the result is another code word e.g., if 1011000 is a code word &
cyclically left-shift, then 0110001 is also a code word if we call bits is the first word a0 to a6 & bits is
second word bo to b6 can shift the bits by using following.
b1 = Q0 , b2= Q1 , b3 = Q2 , b4 = Q3 , b5 = Q4 , b6 = Q5 , b0 = Q6
CYCLIC REDUNDENCY CHECK: We can create codes to correct error. CRC is used is network
services LANS & WANS.
PROGRAM FOR CALCULATION OF CRC (CYCLIC RECIDENCY CHECK).
#include<stdlib.h>
#unclude<conio.h>
printf (“Transmitter side:”); printf (“\n enter no of data bits:”); scanf (“%d”, &n);
printf (“enter data:”); for (i=0; i<n; i++) scanf (“%d”, &arr*i+);
do
{
printf (“enter generator”); for (j=0; j<g; j++) scanf (“%d”, & gen*j+);
}
while (gen [0]! =1)
{
if (arr [i]==o)
}
else
arr [i] = arr [i] gen [0];
arr [i+1] = arr [i+1] gen [1]; arr [i+2] = arr [i+2] gen [2]; arr [i+3] = arr [i+3] gen [3];
}
}
printf (“\n\t The CRC is:”);
OUTPUT
10100001111
20
Page
Department Of Computer Science and Engineering
Experiment No.-6
Character-oriented framing was popular when only text was exchanged by the data link layers. The flag
could be selected to be any character not used for text communication. However, if we send other types of
information such as graphs, audio, and video. Any pattern used for the flag.
could also be part of the information. If this happens, the receiver, when it encounters this pattern in the
middle of the data, thinks it has reached the end of the frame.
To fix this problem, a byte-stuffing strategy was added to character-oriented framing. In byte stuffing (or
character stuffing), a special byte is added to the data section of the frame when there is a character with the
21
same pattern as the flag. The data section is stuffed with an extra byte. This byte is usually called the escape
Page
Department Of Computer Science and Engineering
character (ESC), which has a predefined bit pattern. Whenever the receiver encounters the ESC character, it
removes it from the data section and treats the next character as data, not a delimiting flag.
Byte stuffing by the escape character allows the presence of the flag in the data section of the frame, but it
creates another problem. What happens if the text contains one or more escape characters followed by a
flag? The receiver removes the escape character, but keeps the flag, which is incorrectly interpreted as the
end of the frame. To solve this problem, the escape characters that are part of the text must also be marked
by another escape character. In other words, if the escape character is part of the text, an extra one is added
to show that the second one is part of the text. The following figure shows the situation.
Character-oriented protocols present another problem in data communications. The universal coding systems
in use today, such as Unicode, have 16-bit and 32-bit characters that conflict with 8-bit characters. We can
say that in general, the tendency is moving toward the bit-oriented protocols.
This flag can create the same type of problem we saw in the byte-oriented protocols. That is, if the flag
pattern appears in the data, we need to somehow inform the receiver that this is not the end of the frame. We
22
do this by stuffing 1 single bit (instead of 1 byte) to prevent the pattern from looking like a flag. The strategy
Page
Department Of Computer Science and Engineering
is called bit stuffing. In bit stuffing, if 0 and five consecutive 1 bits are encountered, an extra 0 is added.
This extra stuffed bit is eventually removed from the data by the receiver. Note that the extra bit is added
after one 0 followed by five 1s regardless of the value of the next bit. This guarantees that the flag field
sequence does not inadvertently appear in the frame.
The following figure shows bit stuffing at the sender and bit removal at the receiver. Note that even if we
have a 0 after five 1s, we still stuff a 0. The 0 will be removed by the receiver.
This means that if the flag like pattern 01111110 appears in the data, it will change to 011111010
(stuffed) and is not mistaken as a flag by the receiver. The real flag 01111110 is not stuffed by the sender
and is recognized by the receiver.
23
Page
Department Of Computer Science and Engineering
Experiment No.-7
Description:
TCL has become a popular choice of programming language for a diverse range of applications. This is a
platform used in UNIX, MICROSOFT, WINDOWS AND APPLE MAC OS.
Good.tcl
Put $s
TCL is an interpreted language & TCL program are referred to as scripts.TCL scripts have to be
executed by a TCL shell, known as a tcls1
The following will run a good.tcl script
$tclsc1 good.tcl
Good morning
The source command can be used to make tcls1 take command from a file let us make TCL read our
program again.
$ source. Good.tcl
Good Morning
% ext
Ext command causes TCL shell to end & returns us to TCL Unix Shell. We can turn out script into a Unix
program by specifying interpreter to use an the first line.
Save following in a file, say good1.tcl
# /usr/bin/tclsh
Put $s
$ chmod +x good1.tcl
Page
$ good1.tcl
Department Of Computer Science and Engineering
It is important to note that location of TCL shell tclsh, may vary from system to system. In our case, it has
been installed in /usr/bin.
TCL COMMANDS
Generally all TCL commands take same form. They always begin with a keyword followed by zero or more
arguments. TCL is easy to learn & simple to extend. One can place multiple TCL commands on the same
line by separating them with semicolon. TCL deals with strings & groups of strings.
%
Variable names are case sensitive & they can be of any length.
a$
% put s $ a
999
5. A variable is replaced with its value whenever its name appears preceded by a dollar sign.
Description:
Network Simulator 2 (NS2) is a program designed to enable the simulation of networking scenarios without
having the actual hardware. It can be used to test many aspects of a networking environment including the
development of new protocols.
The program it self is notoriously difficult to install and runs on either windows (using Cygwin or the native
windows version) or Linux. For the purpose and functionality of NS2, Cygwin is the preferred method of
running NS2 within windows.
Cygwin Install
1. Go to http://www.cygwin.com/ and download the latest version (Latest Cygwin DLL release version is
1.5.22-1)
2. Run setup.exe
4. Leave the all the default entries including the install directory as this makes things a little easier when
browsing the computer via XWindows.
26
Page
Department Of Computer Science and Engineering
5. Install local package (This is the default install directory where files are stored and extracted for later
use… This is not essential as all programs can be retrieved from the internet so this folder can be deleted to
save space but is good to keep)
7. Select packages
28
Page
Department Of Computer Science and Engineering
Accept all the defaults but you need to add all 9 of these extra packages
Automake
Make
Patch
Perl
X86 libraries
Window Maker
Nano Text editor (Optional… If you are not used to VI or other UNIX editors)
This may take a while depending on the speed of your Internet connection and the speed of your system as
this stage will extract and finalize the install.
NS2 Install
Firstly run up Cygwin and make sure that all is ok. Run XWindows and some application that works within,
try xclock.
30
Try running a windows manager, I selected Windows Maker during the install selection as this I my
preferred method.
Page
Department Of Computer Science and Engineering
Then go to Cygwin and go to the directory where you just downloaded the file and type the command
between the parenthesis including the space and hyphen at the end.
Once this has finished (can take a long time depending on system speed)
cd in to the directory just created “/home/%USERNAME%/ns-allinone-2.29”
Now type the command (./install) dot slash install.
Let NS2 run the course, this can also take a while.
Environmental Variables
To do this you have to go to your home directory and locate the file .bashrc
The .bashrc in this directory is your login script. You can change shells, set bash scripts and add
environmental variables.
I use the UNIX file editor VI if you are not familiar with VI I advises you to use the NANO editor as this is
an easier interface to use.
You can also use a windows editor if you browse to the path c:\cygwin\home\%USERNAME% and edit
the .bashrc files
31
The add these lines but be sure to change the directories to the same as your systems set up and be sure to
change any version numbers.
Page
export NS_HOME=/home/%USERNAME%/ns-allinone-2.29
Department Of Computer Science and Engineering
export PATH=$NS_HOME/tcl8.4.11/unix:$NS_HOME/tk8.4.11/unix:$NS_HOME/bin:$PATH
export LD_LIBRARY_PATH=$NS_HOME/tcl8.4.11/unix:$NS_HOME/tk8.4.11/unix:\$NS_HOME/otcl-
1.11:$NS_HOME/lib:$LD_LIBRARY_PATH
export TCL_LIBRARY=$NS_HOME/tcl8.4.11/library
Reload Cygwin, and then type “which NS” and “which NAM”. If you get a path shown then you are ok if
not you will have to check your paths again.
32
Page
Department Of Computer Science and Engineering
Experiment No.- 10
AIM:- Configure 802.11 WLAN.
Description:
Introduction
This document provides information on how 802.11n technology works and how to configure 802.11n on
the Wireless LAN Controller (WLC).
Prerequisites
Requirements
Cisco recommends that you have knowledge of these topics:
How to configure a WLC for basic operations
Lightweight Access Point Protocol (LWAPP)
Components Used
The information in this document is based on these software and hardware versions:
WLC 4404 that runs software version 5.1.151.0
Cisco Aironet 1250 series Access Point (AP)
Intel Wireless client card adapter
The information in this document was created from the devices in a specific lab environment. All of the
devices used in this document started with a cleared (default) configuration. If your network is live, make
sure that you understand the potential impact of any command.
Related Products
This document can also be used with these hardware and software versions:
Cisco 2100 series WLC
Cisco Catalyst 6500 Series/7600 Series Wireless Services Module (WiSM)
Cisco Catalyst 3750 Series Integrated WLCs
Cisco WLC Module
Conventions
Refer to Cisco Technical Tips Conventions for more information on document conventions.
802.11n - An Overview
33
Wireless networks are widely deployed in industrial and domestic environments. New applications are
Page
emerging to meet customer needs. Many of these applications are bandwidth intensive. Multimedia
Department Of Computer Science and Engineering
applications require more bandwidth for improved performance. 802.11n addresses these challanges by
providing throughput as high as 600 Mbps. It also provides better reliability and coverage when compared to
existing 802.11 a/b/g technology. This document provides an overview of how 802.11n works and how to
configure 802.11n on a WLC.
802.11n can operate either in 2.4 or 5 GHz. They are interoperable with existing 802.11a or 802.11 b/g
technologies. This section provides an overview of how 802.11n works. Currently, 802.11n is supported in
Cisco 1250 series APs and Cisco 1140 series APs.
How Does 802.11n Provide Greater Throughput
Various techniques are employed in 802.11n to provide higher data rates and better coverage. This section
details the techniques used.
MIMO: In the existing 802.11 a or 802.11 b/g technologies, transmission and reception of data streams
usually happen using only one of the antennas. However, in 802.11n data streams can be transmitted and
received over both the antennas. This results in a greater number of bits transmitted and received at a given
point of time, effective usage of multipath signals which is usually a problem in indoor coverage. This leads
to increased throughput and wider coverage. Table 1 shows the data rates of 802.11n currently supported by
Cisco1. MCS 0-7 are the data rates achieved using single spatial stream (data bits). MCS 8-15 are the data
rates achieved using 2 spatial streams, one over each antenna. Note that the data rates are doubled from 8-
15. These data rates (0-15) are described as MCS rates throughout this document.
Note: 1Further higher data rates are planned for future deployments.
Channel Bonding: The amount of data that can be transmitted also depends on the width of the channel
used in data transmission. By bonding or combining two or more channels together, more bandwidth is
available for data transmission. In 2.4 and 5 GHz frequency band, each channel is approximately 20 MHz
wide. In 802.11n, two adjacent channels, each of 20 MHz are bonded to get a total bandwidth of 40 MHz.
This provides increased channel width to transmit more data. Cisco does not support channel bonding in 2.4
GHz frequency (802.11 b/g), because only three nonoverlapping channels 1, 6 and 11 are available.
However, the channel bonding has more relevance in 5 GHz frequency range where you have as many as 23
adjacent non-overlapping channels currently available. Channel bonding is supported only in 5 GHz, for
example 802.11a. Table 2 shows the data rates achieved through channel bonding.
Frame Aggregation with A-MPDU: In 802.11, after transmission of every frame, an idle time called
Interframe Spacing (IFS) is observed before transmitting the subsequent frame
In 802.11n, multiple packets of application data are aggregated into a single packet. This is called A-MPDU
(Aggregated - MAC Protocol Data Unit). This reduces the number of IFS, which in turn provides more
time for data transmission. In addition, clients operating in 802.11n send acknowledgement for block of
packets instead of individual packet acknowledgement. This reduces the overhead involved in frame
acknowledgements and increases the overall throughput.
Decreased Timers: In 802.11n, few timers have been reduced to decrease the idle time between individual
frame transmissions.
1. Guard Interval (GI): In 802.11, data is transmitted as individual bits. A certain amount of time interval
is observed before the next bit is transmitted. This is called Guard Interval. GI ensures that bit transmissions
do not interfere with one another. As long as the echoes fall within this interval, they will not affect the
receiver's ability to safely decode the actual data, as data is only interpreted outside the guard interval. By
34
reducing this interval, data bits are transmitted in shorter intervals and provide for increased throughput.
Page
Table 1 shows how data rates differ based on the Guard Interval for a channel width of 20 MHz.
Department Of Computer Science and Engineering
Table 2 shows how data rates differ based on the Guard Interval for a channel width of 40 MHz.
Note: You can see that data rates are doubled from MCS 8 - MCS 15.
35
Page
1. Use QoS for LWAPP packets to ensure APs do not lose heartbeats with the controller due to a heavy load
added by 802.11n.
2. LAPs can be powered using a local power supply, power injector or an 802.3 af capable switch. 1140
series APs are easy to deploy as these APs can be fully powered using the existing 802.3 af standard.
However, in 1250 series APs, dual-band products (APs with both 802.11b/g/n and 802.11a/n radios) cannot
be fully powered by 802.3af and require 802.3at or a power injector to operate both transmitters in each
band.
802.3af can either support both transmitters on an AP with a single radio (either 802.11b/g/n or 802.11a/n),
or 802.11n with a single transmitter in each band (802.11b/g/n and 802.11a/n).
Note: M8 to M15 data rates are disabled because they require both transmitters in the band to be
operational.
3. 1250 series APscan support 802.11n with reduced power (11 dBm) for both transmitters in each band
(802.11b/g/n and 802.11a/n).
a. Requires Cisco switches with Enhanced POE (16.8W) and CDP.
b. M0 to M15 data rates are reduced due to reduced power but are still enabled.
4. Use only 20 MHz 802.11n mode in 2.4 GHz. Cisco supports both 20 MHz and 40 MHz (Channel
bonding) 802.11n mode only in 5GHz..
5. Use 20 MHz (Non-Channel Bonding) in 5 GHz (802.11 a/n) when:
a. Voice traffic is using 802.11a
b. 20 MHz is better in mixed .11a and .11n environments
6. Use 40 MHz (Channel Bonding) in 5 GHz (802.11a/n) when:
a. Traffic uses heavy bandwidth (video)
b. 40 MHz is better when most clients are 802.11n
Configuring 802.11n
Configure the WLC for 802.11n
This section shows how to configure the 5 GHz frequency band on the WLC for 802.11n support. Complete
these steps:
Note: These steps are similar for 2.4 GHz frequency band except that occurrences of 802.11a should be
replaced with 802.11 b/g.
1. Enable the 802.11n support on the 802.11a network.
36
Note: Before you enable 802.11n support, the 802.11a network needs to be disabled.
Department Of Computer Science and Engineering
3. 802.11n operates on the same channel as 802.11a. For better compatibility with 802.11n clients, it is
recommended to stay on lower channels (UNII-1 band). Check the list of channels used in channel
allocation for APs from the DCA Channel List menu under Wireless > 802.11a/n >DCA on the
WLC GUI. In order to include or delete a channel from the list, use the Select Channel list.
3. You can also manually configure the channel for an individual lightweight access point (LAP). This helps
to control the channel in an environment where only 802.11n clients connect. This makes troubleshooting
easier. Use this command:
(Cisco Controller) >config 802.11a channel AP001b.d4e3.a81b 36
!--- Sets 802.11a channel to 36 on AP AP001b.d4e3.a81b.
4. Channel bonding in 802.11a provides twice the normal throughput. You bind a channel with the next
adjacent channel in the frequency domain.
This is an example of channel bonding. Here the channel 36 is bonded with the adjacent channel to provide a
channel width of 40 MHz.
(Cisco Controller)> config ap <AP Name>
(Cisco Controller)> config 802.11a disable <Ap name>
(Cisco Controller)> config 802.11a channel <Ap name> 36
Set 802.11a channel to 36 on the specified AP.
(Cisco Controller)> config 802.11a txpower <Ap name> 1
37
6. Unless the network is comprised only of 802.11n clients, use Mixed mode protection so the 802.11n
clients coexist with existing 802.11a or 802.11 b/g clients.
7. Set the Channel Width either in Auto mode so the client negotiates the channel width with the WLC,
or in 20 MHz if it is 2.4 GHz frequency band.
39
Page
Department Of Computer Science and Engineering
Note: Cisco supports 40 MHz only in 5 GHz band. Set the channel width option to Auto to make use of 40
MHz channel width. However, make sure 40 MHz channel width is enabled on the WLC.
8. Disable the Fat Channel Intolerant property to allow 40 MHz Channel Bonding.
2. Factors such as Channel width, Guard Interval and Reduced IFS (RIFS) play a major role in the
bandwidth. Table 1 and Table 2 show how these factors affect the bandwidth.
3. Clients ability to send a Block Ack instead of individual frame acknowledgements.
4. MCS Index configured on the WLC.
5. Proximity to AP—Clients closer to the AP experience higher data rates. As clients move farther away
from the AP, signal strength reduces. As a result, data rate decreases steadily.
6. RF environment—Amount of noise and interference in the environment. The less the noise and
interference, the greater the bandwidth.
7. Encryption/ Decryption—Encryption in general reduces the throughput due to the overhead involved in
the data encryption/decryption process. However, advanced encryption standards, such as AES, can provide
better throughput when compared to other encryption standards, such as TKIP and WEP.
8. Wired Network Infrastructure—Bandwidth of the wired infrastructure determines the speed of the traffic
to and from the wired network to the wireless clients.
9. If using an AP1250, change the AP to H-REAP mode for a 5-10% boost.
10. If using an AP1140, keep the AP in local mode and enable TCP MSS on the controller. Use the config
ap tcp-adjust-mss enable all 1363 command in order to enable it.
11. Disable RRM scanning to prevent any throughput drops when going off channel. This can yield a 1-3%
improvement.
12. Disable RLDP to ensure the AP does not attempt to connect to rogue devices during testing.
13. Use a Wireless Controller 5508 as the data plane is superior to the 4404-series.
Verify
You can check the connection status, speed, mode and signal strength of a client both from the WLC and the
client.
1. If you use an Intel client, right-click the Wireless icon in the System Tray (bottom right corner of the
desktop) in order to view the wireless mode. Then, click Status and check the band. In order to check the
speed of client operation, right-click the Wireless icon and click View Available Wireless Networks. Click
the SSID and check the speed as shown here:
41
Page
Department Of Computer Science and Engineering
2. On the WLC GUI, click Monitor. Then, click Clients in the left side. This displays the list of clients
currently associated to the WLC. Next, click on a client to check the mode, speed and other details of its
connectivity.
Troubleshoot
Unable to Achieve 802.11n Data Rates
One of the most common issues is that you cannot achieve the maximum throughput in 802.11n. Perform
these checks:
1. 802.11n requires AES encryption to be enabled on WLANs used by 802.11n clients. You can use a
WLAN with NONE as Layer 2 Security. However, if you configure any Layer 2 security, 802.11n requires
WPA2 AES enabled to operate at 11n rates.
42
Page
Department Of Computer Science and Engineering
Note: If you have legacy clients, you can enable WPA TKIP to provide interoperability.
2. Make sure the AP has enough power. Lower power on the AP results in lower signal strength, which
decreases the throughput.
3. Make sure the 802.11n rates are enabled. MCS rates should be enabled (this is recommended to keep all
of the MCS rates enabled).
43
Page
Department Of Computer Science and Engineering
4. Make sure that the AP has 2 external antennas to avail the data rates MCS 8-15 as shown in the previous
figure.
5. Ensure that WMM is set to Allowed on the WLAN profile in order to achieve 802.11n rates.
Clients Cannot Connect to the WLC
Issues in 802.11n networks are similar to that of the 802.11 network as far as the connectivity is concerned.
Perform these checks:
1. Make sure that the LAP has joined the controller and all radios are up. Check this under Wireless > All
APs.
2. Make sure that the WLAN is enabled and configured to All under Radio Policy in order to operate in both
2.4 GHz and 5 GHz band.
44
Page
Department Of Computer Science and Engineering
Experiment no.-10
Description:
Routing is the process of getting information packets where they need to go. Routing is a surprisingly
complicated task, and there are a number of different algorithms used to find the shortest route between
two points.IP addressing is based on the concept of hosts and networks. A host is essentially anything on
the network that is capable of receiving and transmitting IP packets on the network, such as a workstation
or a router. Routing is a process of moving data from one host computer to another. The difference
between routing and bridging is that bridging occurs at Layer 2 (the link layer) of the OSI reference
model, whereas routing occurs at Layer 3 (the network layer). Routing determines the optimal routing
paths through a network.
Routing Algorithms
The routing algorithm is stored in the router's memory. The routing algorithm is a major factor in the
performance of your routing environment. The purpose of the routing algorithm is to make decisions for the
router concerning the best paths for data. The router uses the routing algorithm to compute the path that
would best serve to transport the data from the source to the destination. Note that you do not directly
choose the algorithm that your router uses. Rather, the routing protocol you choose for your network
determines which algorithm you will use. For example, whereas the routing protocol Routing Information
Protocol (RIP) may use one type of routing algorithm to help the router move data, the routing protocol
Open Shortest Path First (OSPF) uses another. The routing algorithm cannot be changed. The only way to
change it is to change routing protocols. The overall performance of your network depends mainly on the
routing algorithm, so you should research the algorithms each protocol uses before deciding which to
implement on your network. There are two major categories of routing algorithms - distance vector or link-
state. Every routing protocol named "distance vector" uses the distance vector algorithm, and every link-
state protocol uses the link-state algorithm.
45
Page
Department Of Computer Science and Engineering
Distance vector algorithm uses metrics known as costs in order to help determine the best path to a
destination. The path with the lowest total cost is chosen as the best path.When a router utilizes a distance
vector algorithm, different costs are gathered by each router. These costs can be completely arbitrary
numbers. Costs can also be dynamically gathered values, such as the amount of delay experienced by routers
when sending packets over one link as opposed to another. All the costs are compiled and placed within the
router's routing table and then they are used by the algorithm to calculate a best path for any given network
scenario.Although there are many resources that will offer complex mathematical representations of what
distance vector algorithms are and how they compute their decisions, the core concept remains the same - by
adding the metrics for every optional path on a network, you will come up with at least one best path. The
formula for this is as follows:
This formula states that the best path between two networks (M(i,k)) can be found by finding the lowest
(min) value of paths between all network points. Let's look again at the routing information in the table
above. Plugging this information into the formula, we see that the route from A to B to C is still the best
path:
Whereas the formula for the direct route A to C looks like this:
6(A,C) = min[6(A,C)]
LINK-STATE ALGORITHMS
Link-state protocols work in more localized manner. Whereas a router running a distance vector algorithm
will compute the end-to-end path for any given packet, a link-state protocol will compute that path as it
relates to the most immediate link. That is, where a distance vector algorithm will compute the lowest metric
between Network A and Network C, a link-state protocol will compute it as two distinct paths, A to B and B
46
to C. This process is very efficient for larger environments. Link-state algorithms enable routers to focus on
their own links and interfaces. Any one router on a network will only have direct knowledge of the routers
Page
and networks that are directly connected to it (or, the state of its own links). In larger environments, this
Department Of Computer Science and Engineering
means that the router will use less processing power to compute complicated paths. The router simply needs
to know which one of its direct interfaces will get the information where it needs to go the quickest. The
next router in line
will repeat the process until the information reaches its destination. Another advantage to such localized
routing processes is that protocols can maintain smaller routing tables.
1. Identify the routers that are physically connected to them and get their IP addresses When a router starts
working, it first sends a "HELLO" packet over network. Each router that receives this packet replies with a
message that contains its IP address.
2. Routers measure the delay time (or any other important parameters of the network, such as average
traffic) for neighbor routers. In order to do that, routers send echo packets over the network. Every router
that receives these packets replies with an echo reply packet. By dividing round trip time by 2, routers can
count the delay time. The delay time includes both transmission and processing times - the time it takes the
packets to reach the destination and the time it takes the receiver to process it and reply.
3. Broadcast its information over the network for other routers and receive the other routers' information.
In this step, all routers share their knowledge and broadcast their information to each other. In this way,
every router can know the structure and status of the network.
4. Routers use an appropriate algorithm to identify the best route between two nodes of the network. In this
step, routers choose the best route to every node. They do this using an algorithm, such as the Dijkstra
shortest path algorithm. In this algorithm, a router, based on information that has been collected from other
routers, builds a graph of the network. This graph shows the location of routers in the network and their
links to each other. Every link is labeled with a number called the weight or cost. This number is a function
of delay time, average traffic, and sometimes simply the number of hops between nodes. For example, if
there are two links between a node and a destination, the router chooses the link with the lowest weight.
1. The router builds a graph of the network. Then it identifies source and destination nodes, for example
R1 and R2. The router builds then a matrix, called the "adjacency matrix." In the adjacent matrix, a
coordinate indicates weight. [i, j], for example, is the weight of a link between nodes Ri and Rj. If
there is no direct link between Ri and Rj, this weight is identified as "infinity."
2. The router then builds a status record for each node on the network. The record contains the
following fields fields:
o Predecessor field - shows the previous node.
o Length field - shows the sum of the weights from the source to that
node.
o Label field - shows the status of node; each node have one status mode: "permanent"
or "tentative."
3. In the next step, the router initializes the parameters of the status record (for all nodes) and sets their
label to "tentative" and their length to "infinity".
4. During this step, the router sets a T-node. If R1 is to be the source T-node, for example, the router
changes R1's label to "permanent." Once a label is changed to "permanent," it never changes again.
5. The router updates the status record for all tentative nodes that are directly linked to the source T-
node.
47
6. The router goes over all of the tentative nodes and chooses the one whose weight to R1 is lowest.
That node is then the destination T-node.
Page
7. If the new T-node is not R2 (the intended destination), the router goes back to step 5.
Department Of Computer Science and Engineering
8. If this node is R2, the router extracts its previous node from the status record and does this until it arrives
at R1. This list of nodes shows the best route from R1 to R2.
48
Page
Department Of Computer Science and Engineering
Experiment No.-11
AIM:- Study & Simulation of MAC Protocols like Aloha, CSMA, CSMA/CD and CSMA/CA using
Standard Network Simulators
Description:
1 Introduction
The paper is organized as follows. In section 1, we discuss the various network layers. In section 2, we look
at the common Medium Access Control (MAC) protocols used. The next three sections discuss some of the
analytical, simulation, and experimentation techniques used for performance evaluation of MAC protocols.
1.1 Open Systems Interconnection Model
The OSI model [11] is generally referred to as the OSI reference model (Figure 1). It presents an abstract
model of network protocol layers and is helpful in the design of network protocols. Every layer provides
some functions (interfaces) which are used by the layer above it. This structure is often referred to as a
protocol stack.
Fig. 3 - The circles show the communication ranges of the nodes at the centers.
2.5 IEEE 802.11
This standard specifies the Distributed Coordination Function (DCF) which is based on CSMA/CA. A
transmitter must wait for a channel to be idle for Distributed InterFrame Space (DIFS) amount of time
before it can start to transmit. If the channel is sensed busy, either immediately or during the DIFS, it backs
off its transmission by a random amount of time to avoid collisions. The time after the DIFS period is slotted
and a node is allowed to transmit only at the start of a time slot. The backoff scheme is exponential. The
backoff time is uniformly chosen in the range (0, W), where W is the contention window (CW). W is
variable in nature and its initial
value (the first time a node has to backoff) is CWmin. Each time a node has to backoff for the same frame
after the first backoff, it doubles the contention window. There is a CWmax, beyond which the window is
not incremented.
DCF (Figure 4) uses ACKs sent by the destination to judge whether a frame was successfully received or
not. A maximum of 8 retries are allowed after which the frame is dropped from the interface queue.
Page
Department Of Computer Science and Engineering
Point Coordination Function (PCF) - This is a centralized MAC protocol which works over DCF. The BS
polls mobile nodes (MN) periodically. To ensure PCF traffic has priority over the DCF traffic, the BS waits
for Point InterFrame Space (PIFS) amount of time for the channel to be idle before transmitting, where PIFS
< DIFS.
2.6 MAC for sensor networks
Sensor-MAC (S-MAC) It has been designed for sensor networks where energy consumption is a major
criteria. In S-MAC, a node sleeps for a certain period of time and is awake for a certain period of time.
These periods repeat in cycles and the total time is the time taken to complete one cycle. Otherwise the
protocol is very similar to the DCF protocol as described above as it uses RTS/CTS for hidden terminals,
RTS/CTS/DATA/ACK cycle, randomized backoff time and carrier sensing. The basis of this protocol is not
to overhear frames which are not destined for it. It does this by going to sleep. A node co-operates with its
neighbors so as it knows when it can sleep and when it should be in the listening mode. Similar variants of
these protocols exist: Timeout (T-MAC), and Berkeley (B-MAC).
2.7 IEEE 802.16
This is a standard for Metropolitan Area Networks (MAN). The network consists of a Base Station (BS) and
several Subscriber Stations (SS). A BS and multiple SS form a cell with a point to multipoint structure. The
BS controls access to the air interface in its cell. Time is divided into frames and each frame consists of a
downlink frame and an uplink frame. Access in the uplink frame is controlled by the BS and assigned
according to a scheduling algorithm.
L is the number of packets in a message which is a random variable given by a probability density function
with L1 and L2 being the first and the second moments.
Bianchi analyses the DCF of IEEE 802.l1. It is assumed that there are no hidden terminals in the network
and is operating under a saturation condition (every node has a packet to transmit at all times). The paper
first proposes a Markov model to find the probability that a station transmits in a randomly chosen slot.
Markov chain model for the backoff window size is show in the Figure 5. The probability found is
53
Page
where,
Department Of Computer Science and Engineering
p = conditional collision probability
W = Contention window
Fig. 5 - Markovian Model for backoff window. p is the probability with which each packet collides and is a
constant and independent. The next part of the analysis deals with
finding an expression for the throughput. S is the normalized system throughput which is the fraction of the
time the channel is used to transmit payload bits. S is expressed as,
the authors analyze the 802.11 protocol using an approach based on system approximation. Here, the
protocol's statistical characteristics are analyzed and then approximated by an appropriate distribution. Then
Department Of Computer Science and Engineering
a queuing model is constructed. Firstly, a general model which assumes there are k stations wanting to
transmit on a shared medium is assumed that uses a MAC protocol s to access the medium. Out of k, i
stations are saturated (always have traffic to send). The authors use a M/M/1/k model to analyze the protocol
and measure some performance metrics. The state of the queue represents the number of active stations. The
authors assume that the service time under any number of saturated nodes is exponential. This however may
not be appropriate in all cases for which the authors propose using a pH distribution like Erlang. To find the
delay performance, the authors use the saturation throughput developed by Bianchi. The service rate can be
calculated by S(i)/td where td is the mean duration of the payload transmission. Simulations are used to find
the service time distribution and a Cumalative Distribution Function (CDF) is obtained. The protocol
parameters used are given in table. Using the same parameters and k=50, and the balance equations, the
authors plot numerical results.
4 Simulation Studies
Simulation studies on MAC protocols generally involve more time but are generally preferred over
experimental studies especially in the wireless world. This is because experimental studies in wireless
networks involve a lot of cost. Furthemore, it is not always feasible to have a large scale testbed required for
full experimentation.
In authors simulate the performance of 802.16 protocol. Each Subscriber Station (SS) uses a Poisson traffic
source and the packet size is varied. The throughput and channel utilization has been plotted with varying
offered load. The simulation parameters used are as in the table. However, the simulation particulars are
missing in the paper. Particularly, the authors do not mention anything on the simulator used, or how long
the simulations are run.
In authors provide an analytical model for the delay performance of multi-channel MAC in point to
multipoint wireless networks under Poisson traffic. For the model, M orthogonal channels are assumed, with
each node having a single transceiver. However the base station can communicate on multiple channels
simultaneously. Let TA = length of contention interval; TD = length of data transmission interval in a frame;
TF = Frame size. Hence, TF = TD+TA. During the contention period all nodes send contention requests on
the same channel. Once the contention is over, nodes can shift to the channels which they were assigned
during contention. Let SA = number of contention slots. The authors then derive the probability of
successful contention for a channel m and find an expression for the average delay. This is given by
55
Page
Department Of Computer Science and Engineering
The model is also validated using simulations. The simulator used is ns-2. Three orthogonal channels having
a capacity of 10Mbps, contention slot 0.2 ms, and data slot time 0.5ms is simulated. Average service time
with TF=5ms and arrival rate = 20 packets/s is compared with the analytical model. The two graphs are
found to be highly close.
56
Page
Department Of Computer Science and Engineering
Experiment no.-12
AIM: - Study of Application layer protocols- DNS, HTTP, HTTPS, FTP and TelNet.
Description:
An application layer protocol defines how an application processes (clients and servers) , running on
different end systems, pass messages to each other. In particular, an application layer protocol defines:
The types of messages, e.g., request messages and response messages.
The syntax of the various message types, i.e., the fields in the message and how the fields are
delineated.
The semantics of the fields, i.e., the meaning of the information that the field is supposed to contain;
Rules for determining when and how a process sends messages and responds to messages.
POP3 mail server receives e-mails and filters them into the appropriate user folders. When a user
connects to the mail server to retrieve his mail, the messages are downloaded from mail server to the
Page
Country Domain: The country domain section follows the same format as the generic domain but
uses 2 characters country abbreviations (e.g., US for United States) in place of 3 characters.
59
Experiment no.-13
60
Page
Department Of Computer Science and Engineering
4. At the Choose Components screen leave the defaults checked and click Next. You can read
more about the different components here.
5. At the Select Additional Tasks screen choose your preferred shortcuts and leave the radio
button for “associate trace file extensions to Wireshark” selected. Click Next.
61
Page
Department Of Computer Science and Engineering
6. Choose the install location you prefer and click Next.
7. At the Packet Capture page make sure Install WinPcap 4.1.3 is selected. You need this to
capture traffic with Wireshark. Without it you can still view Wireshark capture files. Click
Next.
8. At the USB Capture page you can choose to Install USBPcap. Check the box next to Install
62
USBPcap 1.2.0.3 if you desire to capture raw usb traffic as well (such as from a USB to RJ45
Ethernet adapter). Click Install.
Page
Department Of Computer Science and Engineering
64
Page
Department Of Computer Science and Engineering
12. Make sure the check box is checked next to “Automatically start the WinPcap driver at boot
time” unless you have a good reason for disabling this and click Install.
13. Next the installer for USBPcap will launch. Read the USBPcap Driver license agreement,
check the “I accept” box, and click Next.
65
Page
Department Of Computer Science and Engineering
14. Read the USBPcapCMD license, check the “I accept” box, and click Next.
15. Leave the Installation Options set to Full and click Next.
16. Choose your Installation Folder and click Install. The install will begin.
66
17. When the USBpcap install finishes click close and the Wireshark install will continue.
Page
Department Of Computer Science and Engineering
At the Installation Complete screen click Next.
18. Wireshark will now ask to reboot your machine to complete installation. You can either
choose to reboot now or manually reboot later. You will not be able to run packet captures
until you reboot your machine. I suggest rebooting right away.
Once your machine has rebooted you should find the Wireshark shortcuts in the locations you specified
in the install. For this example the shortcut was found in the Start Menu.
67
Page
Department Of Computer Science and Engineering
Experiment no.-14
AIM: - Socket Programing
Socket programming is a way of connecting two nodes on a network to communicate with each other. One
socket(node) listens on a particular port at an IP, while the other socket reaches out to the other to form a
connection. The server forms the listener socket while the client reaches out to the server.
68
Page
1. Socket creation:
int sockfd = socket(domain, type, protocol)
int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
3. Bind:
int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
After the creation of the socket, the bind function binds the socket to the address and port number specified
in addr(custom data structure). In the example code, we bind the server to the localhost, hence we use
INADDR_ANY to specify the IP address.
4. Listen:
int listen(int sockfd, int backlog);
It puts the server socket in a passive mode, where it waits for the client to approach the server to make a
connection. The backlog, defines the maximum length to which the queue of pending connections for sockfd
may grow. If a connection request arrives when the queue is full, the client may receive an error with an
indication of ECONNREFUSED.
5. Accept:
int new_socket= accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
It extracts the first connection request on the queue of pending connections for the listening socket, sockfd,
creates a new connected socket, and returns a new file descriptor referring to that socket. At this point, the
connection is established between client and server, and they are ready to transfer data.
Implementation
Here we are exchanging one hello message between server and client to demonstrate the client/server model.
69
Page
Department Of Computer Science and Engineering
Server.c
< 0) {
Department Of Computer Science and Engineering
perror("accept");
exit(EXIT_FAILURE);
}
valread = read(new_socket, buffer, 1024);
printf("%s\n", buffer);
send(new_socket, hello, strlen(hello), 0);
printf("Hello message sent\n");
client.c
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(PORT);
if ((status
71
< 0) {
Department Of Computer Science and Engineering
printf("\nConnection Failed \n");
return -1;
}
Compiling:
72
Page