CN Lab Manual
CN Lab Manual
CN Lab Manual
LAB MANUAL
Prof. Rahul
Meghani (Faculty
Guide)
Date:
INDEX
Sr. Date Experiment/Practical Title Page Grade Sign
No.
1 Introduction to Networking Simulator Packet Tracer.
2
To Perform Simple Data Communication using
Switch with the help of Packet Tracer.
3
To Perform Router Port Configuration using Packet
Tracer.
4
To Configure Network using Static Routing with the
help
of Packet Tracer.
5
To Configure Network using Distance Vector Routing
Algorithm with the help of Packet Tracer(RIP
Protocol). .
6
To Configure Network using Link State Vector
Routing Algorithm with the help of Packet Tracer.
(IGRP Protocol).
7
To Configure Network using Open Shortest
Path First Protocol with the help of Packet
Tracer.
8
Configuration of Virtual LAN with help of Packet
Tracer.
9
To take backup of IOS (Internet Operating System)
image from a working CISCO router and to install the
same in a crashed CISCO router.
10
Introduction to Network Simulator 2(NS2).
11
Installation of NS2 in LINUX Operating System.
Dept of MCA Computer Networking
Experiment 1
Objective:
1. To become familiar with the network simulator Packet Tracer.
2. To use the packet tracer to simulate a simple network.
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 the Packet Tracer interface. Learn
how to use existing topologies and build your own.
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.
Version:
Mode
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.
Dept of MCA Computer Networking
Step 3: Building the Topology – Adding Hosts Single click on the End Devices.
Move the cursor into topology area. You will notice it turns into a plus “+” sign.
Single click in the topology area and it copies the device.
Dept of MCA Computer Networking
Step 4: Building the Topology – Connecting the Hosts to Hubs and Switches.
Adding a Hub Select a hub, by clicking once on Hubs and once on a Generic hub.
Adding a Switch Select a switch, by clicking once on Switches and once on a 2950-24 switch.
Add the switch by moving the plus sign “+” below PC2 and PC3 and click once.
Before we can communicate between the hosts we need to configure IP Addresses and Subnet
Masks on the devices. Click once on PC0.
Dept of MCA Computer Networking
Choose the Config tab. It is here that you can change the name of PC0. It is also here where
you would enter a Gateway IP Address, also known as the default gateway. We will discuss
this later, but this would be the IP address of the local router. If you want, you can enter the
IP Address 172.16.1.1, although it will not be used in this lab.
Click on FastEthernet. Although we have not yet discussed IP Addresses, add the IP
Address to 172.16.1.10. Click once in the Subnet Mask field to enter the default Subnet
Mask. You can leave this at 255.255.0.0. We will discuss this later.
Dept of MCA Computer Networking
Also, notice this is where you can change the Bandwidth (speed) and Duplex of the
Ethernet NIC (Network Interface Card). The default is Auto (autonegotiation), which means the
NIC will negotiate with the hub or switch. The bandwidth and/or duplex can be manually set by
removing the check from the Auto box and choosing the specific option.
Bandwidth - Auto
If the host is connected to a hub or switch port which can do 100 Mbps, then the Ethernet NIC
on the host will choose 100 Mbps (Fast Ethernet). Otherwise, if the hub or switch port can only
do 10 Mbps, then the Ethernet NIC on the host will choose 10 Mbps (Ethernet).
Duplex - Auto
Hub: If the host is connected to a hub, then the Ethernet NIC on the host will choose Half Duplex.
Switch: If the host is connected to a switch, and the switch port is configured as Full Duplex (or
Autonegotiation), then the Ethernet NIC on the host will choose Full Duplex. If the switch port is configured
as Half Duplex, then the Ethernet NIC on the host will choose Half Duplex. (Full Duplex is a much more
efficient option.)
The information is automatically saved when entered.
Dept of MCA Computer Networking
Repeat these steps for the other hosts. Use the information below for IP Addresses and Subnet Masks.
H IP Subnet Mask
o Address
s
t
P 172.16.1. 255.255.0.0
C 10
0
P 172.16.1. 255.255.0.0
C 11
1
P 172.16.1. 255.255.0.0
C 12
2
P 172.16.1. 255.255.0.0
C 13
3
To verify the information that you entered, move the Select tool (arrow) over each host.
To delete a device or link, choose the Delete tool and click on the item you wish to delete.
Click once on Switch0 and choose FastEthernet0/4 (actual port does not matter).
Dept of MCA Computer Networking
The link light for switch port FastEthernet0/4 will begin as amber and eventually change to green as the
Spanning Tree Protocol transitions the port to forwarding.
Network Simulation
In this part, we are going to use the simulator to simulate traffic between hosts. For this scenario, delete the
switch and host PC3, then connect host PC2 to the hub.
Task 1 Observe the flow of data from PC0 to PC1 by creating network traffic.
Dept of MCA Computer Networking
a. Switch to Simulation Mode by selecting the tab that is partially hidden behind the Real Time tab in
the bottom right-hand corner. The tab has the icon of a stopwatch on it.
NOTE: When Simulation Mode is chosen, a Simulation Panel will appear on the right side of the screen.
This panel can be moved by moving the cursor at the top of the panel until it changes and then double-
clicking on it. The panel can be restored to the original location by double-clicking on the Title bar. If the
panel is closed, click on the Event List button.
b. Click on Edit Filters, and then select All/None to deselect every filter. Then choose ARP and ICMP
and click in the workspace to close the Edit Filters window.
c. Select a Simple PDU by clicking the closed envelope in the Common Tools Bar on the right.
Move to PC0 and click to establish the source. Move to PC1 and click to establish the destination. Notice that
two envelopes are now positioned beside PC0. This is referred to as a data traffic scenario. One envelope is
an ICMP packet, while the other is an ARP packet. The Event List in the Simulation Panel will identify
exactly which envelope represents ICMP and which represents an ARP.
Dept of MCA Computer Networking
A scenario may be deleted by clicking on the Delete button in the Scenario panel.
Multiple scenarios can be created by clicking on the New button in the Scenario panel. The scenarios can
then be toggled between without deleting.
d. Select Auto Capture / Play from the Simulation Panel Play Controls.
Below the Auto Capture / Play button is a horizontal bar, with a vertical button that controls the speed of the
simulation. Dragging the button to the right will speed up the simulation, while dragging is to the left will
slow down the simulation.
Notice that the ARP envelope is no longer present. This has reset the simulation but has not cleared any
configuration changes or MAC / ARP table entries.
Notice that the ICMP envelope moved forward one device and stopped. The Capture / Forward button will
allow you to move the simulation one step at a time.
g. Choose the Power Cycle Devices button on the bottom left, above the device icons.
h. Choose yes
Notice that both the ICMP and ARP envelopes are now present. The Power Cycle Devices will clear any
configuration changes not saved and clear the MAC / ARP tables.
a. Choose the Auto Capture / Play button and allow the simulation to run completely.
b. Click on PC-0 and select the Desktop tab.
c. Select the Command Prompt and type the command arp -a.
d. Notice that the MAC address for PC2 is in the ARP table (to view the MAC address of PC2, click on
PC2 and select the Config tab).
e. To examine the ARP tables for PC1 and PC2in another way, click on the Inspect Tool.
Dept of MCA Computer Networking
Then click on PC1 and the ARP table will appear in a new window.
Note that PC2 does not have an entry in the ARP table yet. Close the ARP Table window.
f. Click on PC2 to view the ARP table. Then close the ARP Table window.
c. Move the cursor to the Logical Workspace and click on the desired location.
NOTE: If multiple instances of the same device are needed press and hold the Ctrl button, click on the
desired device, and then release the Ctrl button. A copy of the device will be created and can now be move
to the desired location.
d. Click on the router to bring up the Configuration Window. This window has three modes.
The Physical mode is used to add modules to a device, such as a WAN Interface Card (WIC). The Config
mode is used for basic configuration. Commands are entered in a simple GUI format, with actual equivalent
IOS commands shown in the lower part of the window. The CLI mode allows for advanced configuration of
the device. This mode requires the user to enter the actual IOS commands just as they would on a live device.
e. In the Physical mode, click on the router power switch to turn the device off.
f. Select the WIC-2T module and drag it to Slot 0 on the router. Then drag a WIC Cover to Slot1.
Dept of MCA Computer Networking
NOTE: The Smart Connection can be used to automatically select the appropriate cable type. However, the
user will have no choice as to which interface the connection is assigned to; it will take the first available
appropriate interface.
i. Click on the hub and choose Port 3. Then click on the router and choose interface FastEthernet 0/0.
a. Click on the Config mode tab of Router0 to begin configuring the device.
b. After the device has finished booting, change the display name of the router to CISCO_1. Changing
the display name does not affect the configuration.
NOTE: If the device hangs up in the booting process, save the activity. Then close the application and
reopen the file.
c. Click in the Hostname field and type CISCO_1, then press the TAB key. Note the equivalent IOS
command is entered in the lower portion of the window.
d. Click on interface FastEthernet 0/0 and assign the IP address 192.168.1.1, then press the TAB key.
Enter the subnet mask 255.255.255.0.
Dept of MCA Computer Networking
Task 5 Create a copy of the existing router complete with WIC modules already in place
a. Make sure that the existing router is selected (it will be grayed out).
b. In the Main Tool Bar click on the Copy tool.
c. Click on the Paste tool and the copied device will appear in the work area.
f. Click on the CISCO_1 router and connect to the Serial 0/0/0 interface.
g. Click on the new router (copy CISCO_1) and connect to the Serial 0/0/0 interface.
Dept of MCA Computer Networking
b. Select a Simple PDU and click on PC-A as the source, then click on Cisco_2 as the destination. The
ping should be successful.
Dept of MCA Computer Networking
CONCLUSION:
The Practical activities provide using cisco Packet Tracer successfully helped students understand the basic
concepts of networking and improve student achievement as reported in CORR.
Dept of MCA Computer Networking
Experiment 2
AIM: To Perform Simple Data Communication using Switch with the help of
Packet Tracer.
Step 1: Forms Simple networks using end Devices, Switches and Cables.
Refers all steps of Experiment 1. By adding end devices and Switches, connecting though cable. Form
Simple Networks which will become like the below figure.
H IP Subnet Mask
o Address
s
t
P 192.168. 255.255.255.0
C 10.1
0
P 192.168. 255.255.255.0
C 10.2
1
P 192.168. 255.255.255.0
C 10.3
2
Dept of MCA Computer Networking
P 192.168. 255.255.255.0
C 10.4
3
P 192.168. 255.255.255.0
C 10.5
4
P 192.168. 255.255.255.0
C 10.6
5
P 192.168. 255.255.255.0
C 10.7
6
P 192.168. 255.255.255.0
C 10.8
7
P 192.168. 255.255.255.0
C 10.9
8
P 192.168. 255.255.255.0
C 10.10
9
P 192.168. 255.255.255.0
C 10.11
1
0
P 192.168. 255.255.255.0
C 10.12
1
1
Dept of MCA Computer Networking
Conclusion:
Cisco Packet Tracer is a tool built by Cisco and it Provides network simulation to practice simple and
complex network.
Dept of MCA Computer Networking
Experiment 3
Objectives:
● Connect a router/switch and computer using a console cable.
• Configure Packet Tracer Terminal to establish a console session with a Cisco IOS Router/Switch.
• Configure HyperTerminal to establish a console session with a Cisco IOS router/switch.
• Configure Cisco router global configuration settings.
Theory
Command Interface User Levels.
The following figure illustrates the different user levels provided by IOS.
The privileged EXEC mode is entered by this command: Router1>enable If a password is set, then the system will
require it at this stage. Typing the password displays the following command prompt: Router1# For logging off, type:
Router1#disable
Router1#Configure terminal
Dept of MCA Computer Networking
• The argument terminal tells the router that the configuration commands will be entered from a terminal. The
alternatives are to issue configuration commands from a configuration file or from a remote machine via a file
transfer
• The command prompt in the global configuration mode is:
Router1(Config)#
Notes: Typing a question mark (?) in a given command mode generates a list of all available commands in the current
command mode Router1(config-if)#? This command helps to determine if a command can be executed in the current
mode The question mark can also be used to determine the list of available options of a command. Router1#configure ?
If a certain command enables a feature of a router than adding a “no” in front of that command disables the same
feature. Sometimes it is the other way around, that is, the command to enable a feature uses the command to disable the
feature preceded by a “no” Examples:
Procedure:
Part 1.1: Configure Packet Tracer Terminal to Establish a Console Session with a Cisco IOS Router/Switch.
PT Terminal is a simple emulation program for serial communication that can be used to connect to the console port on
Cisco IOS devices. A serial interface on a computer is connected to the Cisco device via a console cable. Using PT
Terminal is the most basic way to access a router for checking or changing its configuration.
Steps:
1- Select a PC and a router from the Network Component Box.
2- Connect the console (rollover) cable to the console port on the router. Connect the other cable end to the host
computer with a DB-9 or DB-25 adapter to the COM 1 port.
3- If not already powered on, enable power to the computer and router.
Dept of MCA Computer Networking
4- From the Windows taskbar, start the PT Terminal program by clicking PC0>Desktop Tab> Terminal
5- Use the following settings of the Terminal Session. Bits per second 9600, Data bits 8, Parity None, Stop bits 1, Flow
control None
6- You should see a response from the router on the screen (press enter several
times). 7- Power cycle the router and watch the reaction on the terminal.
Common configuration tasks include setting the hostname, access passwords, and (Message of the Day Banner) MOTD
banner. Interface configuration is extremely important. In addition to assigning a Layer 3 IP address, enter a
description that describes the destination connection speeds troubleshooting time. Configuration changes are effective
immediately. Configuration changes must be saved in NVRAM to be persistent across reboot. Configuration changes
may also be saved off-line in a text file for auditing or device replacement. Cisco IOS switch configuration is similar to
Cisco IOS router configuration.
From the global config mode, there are many different configuration modes that may be entered. Each of these modes
allows the configuration of a particular part or function of the IOS device. The list below shows a few of them:
From the privileged exec mode, enter global configuration mode: Router# configure terminal Router(config)#
Set the device hostname to Router1: router(config)# hostname Router1 Router1(config)#
PROGRAM:
Router enable => Router #
Router # configure terminal
Router (config)# interface just ethernet 01Router (config .d) # no shut down.
Router (config.id) # exit
Router (config.id) #interface serial 01010
Router(config.id) # no shut down
Router (config.id) # clock router 64000.
Routes -> enable
Router #configure. terminal
Router #configure # interface just othernut ola
Router (config. id) # no shutdown
Router (config.id) #exit.
Router (config) # interface serial 01010
Router (config) # no shutdown.
Router (config.id) # clock router 64000
Router (config-id)#interface serial o1o11
router (config. id) # no shutdown
Router (config-id)# Clock router 64000
Router (config-id)# exit
Conclusion:
Router configuration is a fundamental Sicill for network administrators and engineers. a well configured
router ensure that data flow efficiently between difference network segment.
Experiment 4
AIM: To Configure Network using Static Routing with the help of Packet Tracer.
Program:
Program: Router - I
Router 2-
255.255.255.0 192.168.10.2
Router-3:
Router-4:
Conclusion:
Static routing is a routing protocol that help to keep your network, organized and to optimize routing
Performance.
Dept of MCA Computer Networking
Experiment 5
AIM: To Configure Network using Distance Vector Routing Algorithm with the help of
Packet Tracer. (RIP Protocol)
Program:
Router # configure terminal
router (config) # router RIP
router (Config-router) # network 192.168.10.0
router (config-router) # network 192.168.20.0
routing (config-router) # end
Router: 2
Router: 3
Router: 4
Conclusion:
By this we learn about dynamic routing concept and striped with RIP distance vector.
Dept of MCA Computer Networking
Experiment 6
AIM: To Configure Network using Link State Vector Routing Algorithm with the help of
Packet Tracer. (IGRP Protocol)
Program:
Router-1:
Router 2:
0.0.0.255 area o
0.0.0.255 area O
Router 3:
Conclusion:
By this we learn about link state Routing is a Powerful and efficient routing algo. used in
computer networks.
Dept of MCA Computer Networking
Experiment 7
AIM: To Configure Network using Open Shortest Path First Protocol with the help of Packet
Tracer.
Program:
Commands to configure OSPF:
(config) router)# network <network ID> 1 wildcard mark > area < area ID>
Implementation program:
0.0.0.255 area o
Dept of MCA Computer Networking
Conclusion:
In this OSPF is a widely used Jink-State routing porotocol that plays a crucial role in determining the
most efficient router for data transmission.
Dept of MCA Computer Networking
Experiment 8
OBJECTIVES:
The objective of this lab is to study how to divide a physical network into a number of separate logical networks
using virtual local area networks (VLANs) with the benefit of decreasing collision domain and adding more
security.
Theory:
Figure 9.1 illustrates the flat network architecture that used to be so typical for layer 2 switched networks. With
this configuration, every broadcast packet transmitted is seen by every device on the network regardless of
whether the device needs to receive that data or not.
advance comes with new issues. For instance, the more users and devices that populates and uses a network, the
more broadcasts and packets each switch must handle.
And there’s another big issue—security! This one is real trouble because within the typical layer 2 switched
internetworks, all users can see all devices by default. And you can’t stop devices from broadcasting, plus
you can’t stop users from trying to respond to broadcasts. This means your security options are dismally
limited to placing passwords on your servers and other devices.
But wait—there’s hope if you create a virtual LAN (VLAN)! You can solve many of the problems associated with
layer 2 switching with VLANs, as you’ll soon see. VLANs work like this: Figure 9.3 shows all hosts in this very
small company connected to one switch, meaning all hosts will receive all frames, which is the default behavior of
all switches.
Figure 9.3 One switch, one LAN: Before VLANs, there were no separations between hosts
If we want to separate the host’s data, we could either buy another switch or create virtual LANs, as shown in
Figure 9.4.
Figure 9.4 One switch, two virtual LANs (logical separation between hosts): Still physically one switch, but this switch
acts as many separate devices.
In Figure 9.4, I configured the switch to be two separate LANs, two subnets, two broadcast domains, two VLANs
—they all mean the same thing—without buying another switch. We can do this 1,000 times on most Cisco
switches, which save thousands of dollars and more!
Notice that even though the separation is virtual and the hosts are all still connected to the same switch, the LANs
can’t send data to each other by default. This is because they are still separate networks.
Coming up, we’ll thoroughly explore the world of switching, and you learn exactly how and why switches
provide us with much better network services than hubs can in our networks today.
Dept of MCA Computer Networking
Program:
Switch (config)# interface range fast element 0/4-12
Switch (Config-if)#end
Conclusion:
The effective implement of VLAN and to enhance network security by keeping. devices that operate
with sensitive information on a separate VLAN.
Dept of MCA Computer Networking
Experiment 9
AIM: To take backup of IOS (Internet Operating System) image from working CISCO router
and to install the same in a crashed CISCO router.
Program:
Dept of MCA Computer Networking
Conclusion:
In this cisco IOS allow devices within a network to communicate with each other,meaning sure that
from one device gets sent to the right destination device.
Dept of MCA Computer Networking
Experiment 10
C++
C++ is the predominant programming language in ns-2. It is the language used for all the small programs
that make up the ns-2 hierarchy. C++, being one of the most common programming languages and specially
designed for object- oriented coding, was therefore a logical choice what language to be used. This helps
when the user wants to either understand the code or do some alterations to the code. There are several
books about C++ and hundreds, if not thousands, of pages on the Internet about C++ simplifying the search
for help or answers concerning the ns-2 code.
OTcl
Object Tcl (OTcl) is object-oriented version of the command and syntax driven
programming language Tool Command Language (Tcl). This is the second of the two
programming languages that NS-2 uses. The front-end interpreter in NS-2 is OTcl which
link the script type language of Tcl to the C++ backbone of NS-2. Together these two
different languages create a script controlled C++ environment. This helps when creating a
simulation, simply writing a script that will be carried out when running the simulation.
These scripts will be the formula for a simulation and is needed for setting the specifications
of the simulation itself. Without a script properly defining a network topology as well as the
data-rows, both type and location, nothing will happen.
Nodes
A node is exactly what it sounds like, a node in the network. A node can be either an end
connection or an intermediate point in the network. All agents and links must be connected
to a node to work. There are also different kinds of nodes based on the kind of network that
is to be simulated. The main types are node and mobile node, where node is used in most
wired networks and the mobile node for wireless networks. There are several different
commands for setting the node protocols to be used, for instance what kind of routing is to
be used or if there is a desire to specify a route that differs from the shortest one. Most of the
commands for node and mobile node can be easily found in the ns documentation. Nodes
and the closely connected link creating commands, like simplex link and duplex link, could
be considered to simulate the behavior of both the Link Layer.
Agents
An agent is the collective name for most of the protocols you can find in the transport layer.
In the ns-2 documentation agents are defined as the endpoints where packets are created and
consumed. All the agents defined in ns-2, like tcp, udp etc., are all connected to their parent
class, simply called Agent. This is where their general behavior is set and the offspring
classes are mostly based on some alterations to the inherent functions in the parent class.
The modified functions will overwrite the old and thereby change the performance in order
to simulate the wanted protocol.
Applications
The applications in ns-2 are related to the Application Layer in the TCP/IP suite. The
hierarchy here works in the similar way as in the agent’s case. To simulate some of the most
important higher functions in network communication, the ns-2 applications are used. Since
the purpose of ns-2 is not to simulate software, the applications only represent some
different aspects of the higher functions. Only a few of the higher layer protocols has been
implemented, since some are quite similar when it comes to using the lower functions of the
TCP/IP stack. For instance there is no use adding both a SMTP and a HTTP application
since they both use TCP to transfer small amounts of data in a similar way. The only
applications incorporated in the release version of ns-2 are a number of different traffic
generators for use with UDP and telnet and FTP for using TCP. All the applications are
script controlled and when concerning the traffic generators, you set the interval and
54
Dept of MCA Computer Networking
packet-size of the traffic. FTP can be requested to send a data packet whenever the user
wants to, or to start a transfer of a file of arbitrary size. If starting an FTP transmission and
not setting a file-size the transmission will go on until someone calls a stop.
NAM
The Network Animator NAM is a graphic tool to use with ns-2. It requires a nam-tracefile
recorded during the simulation and will then show a visual representation of the simulation.
This will give the user the possibility to view the traffic packet by packet as they move along
the different links in the network. NAM offers the possibility of tracing a single packet
during its travel and the possibility to move the nodes around for a user to draw up his
network topology according to his own wishes.
Since the simulation has already been performed there is no possibility for the user to change
the links or any other aspect of the simulation except the representation. The existence of an
Xserver allows NAM to be able to open a graphical window. Therefore if NAM is to work,
there must be a version of X-server running.
Conclusion:
In this NS2 Provide substational support for simulation of difference. Protocols over wired and
wireless network.
Dept of MCA Computer Networking
Experiment 11
AIM: Installation of NS2 in LINUX Operating System.
(1) Download ns2.34
http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.34/ns-allinone-
2.34.tar.gz/download or from anywhere else.
(2) Unzip the ns-allinone-2.34.tar.gz to any place where you want to install your ns. In
my case I want to unzip it in /home/gz/ (note that my zipped folder of ns2 was in
/home/gz) $ cd /home/gz $ tar -xzvf ns-allinone-2.34.tar.gz
(3) $cd ns-allinone-2.34
(4) $sudo apt-get install build-essential autoconf automake libxmudev
(5) $./install
Errors: It will take some time. After this step you may encounter some errors like
the following Snapshot
If you get the errors as above, follow the steps from 5.1 to 5.6, otherwise go to step (6) 5.1
$gedit otcl-1.13/Makefile.in 5.2 edit the file as follows: old file snapshot
(6) $ gedit ~/.bashrc It will open the file shown below. Edit the lines that are
highlighted according to your path of ns2. I installed my ns2 in /home/gz/ns-
allinone-2.34
Dept of MCA Computer Networking
Conclusion:
In this NS2 Provide substational support for simulation of difference. Protocols over wired and
wireless network.