CN (2170409)
CN (2170409)
CN (2170409)
COMPUTER NETWROK(2140709)
4th semester
Computer Engineering
Lab Manual
Name: ______________________________________________
Enrollment No:________________________
INDEX
Sr. Title Pg. Start Complete Sign Marks
N No Date Date
o
1 (a) Study of different types of
Network cables and Practically
implement the cross-wired cable and
straight through cable using clamping
tool.
(b)Study of Network Devices in
Detail.
2 Study of network IP
Classification of IP address
Sub netting
Super netting
3 (a) To convert given IP address from
decimal to binary using C program.
(b) To convert given IP address from
binary to decimal using C program.
4 (a) Write a program for bit stuffing
and de-stuffing.
(b) Write a program for character
stuffing.
5 Study of basic network command and
Network configuration commands.
6 To Study about Packet Tracer.
7 Configure a Network topology using
packet tracer software.
8 To Study about NS2.
9 To study about simple TCL example
in NS2.
10 To Study about Netsim & LAN
Trainer Kit.
PRACTICAL- 1(a)
Date:
Aim: Study of different types of Network cables and practically implements the
cross-wired cable and straight through cable using clamping tool.
Apparatus (Components): RJ-45 connector, Climping Tool, Twisted pair Cable
Procedure: To do these practical following steps should be done:
1. Start by stripping off about 2 inches of the plastic jacket off the end of the cable. Be
very careful at this point, as to not nick or cut into the wires, which are inside. Doing so
could alter the characteristics of your cable, or even worse render is useless. Check the
wires, one more time for nicks or cuts. If there are any, just whack the whole end off, and
start over.
2. Spread the wires apart, but be sure to hold onto the base of the jacket with your other
hand. You do not want the wires to become untwisted down inside the jacket. Category 5
cable must only have 1/2 of an inch of 'untwisted' wire at the end; otherwise it will be
'out of spec'. At this point, you obviously have ALOT more than 1/2 of an inch of un-
twisted wire.
3. You have 2 end jacks, which must be installed on your cable. If you are using a pre
made cable, with one of the ends whacked off, you only have one end to install - the
crossed over end. Below are two diagrams, which show how you need to arrange the
cables for each type of cable end. Decide at this point which end you are making and
examine the associated picture below.
Diagram shows you how to prepare Cross wired connection
PRACTICAL- 1(b)
Date:
Aim: Study of following Network Devices in Detail
Repeater
Hub
Switch
Bridge
Router
Gate Way
Apparatus (Software): No software or hardware needed.
Procedure:
Following should be done to understand this practical.
Repeater: Functioning at Physical Layer. A repeater is an electronic device that
receives a signal and retransmits it at a higher level and/or higher power, or onto the
other side of an obstruction, so that the signal can cover longer distances. Repeater have
two ports ,so cannot be use to connect for more than two devices
Hub: An Ethernet hub, active hub, network hub, repeater hub, hub or concentrator is a
device for connecting multiple twisted pair or fiber optic Ethernet devices together and
making them act as a single network segment. Hubs work at the physical layer (layer 1)
of the OSI model. The device is a form of multi-port repeater. Repeater hubs also
participate in collision detection, forwarding a jam signal to all ports if it detects a
collision.
Bridge: A network bridge connects multiple network segments at the data link layer
(Layer 2) of the OSI model. In Ethernet networks, the term bridge formally means a
device that behaves according to the IEEE 802.1D standard. A bridge and switch are
very much alike; a switch being a bridge with numerous ports. Switch or Layer 2 switch
is often used interchangeably with bridge. Bridges can analyze incoming data packets to
determine if the bridge is able to send the given packet to another segment of the
network.
Router: A router is an electronic device that interconnects two or more computer
networks, and selectively interchanges packets of data between them. Each data packet
contains address information that a router can use to determine if the source and
destination are on the same network, or if the data packet must be transferred from one
network to another. Where multiple routers are used in a large collection of
interconnected networks, the routers exchange information about target system
addresses, so that each router can build up a table showing the preferred paths between
any two systems on the interconnected networks.
CONCLUSION:
PRACTICAL- 2
Date:
Aim: Study of network IP
Classification of IP address
Sub netting
Super netting
Apparatus (Software): NA
Procedure: Following is required to be study under this practical.
What is IP address?
An Internet Protocol address (IP address) is a numerical label assigned to each device
(e.g., computer, printer) participating in a computer network that uses the Internet
Protocol for communication.
An IP address serves two principal functions: host or network interface identification
and location addressing. Its role has been characterized as follows: "A name indicates
what we seek. An address indicates where it is. A route indicates how to get there."
Two versions of the Internet Protocol (IP) are in use:
IP Version 4
IP Version 6.
IPv4 addresses
In IPv4 an address consists of 32 bits which limits the address space to 4294967296
(232) possible unique addresses. IPv4 reserves some addresses for special purposes
such as private networks (~18 million addresses) or multicast addresses (~270
million addresses).
IPv6 addresses
Internet Protocol version 6 (IPv6) is the most recent version of the Internet Protocol
(IP), the communications protocol that provides an identification and location system
for computers on networks and routes traffic across the Internet. IPv6 was developed
by the Internet Engineering Task Force (IETF) to deal with the long-anticipated
problem of IPv4 address exhaustion. IPv6 is intended to replace Ipv4.
Classification of IP address
As show in figure we teach how the ip addresses are classified and when they are used.
Class A Address
The first bit of the first octet is always set to 0 (zero). Thus the first octet ranges from
1 – 127, i.e.
Class A addresses only include IP starting from 1.x.x.x to 126.x.x.x only. The IP
range 127.x.x.x is reserved for loopback IP addresses.
The default subnet mask for Class A IP address is 255.0.0.0 which implies that Class
A addressing can have 126 networks (27-2) and 16777214 hosts (224-2).
Class B Address
An IP address which belongs to class B has the first two bits in the first octet set to
10, i.e.
Class B IP Addresses range from 128.0.x.x to 191.255.x.x. The default subnet mask
for Class B is 255.255.x.x.
Class B has 16384 (214) Network addresses and 65534 (216-2) Host addresses.
Class C Address
The first octet of Class C IP address has its first 3 bits set to 110, that is:
Class C IP addresses range from 192.0.0.x to 223.255.255.x. The default subnet mask
for Class C is 255.255.255.x.
Class C gives 2097152 (221) Network addresses and 254 (28-2) Host addresses.
Class D Address
Very first four bits of the first octet in Class D IP addresses are set to 1110, giving a
range of:
Class E Address
This IP Class is reserved for experimental purposes only for R&D or Study. IP
addresses in this class ranges from 240.0.0.0 to 255.255.255.254. Like Class D, this
class too is not equipped with any subnet mask.
Subnetting:
Subnetting is a process of breaking large network in small networks known as
subnets. Subnetting happens when we extend default boundary of subnet mask.
Basically we borrow host bits to create networks.
Default Network
IP Class Host bits Total hosts Valid hosts
Subnet bits
A 255.0.0.0 First 8 bits Last 24 bits 16, 777, 216 16, 777, 214
B 255.255.0.0 First 16 bits Last 16 bits 65,536 65,534
1. Why we Develop sub netting and How to calculate subnet mask and how to identify
subnet address.
Ans:
Supernetting:
A supernetwork, or supernet, is an Internet Protocol (IP) network that is formed
from the combination of two or more networks (or subnets) with a common Classless
Inter-Domain Routing (CIDR) prefix. The new routing prefix for the combined
network aggregates the prefixes of the constituent networks.
Why we develop super netting and How to calculate supernet mask and how to
identify super net address.
Ans:
PRACTICAL- 3 (a)
Date:
AIM :- To convert given IP address from decimal to binary using C program.
Procedure:
Input: 172.16.254.1
Output: 10101100.00010000.11111110.00000001
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
{
inta,b,c,d,e,f,g;
int p[20],q[20],r[20],s[20];
inti,j,k;
clrscr();
}
else
{
printf("NOT VALID");
goto label;
}
printf("\n");
//----------------------------------BINARY
CONVERSION--------------------------
//q=a;
for(i=10;i>=1;i--)
{
p[i]=a%2;
a=a/2;
if(a==0)
{
j=i;
break;
}
}
for(i=j;i<=10;i++)
{
printf("%d",p[i]);
}
printf(".");
for(i=10;i>=1;i--)
{
q[i]=b%2;
b=b/2;
if(b==0)
{
j=i;
break;
}
}
for(i=j;i<=10;i++)
{
printf("%d",q[i]);
}
printf(".");
for(i=10;i>=1;i--)
{
r[i]=c%2;
c=c/2;
if(c==0)
{
j=i;
break;
}
for(i=j;i<=10;i++)
{
printf("%d",r[i]);
}
printf(".");
for(i=10;i>=1;i--)
{
s[i]=d%2;
d=d/2;
if(d==0)
{
j=i;
break;
}
}
for(i=j;i<=10;i++)
{
printf("%d",s[i]);
}
label:
getch();
}
CONCLUSION:
PRACTICAL- 3 (b)
Date:
AIM:- To convert given IP address from binary to decimal using C program.
Procedure:
Input: 10101100.00010000.11111110.00000001
Output: 172.16.254.1
PROGRAM:
//-----------IP ADDRESS PROGRAME-------------//
#include<stdio.h>
#include<conio.h>
void main()
{
inta,b,c,d;
inti,j;
int x[20],y[20],z[20],p[20];
clrscr();
printf("ENTER THE IP ADDRESS IN BINARY:");
scanf("%d%c%d%c%d%c%d",&x[20],&y[20],&z[20],&p[20]);
printf("\n");
printf("\n");
//------------------------DEC
CONVERSION---------------------------
for(i=8;i>=0;i--)
{
}
//-------------------------------------------------------
------------
for(i=20;i>0;i--)
{
y[i]=b%2;
//-------
final----------------------------------------------------
-------
if(a>=1 & a<=126)
{
printf("CLASS A:");
}
else if(a>=127 & a<=191)
{
printf("CLASS B:");
}
else if(a>=192 & a<=223)
{
printf("CLASS C:");
}
else
{
printf("NOT VALID:");
goto label;
}
printf("\n");
label:
getch();
}
}
CONCLUSION:
PRACTICAL- 4 (a)
Date:
AIM: - Write a program for bit stuffing and de-stuffing.
Procedure:
Bit stuffing:
In data transmission and telecommunication, bit stuffing (also known—uncommonly
as positive justification) is the insertion of non information bits into data.
Bit stuffing is the insertion of one or more bits into a transmission unit as a way to
provide signaling information to a receiver. The receiver knows how to detect and
remove or disregard the stuffed bits.
PROGRAM:
#include<stdio.h>
#include<stdlib.h>
#define MAXSIZE 100
int main()
{
char *p,*q;
char temp;
char in[MAXSIZE];
char stuff[MAXSIZE];
char destuff[MAXSIZE];
int count=0;
p=in;
q=stuff;
while(*p!='\0')
{
if(*p=='0')
{
*q=*p;
q++;
p++;
}
else
{
while(*p=='1' && count!=5)
{
count++;
*q=*p;
q++;
p++;
}
if(count==5)
{
*q='0';
q++;
}
count=0;
}
}
*q='\0';
printf("\nthe stuffed character string is");
printf("\n%s",stuff);
p=stuff;
q=destuff;
while(*p!='\0')
{
if(*p=='0')
{
*q=*p;
q++;
p++;
}
else
{
while(*p=='1' && count!=5)
{
count++;
*q=*p;
q++;
p++;
}
if(count==5)
{
p++;
}
count=0;
}
}
*q='\0';
printf("\nthe destuffed character string is");
printf("\n%s\n",destuff);
return 0;
}
CONCLUSION:
PRACTICAL- 4 (b)
Date:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i=0,j=0,n;
char a[20],b[50];
clrscr();
printf("enter string\n");
scanf("%s",&a);
n=strlen(a);
b[0]='s';
b[1]='t';
b[2]='x';
b[3]='d';
b[4]='l';
b[5]='e';
j=6;
while(i<n)
{
if(a[i]=='d' && a[i+1]=='l' && a[i+2]=='e')
{
b[j]='d';
b[j+1]='l';
b[j+2]='e';
j=j+3;
}
b[j]=a[i];
i++;
j++;
}
b[j]='d';
b[j+1]='l';
b[j+2]='e';
b[j+3]='e';
b[j+4]='t';
b[j+5]='x';
b[j+6]='\0';
CONCLUSION:
PRACTICAL- 5
Date:
Aim: Study of basic network command and Network configuration commands.
Apparatus (Software): Command Prompt And Packet Tracer.
Procedure:
To do this EXPERIMENT- follows these steps:
In this EXPERIMENT- students have to understand basic networking commands e.g
ping, tracert etc.
All commands related to Network configuration which includes how to switch to
privilege mode and normal mode and how to configure router interface and how to
save this configuration to flash memory or permanent memory.
This commands includes
Configuring the Router commands
General Commands to configure network
Privileged Mode commands of a router
Router Processes & Statistics
IP Commands
Other IP Commands e.g. show ip route etc.
PING (Packet Internet Groper Command)
If any system (host or router) want to communicate with the other system (host or route)
then it is necessary to check the communication is possible or not? For this, First of all we
have to check for destination system is reachable or not. Due to hardware failure or any other
reason it is possible the system may on network but not reachable. How can we detect that
the destination system is reachable or not?
PING command is useful for checking the reach ability of the system.
PROCEDURE:
Example:
(2) TRACERT:
When one system (host or router) send the packet of data to another system then there be
two possibilities, Packet directly reach to destination system or it pass through one or more
routers.TRACERT command is useful to trace the route through which packet passes.
PROCEDURE:
1. First go to command prompt
2. For help and information about this command type tracert /?
3. Typetracert IP address or name of the destination.
Example:
C:\documents and Settings\hgce>tracert 192.168.0.56
Tracing route to 192.168.0.56 over a maximum of 30 hops:
1 1 ms<1 ms<1ms192.168.0.56
Trace complete.
(3) IPCONFIG:
When System is in network at that time it is necessary to know the IP address of that
system, subnet mask and gateway address IPCONFIG command is used.
PROCEDURE:
1. First go to command prompt
2. For help and information about this command type ipconfig /?
Type ipconfig.
Example:
Windows IP Configuration
Ethernet adapter LAN:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.0.55
Subnet Mask . . . . . . . . . . . : 255.255.254.0
Default Gateway . . . . . . . . . : 192.168.1.100
(4) ARP (Address Resolution Protocol):
Any system on the network is identified by Physical address and IP address, so it is
sometimes necessary to resolve Physical address from IP address or vice-versa. ARP is used
to resolve Physical address from the IP address. We can also get the dynamic ARP table.
PROCEDURE:
1.First go to command prompt
2.For help and information about this command type arp /?
3.Typearp –a.
Example:
C:\>arp -a
The file transfer protocol (FTP) is a utility (an application), which is used for transferring
a file from one machine (server) to client, the other machine. The FTP over TCP/IP uses two
TCP connections: data and control.
PROCEDURE:
(1) Open the web browser
(2) Type ftp://<comp name or IP address> as an URL.
(6) nslookup:
Displays information from Domain Name System (DNS) name servers.
NOTE :If you write the command as above it shows as default your pc's server name firstly.
(7) pathping:
A better version of tracert that gives you statics about packet lost and latency.
CONCLUSION:
PRACTICAL- 6
Date:
Aim: To study about packet tracer software.
Apparatus (Software): Packet tracer Software
Procedure:
Packet Tracer – Creating a New Topology
What is Packet Tracer? Packet Tracer is a protocol simulator developed by Dennis Frezzo
and his team at Cisco Systems. Packet Tracer (PT) is a powerful and dynamic tool that
displays the various protocols used in networking, in either Real Time or Simulation mode.
This includes layer 2 protocols such as Ethernet and PPP, layer 3 protocols such as IP, ICMP,
and ARP, and layer 4 protocols such as TCP and UDP. Routing protocols can also be traced.
Purpose: The purpose of this lab is to become familiar with building topologies in Packet
Tracer.
Requisite knowledge: This lab assumes some understanding of the Ethernet protocol. At
this point we have not discussed other protocols, but will use Packet Tracer in later labs to
discuss those as well.
Cisco Packet Tracer 5.1 Overview
1 Menu Bar This bar provides the File, Edit, Options, View, Tools,
Extensions, and Help menus. You will find basic commands such
as Open, Save, Print, and Preferences in these menus. You will
also be able to access the Activity Wizard from the Extensions
menu.
2 Main Tool Bar This bar provides shortcut icons to the File and Edit menu
commands. This bar also provides buttons for Zoom, the drawing
Palette, and the Device Template Manager. On the right, you
will also find the Network Information button, which you can
use to enter a description for the current network (or any text you
wish to include).
3 Common Tools This bar provides access to these commonly used workspace tools:
PDU, and Add Complex PDU. See "Workspace Basics" for more
information.
4 Logical/ You can toggle between the Physical Workspace and the Logical
Physical Workspace with the tabs on this bar. In Logical Workspace, this
Workspace & bar also allows you to navigate through levels of a cluster, create a
Navigation bar new New Cluster, Move Object, Set Tiled Background, and
Viewport. In Physical Workspace, this bar allows you to navigate
through physical locations, create a New City, create a New
Building, create a New Closet, Move Object, apply Grid to the
background, Set Background, and go to the Working Closet.
5 Workspace This area is where you will create your network, watch
simulations, and view many kinds of information and statistics.
6 Realtime/Simu You can toggle between Realtime Mode and Simulation Mode
lation Bar with the tabs on this bar. This bar also provides buttons to Power
Cycle Devices as well as the Play Control buttons and the Event
List toggle button in Simulation Mode. Also, it contains a clock
that displays the relative Time in Realtime Mode and Simulation
Mode.
7 Network This box is where you choose devices and connections to put into
Component the workspace. It contains the Device-Type Selection Box and the
Box
Device-Specific Selection Box.
8 Device-Type This box contains the type of devices and connections available in
Packet Tracer 5.1. The Device-Specific Selection Box will change
Selection Box depending on which type of device you choose.
9 Device- This box is where you choose specifically which devices you want
Specific to put in your network and which connections to make.
Selection Box
10 User Created This window manages the packets you put in the network during
simulation scenarios. See the "Simulation Mode" section for more
Packet details.
Window*
Creating Devices
e. Alternatively, you can click and drag a device from the Device-Specific Selection box
onto the workspace
Adding Modules
Making Connections
a. To make a connection between two devices, first click the Connections icon from the
Device-Type Selection box to bring up the list of available connections.
b. Then click the appropriate cable type.
c. The mouse pointer will change into a "connection" cursor.
d. Click on the first device and choose an appropriate interface to which to connect.
e. Then click on the second device and do the same.
f. A connection cable will appear between the two devices, along with link lights
showing the link status on each end (for interfaces that have link lights).
Creating Networks
a. Start creating a network by first selecting the End Devices. Add a Generic PC and a Generic
Server to the workspace.
b. Under Connections, select the Copper Straight-through cable (solid black line) and connect
the devices with it. The red lights on the link indicate that the connection is not working.
Now, use the Delete tool to remove the Copper Straight-through cable, and use a Copper
Cross-over cable (dashed line) instead. The lights should turn green at this point, and if the
mouse pointer is held over either the PC or the Server, the link status will be shown as “Up.”
The network should look similar to the picture above.
c. Click on the PC. While paying attention to the link lights, turn the power on, off, and on
again. Follow the same steps for the server. The link lights turn red when the device is off.
This means that the link is down or is not working. The link lights turn green when the
device is turned back on.
d. Try all three ways to learn about the devices. First, mouse over the devices to see basic
configuration information about them. Second, click on each device with the Select tool to
show the device configuration window, which provides several ways to configure the device.
Third, use the Inspect tool to view tables the network device will build as it learns about the
network around it. In this example, only the ARP tables will appear. Since the devices have
not been configured yet, the ARP tables are empty. Always remember to close windows after
viewing them or they will clutter the workspace
e. Open the PC configuration window and change the settings using the Config tab.Change the
display name to Client and set the DNS server to 192.168.0.105. Under Interface, click
FastEthernet and set the IP address as 192.168.0.110. Packet Tracer automatically calculates
other parameters. Make sure that the Port Status box is checked. For future reference, note
that other Ethernet interface settings, such as bandwidth, duplex, MAC address, and subnet
mask can be modified using this window.
f. Go to the Desktop Tab and click on IP Configuration. Notice that the IP address, subnet mask
and DNS server can be changed here as well.
g. Open the Server configuration window and go to the Config tab. Change the display name to
Web Server. Click FastEthernet and set the IP address as 192.168.0.105. Make sure that the
Port Status is also on. Click DNS and set the domain name as www.firstlab.com. Set the IP
address as 192.168.0.105 and click Add. Finally, check to make sure that the service for
DNS is on.
h. Reposition the network devices by dragging them to a new location. Add a network
description by using the “i” button on the upper right corner. Then add some text labels
within the Logical Workspace by using the Place Note tool.
i. Load a background grid using the Set Tiled Background button.
j. Save your work using the File > Save As option and create a meaningful filename.
CONCLUSION:
PRACTICAL- 7
Date:
Aim: Configure a Network topology using packet tracer software.
Apparatus (Software): Packet tracer Software
Procedure: To implement this practical following network topology is required to be
configured using the commands learned in previous practical.
Version: This lab is based on Packet Tracer 5.0.
Step 1: Start Packet Tracer
Single click on each group of devices and connections to display the various choices.
The devices you see may differ slightly.
Choose “Hub” and then select “Generic”
Step 10: Write the IP address of your network and click at the Subnet mask
Step 11: Repeat Step 10 to set the IPs for all the PCs.
Step 13: Drag and Drop the message to the source device and then to the
Destination device
Step 14: Select the Simulation Mode at the bottom right corner
Step 16: Observe the path of the Message from source to Hub, then to all
devices. And then from Destination to Hub then back to the source.
Step 17: Finally observe the marks. If the source PC is marked correct it
means you have successfully established the connection.
CONCLUSION:
Connection established successfully between Source and Destination.
PRACTICAL- 8
Date:
Aim: To study about NS2.
Procedure:
1) Introduction and Architecture of NS2:
The network simulator is based on two languages: object oriented simulator written in C++
and OTCL (object oriented tool command language) used to execute user’s script.NS-2 has
rich library of networks and protocol objects, there are two class hierarchies the compiled in
C++ and the interpreted in OTCL with one to one corresponding between them.
.
The compiled C++ hierarchy allows us efficiency in simulation and faster execution time.
This isparticular useful in detail definitions of protocol and reduces the event processing
time. OTCL script allows user to create various network component like nodes, topology,
links, traffic, movement patterns, error generation etc. NS is discrete event simulator, where
the execution of each event is maintain by scheduler. In C++ all event are object which has
unique id and scheduler will keep track that next object to run. There are four types of
schedulers are there, they are implemented using different data structure like link list, heap,
calendar queue, real time. When we want to simulate any network at that we are require to
maintain lots of data structure like packet header, packet size, packet manipulation
algorithm, protocols, links etc. again we have to implement all these stuff for very large
amount of size as well as run time speed. That’s why at back end C++ is used.
3) components of NS2:
1. Tcl/TK:
* It is a network simulator. NS2 is an extended TCL interpreter only.
* TCL is a scripting programming language similar to PERL or Python.
* A TCL statement always consists of:
* A command name
* Optionally followed by one or more arguments (parameters)
Example:
set x "Hello World"
If you specify an incorrect number of arguments to a command, you will receive
an error and the Tcl program will terminate.
2. OTcl: Object Tcl
* NS2 is primarily designed on two languages: C++ and Object-oriented Tool
Command Language (OTCL).
* C++ is used for defining the internals of NS2 while OTCL is used to control
the simulation as well as to schedule discrete events.
After the linking of C++ member variables to OTCL object variables by using the
bind member function, C++ variables can be modified through OTCL directly.
NS
-2 package diagram
5. nam-1: Network Animator
* NAM trace is records simulation detail in a text file, and uses the text file the play
back the simulation using animation.
* NAM trace is activated by the command “$ns namtrace-all $file”, where ns is the
Simulator handle and file is a handle associated with the file which stores the NAM
trace information. After obtaining a NAM trace file, the animation can be initiated
directly at the command prompt through the following command
* nam filename.nam
* Many visualization features are available in NAM.
* These features are for example animating colored packet flows, dragging and
dropping nodes (positioning), labeling nodes at a specified instant, shaping
the nodes, coloring a specific link, and monitoring a queue.
*
6. xgraph: Plotting and Graphing:
CONCLUSION:
PRACTICAL- 9
Date:
Aim: To study about simple TCL example in NS2.
Procedure:
Topology of 4 nodes:-
KByte packets at the rate of 1 Mbps. The "cbr" is set to start at 0.1 sec and stop at 4.5 sec,
and "ftp" is set to start at 1.0 sec and stop at 4.0 sec.
o Create connections between agents (ex. make connection between a "tcp" and
"sink")
Most of member functions are for simulation setup (referred to as plumbing functions
in the Overview section) and scheduling, however some of them are for the NAM
display. The "Simulator" object member function implementations are located in the
"ns-2/tcl/lib/ns-lib.tcl"file.
$ns color fid color: is to set color of the packets for a flow specified by the flow id
(fid). This member function of "Simulator" object is for the NAM display, and has no
effect on theactualsimulation.
procfinish {}: is called after this simulation is over by the command $ns at 5.0
"finish". In this function, post-simulation processes are specified.
setn0 [$ns node]: The member function node creates a node. A node in NS is
compound object made of address and port classifiers (described in a later section).
Users can create a node by separately creating an address and a port classifier objects
and connecting them together. However, this member function of Simulator object
makes the job easier. To see how a node is created, look at the files: "ns-2/tcl/libs/ns-
$ns duplex-link node1 node2 bandwidth delay queue-type: creates two simplex
links of specified bandwidth and delay, and connects the two specified nodes. In NS,
the output queue of a node is implemented as a part of a link, therefore users should
specify the queue-type when creating links. In the above simulation script, DropTail
queue is used. If the reader wants to use a RED queue, simply replace the word
DropTail with RED. The NS implementation of a link is shown in a later section.
Like a node, a link is a compound object, and users can create its sub-objects and
connect them and the nodes. Link source codes can be found in "ns-2/tcl/libs/ns-
lib.tcl" and "ns-2/tcl/libs/ns-link.tcl" files. One thing to note is that you can insert
error modules in a link component to simulate a lossy link (actually users can make
and insert any network objects). Refer to the NS documentation to find out how to do
this.
$ns queue-limit node1 node2 number: This line sets the queue limit of the two
simplex links that connect node1 and node2 to the number specified. At this point,
the authors do not know how many of these kinds of member functions of Simulator
objects are available and what they are. Please take a look at "ns-2/tcl/libs/ns-lib.tcl"
and "ns-2/tcl/libs/ns-link.tcl", or NS documentation for more information.
$ns duplex-link-op node1 node2 ...: The next couple of lines are used for the NAM
display. To see the effects of these lines, users can comment these lines out and try
the simulation.
Now that the basic network setup is done, the next thing to do is to setup
traffic agents such as TCP and UDP, traffic sources such as FTP and CBR, and attach
them to nodes and agents respectively.
settcp [new Agent/TCP]: This line shows how to create a TCP agent. But in general,
users can create any agent or traffic sources in this way. Agents and traffic sources
are in fact basic objects (not compound objects), mostly implemented in C++ and
linked to OTcl. Therefore, there are no specific Simulator object member functions
that create these object instances. To create agents or traffic sources, a user should
$ns attach-agent node agent: The attach-agent member function attaches an agent
object created to a node object. Actually, what this function does is call the attach
member function of specified node, which attaches the given agent to itself.
Therefore, a user can do the same thing by, for example, $n0 attach $tcp. Similarly,
each agent object has a member function attach-agent that attaches a traffic source
object to itself.
$ns connect agent1 agent2: After two agents that will communicate with each other
are created, the next thing is to establish a logical network connection between them.
This line establishes a network connection by setting the destination address to each
others' network and port address pair.
Assuming that all the network configuration is done, the next thing to do is
write a simulation scenario (i.e. simulation scheduling). The Simulator object has
many scheduling member functions. However, the one that is mostly used is the
following:
$ns at time "string": This member function of a Simulator object makes the
scheduler (scheduler_ is the variable that points the scheduler object created by [new
Scheduler] command at the beginning of the script) to schedule the execution of the
specified string at given simulation time. For example, $ns at 0.1 "$cbr start" will
make the scheduler call a start member function of the CBR traffic source object,
which starts the CBR to transmit data. In NS, usually a traffic source does not
transmit actual data, but it notifies the underlying agent that it has some amount of
data to transmit, and the agent, just knowing how much of the data to transfer, creates
packets and sends them.
CONCLUSION:
PRACTICAL- 10
Date:
Aim: To study about NetSim.
Netsim:
NetSim is a popular network simulation and network emulation tool used for network design
& planning, defense applications and network R & D. Various technologies such as
Cognitive Radio, Wireless Sensor Networks, Wireless LAN, Wi Max, TCP, IP, etc. are
covered in NetSim.
The Boson NetSim, which includes the Boson Router Simulator®, is a new category of
simulation product. Many products simulate the end-user experience without actually
emulating what is happening within the network. Boson’s Virtual Packet Technology
creates individual packets that are routed and switched through the simulated network,
allowing the Boson NetSim to build an appropriate Virtual Routing Table for each protocol
and, thus, fully emulate true networking. This technology allows for many uses of the
Boson NetSim, far beyond the scope of the labs included in the program.
Simulator Components
The Simulator is actually a suite of programs that interact to provide a total learning
experience. The primary
components are as follows:
1. Lab Navigator
3. Network Simulator
4. Lab Grader
The purpose of the Lab Navigator is to allow you to view, select, and begin the lab of
your choice. The Lab Navigator provides a friendly interface for your learning
experience.
The included Network Designer is a tool you can use to create your own custom
networks. With this tool, you
can build either a simple or complex network; you can even model an existing network.
Note that the Network
Designer is not required to complete the included labs. The Network Designer is provided
solely to allow you to practice creating and administering your own Cisco networks.
The Network Simulator is the tool that actually simulates the network and routes
virtual packets.
Part 1: The Lab Navigator
To get started with a lab, click the Stand-Alone Labs tab, and then select Lab 1:
Connecting to a Router.
Alpha College of Engineering & Technology Page 60
Department of Computer Engineering Computer Networks (2140709)
LAN Trainer :
CONCLUSION: