Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

CN (2170409)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 62

Department of Computer Engineering Computer Networks (2140709)

COMPUTER NETWROK(2140709)

4th semester
Computer Engineering
Lab Manual
Name: ______________________________________________
Enrollment No:________________________

Alpha College of Engg. and Technology


Khatraj-Gandhinagar
Gujarat Technological University, Ahmedabad

Alpha College of Engineering & Technology Page 1


Department of Computer Engineering Computer Networks (2140709)

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.

Alpha College of Engineering & Technology Page 2


Department of Computer Engineering Computer Networks (2140709)

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

Alpha College of Engineering & Technology Page 3


Department of Computer Engineering Computer Networks (2140709)

Diagram shows you how to prepare straight through wired connection

 What is RJ-45 and full name of RJ-45 ?


Ans.

2. Where RJ-45 is used?


Ans.

Alpha College of Engineering & Technology Page 4


Department of Computer Engineering Computer Networks (2140709)

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.

Alpha College of Engineering & Technology Page 5


Department of Computer Engineering Computer Networks (2140709)

 Switch: A network switch or switching hub is a computer networking device that


connects network segments. The term commonly refers to a network bridge that
processes and routes data at the data link layer (layer 2) of the OSI model. Switches that
additionally process data at the network layer (layer 3 and above) are often referred to
as Layer 3 switches or multilayer switches.

 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

Alpha College of Engineering & Technology Page 6


Department of Computer Engineering Computer Networks (2140709)

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.

 Gateway: In a communications network, a network node equipped for interfacing with


another network that uses different protocols. A gateway may contain devices such as
protocol translators, impedance matching devices, rate converters, fault isolators, or
signal translators as necessary to provide system interoperability. It also requires the
establishment of mutually acceptable administrative procedures between both networks.
A protocol translation/mapping gateway interconnects networks with different network
protocol technologies by performing the required protocol conversions.

Alpha College of Engineering & Technology Page 7


Department of Computer Engineering Computer Networks (2140709)

CONCLUSION:

Alpha College of Engineering & Technology Page 8


Department of Computer Engineering Computer Networks (2140709)

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).

Alpha College of Engineering & Technology Page 9


Department of Computer Engineering Computer Networks (2140709)

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.

Alpha College of Engineering & Technology Page 10


Department of Computer Engineering Computer Networks (2140709)

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 A IP address format is thus:


0NNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH

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 B IP address format is:


10NNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH

Class C Address
 The first octet of Class C IP address has its first 3 bits set to 110, that is:

Alpha College of Engineering & Technology Page 11


Department of Computer Engineering Computer Networks (2140709)

 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 C IP address format is:


110NNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH

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 D has IP address rage from 224.0.0.0 to 239.255.255.255. Class D is reserved


for Multicasting. In multicasting data is not destined for a particular host, that is why
there is no need to extract host address from the IP address, and Class D does not
have any subnet mask.

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

Alpha College of Engineering & Technology Page 12


Department of Computer Engineering Computer Networks (2140709)

C 255.255.255.0 First 24 bits Last 8 bits 256 254

1. Why we Develop sub netting and How to calculate subnet mask and how to identify
subnet address.
Ans:

Alpha College of Engineering & Technology Page 13


Department of Computer Engineering Computer Networks (2140709)

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:

Alpha College of Engineering & Technology Page 14


Department of Computer Engineering Computer Networks (2140709)

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();

printf("Enter the IP Address in Decimal:");


scanf("%d%c%d%c%d%c%d",&a,&e,&b,&f,&c,&g,&d);
//--------------------------------
CLASS--------------------------
if(a>=1 & a<=127)
{
printf("CLASS A:");
}
else if(a>=128 & a<=191)
{
printf("CLASS B:");
}
else if(a>=192 & a<=224)
{
printf("CLASS C:");

Alpha College of Engineering & Technology Page 15


Department of Computer Engineering Computer Networks (2140709)

}
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--)

Alpha College of Engineering & Technology Page 16


Department of Computer Engineering Computer Networks (2140709)

{
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:

Alpha College of Engineering & Technology Page 17


Department of Computer Engineering Computer Networks (2140709)

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;

Alpha College of Engineering & Technology Page 18


Department of Computer Engineering Computer Networks (2140709)

//-------
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:

Alpha College of Engineering & Technology Page 19


Department of Computer Engineering Computer Networks (2140709)

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;

printf("enter the input character string (0‘s & 1‘s only):\n");


scanf("%s",in);

p=in;
q=stuff;

while(*p!='\0')
{
if(*p=='0')
{
*q=*p;
q++;
p++;
}
else
{
while(*p=='1' && count!=5)
{
count++;
*q=*p;

Alpha College of Engineering & Technology Page 20


Department of Computer Engineering Computer Networks (2140709)

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:

Alpha College of Engineering & Technology Page 21


Department of Computer Engineering Computer Networks (2140709)

PRACTICAL- 4 (b)
Date:

Aim: - Write a program for character stuffing.


PROGRAM:

#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++;
}

Alpha College of Engineering & Technology Page 22


Department of Computer Engineering Computer Networks (2140709)

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';

printf("\nframe after stuffing:\n");


printf("%s",b);
getch();
}

CONCLUSION:

Alpha College of Engineering & Technology Page 23


Department of Computer Engineering Computer Networks (2140709)

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:

1. First go to command prompt


2. For help and information about this command type ping /?
3. Type ping IP address of system

Alpha College of Engineering & Technology Page 24


Department of Computer Engineering Computer Networks (2140709)

Example:

C:\ >ping 192.168.11.42

Pinging 192.168.11.42 with 32 bytes of data:


Reply from 192.168.11.42: bytes=32 time<10ms TTL=127
Reply from 192.168.11.42: bytes=32 time<10ms TTL=127
Reply from 192.168.11.42: bytes=32 time<10ms TTL=127
Reply from 192.168.11.42: bytes=32 time<10ms TTL=127

(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.

Alpha College of Engineering & Technology Page 25


Department of Computer Engineering Computer Networks (2140709)

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 /?

Alpha College of Engineering & Technology Page 26


Department of Computer Engineering Computer Networks (2140709)

Type ipconfig.
Example:

C:\Documents and settings\hgce>ipconfig

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

Interface: 192.168.11.7 on Interface 0x1000003


Internet Address Physical Address Type
192.168.11.1 00-50-af-0a-5b-80 dynamic
192.168.11.2 00-80-ad-83-02-82 dynamic
192.168.11.20 00-80-ad-83-4d-35 dynamic
192.168.11.21 00-11-5b-d2-51-c4 dynamic

(5) FTP (File Transfer Protocol)

Alpha College of Engineering & Technology Page 27


Department of Computer Engineering Computer Networks (2140709)

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:

Alpha College of Engineering & Technology Page 28


Department of Computer Engineering Computer Networks (2140709)

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

Alpha College of Engineering & Technology Page 29


Department of Computer Engineering Computer Networks (2140709)

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:

Select, Move Layout, Place Note, Delete, Inspect, Add Simple


Bar

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.

Alpha College of Engineering & Technology Page 30


Department of Computer Engineering Computer Networks (2140709)

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

a. Choose a device type from the Device Type Selection box

b. Click on the desired device model from


the Device-Specific Selection box

c. Click on a location in the workspace to


put your device in that location

d. If you want to cancel your selection,


press the Cancel icon for that device

e. Alternatively, you can click and drag a device from the Device-Specific Selection box
onto the workspace

Alpha College of Engineering & Technology Page 31


Department of Computer Engineering Computer Networks (2140709)

f. You can also click and drag a device


directly from the Device-Type Selection box and a default device model will be
chosen for you

Adding Modules

Alpha College of Engineering & Technology Page 32


Department of Computer Engineering Computer Networks (2140709)

a. Click on a device to bring up its configuration window.


b. By default, you will be in the Physical Device View subpanel of the device.
c. You can browse (by clicking) through the list of modules and read their description in the
information box at the bottom.
d. When you have found the module you want to add, simply drag it from the list into a
compatible bay on the device picture.
e. You can remove a module by dragging it from the device back into the list.

Alpha College of Engineering & Technology Page 33


Department of Computer Engineering Computer Networks (2140709)

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).

Alpha College of Engineering & Technology Page 34


Department of Computer Engineering Computer Networks (2140709)

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.

Alpha College of Engineering & Technology Page 35


Department of Computer Engineering Computer Networks (2140709)

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:

Alpha College of Engineering & Technology Page 36


Department of Computer Engineering Computer Networks (2140709)

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

Step 2: Choosing Devices and Connections


We will begin building our network topology by selecting devices and the media in which to
connect them. Several types of devices and network connections can be used. For this lab
we will keep it simple by using End Devices, Switches, Hubs, and Connections.

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”

Alpha College of Engineering & Technology Page 37


Department of Computer Engineering Computer Networks (2140709)

Step 3: After selecting “Generic” click on the main area.


You will see a Hub.

Alpha College of Engineering & Technology Page 38


Department of Computer Engineering Computer Networks (2140709)

Step 4: Select “End Devices” and then click at “Generic”

Step 5: Click at the workspace to see the PC.


Repeat the above process to place as many PCs as you want.

Step 6: Select “Connections” from Power Cycle Devices and click on


“Automatically choose Connection Type”

Step 7: Draw connections from Hub to PCs

Alpha College of Engineering & Technology Page 39


Department of Computer Engineering Computer Networks (2140709)

Step 8: Double click on a PC, a box will appear.


Click on the “Desktop” tab.

Alpha College of Engineering & Technology Page 40


Department of Computer Engineering Computer Networks (2140709)

Step 9: Then select “IP configuration”

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 12: Select “Add simple message”

Step 13: Drag and Drop the message to the source device and then to the
Destination device

In this case my source device is PC1 and destination device is PC4.

Alpha College of Engineering & Technology Page 41


Department of Computer Engineering Computer Networks (2140709)

Step 14: Select the Simulation Mode at the bottom right corner

Step 15: Click at “Auto Capture / Play”

Alpha College of Engineering & Technology Page 42


Department of Computer Engineering Computer Networks (2140709)

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.

Alpha College of Engineering & Technology Page 43


Department of Computer Engineering Computer Networks (2140709)

CONCLUSION:
Connection established successfully between Source and Destination.

Alpha College of Engineering & Technology Page 44


Department of Computer Engineering Computer Networks (2140709)

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.

2)Directory structure of ns2:


Here, directory nsallinone-2.35 is on the Level 1.
On the Level 2, directory tclcl-1.18 contains classes in TclCL (e.g., Tcl, TclObject, TclClass).
All NS2 simulation modules are in directory ns-2.35 on the Level 2. Here after, we will refer
to directories ns-2.30 and tclcl-1.18 as ̃ns/ and ̃tclcl / respectively.
On Level 3, the modules in the interpreted hierarchy are under the directory tcl. Among the
directories,the frequently used ones ( ns-lib.tcl,ns-node.tcl,ns-node.tcl) are stored under the
directory lib.

Alpha College of Engineering & Technology Page 45


Department of Computer Engineering Computer Networks (2140709)

on Level 4.Simulation modules in compiled hierarchy are classified in the directories on


level 3.For example,directory tools contains various helper classes such as random variable
generators. Directory common contains basic modules related to packet forwarding such as
simulator,scheduler,packet and connectors.Directories queue,tcp and trace contain modules
for queue, TCP Transmission Control Protocol and tracing respectively.

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.

* C++ and OTCL are linked together using TCL.

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.

Alpha College of Engineering & Technology Page 46


Department of Computer Engineering Computer Networks (2140709)

3. TclCL: Tcl with classes library


These are the classes of Tcl which stores the library functions used for Tcl scripting
programs.
4. NS-2 package:
* This is the package of all data required to install NS-2 simulator.
* It contains main ns2allinone tar file
* It is the main part required to install NS2.
* We have to fire this commands for ns2 installation
* tar -zxf ns-allinone-2.34.tar.gz
* cd ns-allinone-2.34
* ./install

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:

* XGraph is a plotting program that is used to create graphic representations of


simulation results.
* It is important because it allows some basic animation of data sets. The
animation only pages through data sets in the order in which they are loaded.

Alpha College of Engineering & Technology Page 47


Department of Computer Engineering Computer Networks (2140709)

* Xgraph is an X-Windows application that includes:


* interactive plotting and graphing
* animation and deritives
* portability and bug fixes
4) Goals of NS2:

* support networking research and education


* Protocol design, traffic studies, etc
* Protocol comparison
* New architecture designs are also supported
* To provide collaborative environment
* Freely distributed, open source
* Increase confidence in result

CONCLUSION:

Alpha College of Engineering & Technology Page 48


Department of Computer Engineering Computer Networks (2140709)

Alpha College of Engineering & Technology Page 49


Department of Computer Engineering Computer Networks (2140709)

PRACTICAL- 9
Date:
Aim: To study about simple TCL example in NS2.

Procedure:
Topology of 4 nodes:-

Explanation of the Topology:-


This network consists of 4 nodes (n0, n1, n2, n3) as shown in above figure. The
duplex links between n0 and n2, and n1 and n2 have 2 Mbps of bandwidth and 10 ms of
delay. The duplex link between n2 and n3 has 1.7 Mbps of bandwidth and 20 ms of delay.
Each node uses a DropTail queue, of which the maximum size is 10. A "tcp" agent is
attached to n0, and a connection is established to a tcp "sink" agent attached to n3.
As default, the maximum size of a packet that a "tcp" agent can generate is 1KByte.
A tcp "sink" agent generates and sends ACK packets to the sender (tcp agent) and frees the
received packets. A "udp" agent that is attached to n1 is connected to a "null" agent attached
to n3. A "null" agent just frees the packets received. A "ftp" and a "cbr" traffic generator are
attached to "tcp" and "udp" agents respectively, and the "cbr" is configured to generate 1

Alpha College of Engineering & Technology Page 50


Department of Computer Engineering Computer Networks (2140709)

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.

Tool Command Language (tcl) for the Topology:-

Alpha College of Engineering & Technology Page 51


Department of Computer Engineering Computer Networks (2140709)

Details of the Tool command language:-

 setns [new Simulator]: generates an NS simulator object instance, and assigns it to


variable ns (italics is used for variables and values in this section). What this line
does is the following:

o Initialize the packet format (ignore this for now)

o Create a scheduler (default is calendar scheduler)

Alpha College of Engineering & Technology Page 52


Department of Computer Engineering Computer Networks (2140709)

o Select the default address format (ignore this for now)


The "Simulator" object has member functions that do the following:
Create compound objects such as nodes and links (described later)

o Connect network component objects created (ex. attach-agent)

o Set network component parameters (mostly for compound objects)

o Create connections between agents (ex. make connection between a "tcp" and
"sink")

o Specify NAM display options etc.

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.

 $nsnamtrace-all file-descriptor: This member function tells the simulator to record


simulation traces in NAM input format. It also gives the file name that the trace will
be written to later by the command $ns flush-trace. Similarly, the member function
trace-all is for recording the simulation trace in a general format.

 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-

Alpha College of Engineering & Technology Page 53


Department of Computer Engineering Computer Networks (2140709)

lib.tcl" and "ns-2/tcl/libs/ns-node.tcl".

 $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

Alpha College of Engineering & Technology Page 54


Department of Computer Engineering Computer Networks (2140709)

know the class names these objects (Agent/TCP, Agnet/TCPSink, Application/FTP


and so on).

This information can be found in the NS documentation or partly in this


documentation. But one shortcut is to look at the "ns-2/tcl/libs/ns-default.tcl" file.
This file contains the default configurable parameter value settings for available
network objects. Therefore, it works as a good indicator of what kind of network
objects are available in NS and what are the configurable parameters.

 $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.

Alpha College of Engineering & Technology Page 55


Department of Computer Engineering Computer Networks (2140709)

After all network configurations, scheduling and post-simulation procedure


specifications are done, the only thing left is to run the simulation. This is done by
$ns run.

Screen shots of network animator while running the simple.tcl:-

Alpha College of Engineering & Technology Page 56


Department of Computer Engineering Computer Networks (2140709)

Explanation of trace file generated after simulation:-

 First column indicates the event


a. “+” means a packet is enqueued in the queue.
b. “-” means a packet is dequed from the queue.

Alpha College of Engineering & Technology Page 57


Department of Computer Engineering Computer Networks (2140709)

c. “r” indicates the packet is received.


 Second column indicates time at which the event occurs.
 Third column indicates node no. from which event occurs.
 Fourth column indicates node no. to which event occurs.
 Fifth column indicates packet type. Here it is cbr-Constant Bit Rate.
 Sixth column indicates size of the packet. Here it is 210 bytes.
 Seventh column indicates weather the packet is lost or not.”--” indicates no loss of
packets.
 Eighth column indicates flow id.
 Ninth column indicates source port-id and Tenth column indicates destination port-id.
 Eleventh column indicates sequence.
 Twelfth column indicates packet id.

CONCLUSION:

Alpha College of Engineering & Technology Page 58


Department of Computer Engineering Computer Networks (2140709)

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

Alpha College of Engineering & Technology Page 59


Department of Computer Engineering Computer Networks (2140709)

2. Network Designer (optional)

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)

Select the Stand-Alone Labs tab in the Lab Navigator.

LAN Trainer :

Alpha College of Engineering & Technology Page 61


Department of Computer Engineering Computer Networks (2140709)

Introduction to the LAN Trainer:


To successfully use the LAN Trainer, a number of hardware and software components must
be properly used together (see Fig. 1.1). Each PC acts as two nodes in the network. Both are
connected to the Network Emulator Unit via the same cable. Thus, with 3 PCs, you can
experiment with a 6-node network. On the software side, the screen is divided into 2
windows, one for each node. This is accomplished using the LAN Trainer control panel
running under Windows – 95
NIU Card: Each PC that is part of the LAN Trainer setup must have an NIU Card plugged
into it.
Network Emulator Unit :
The Network Emulator Unit acts as a network interconnecting up to 6 network nodes (3 NIU
Cards in 3 PCs). Each card is connected to the Network Emulator Unit via a cable with DB-
37 connectors. Once properly installed, these should not normally be disturbed. The Network
Emulator Unit has a number of jumpers that must be properly wired-up depending on the
type of
network one wants - a bus, a ring, or a star. This must correspond to the setting of the
Topology selector switch. The Network Emulator Unit also has selector switches for Data
Rate, Bit Delay,
Error Rate and Frame Error Rate. These should be set in accordance with the instructions of
each experiment. In addition, there is a Reset switch, which should be used before every
experiment, and in case of trouble.

CONCLUSION:

Alpha College of Engineering & Technology Page 62

You might also like