Computer Networks Lab Manual
Compiled By: Tanzeel Ur Rehman
Lecturer, Department of Information
Technology
Elite Colleges
(
[email protected])
The document can be used for educational or teaching purpose
by mentioning writer’s name.
General Instructions
Course Description
This course examines principles, design, implementation, and performance
of ¬¬¬computer networks. We will study the concepts in class and practice
virtually on a software named Packet Tracer 8.0.
Required Software
Packet Tracer 8.0
Lab Report
Students are required to submit a short report after every lab containing
screenshots of the work done in lab.
Chapter 1:
Introduction to Packet Tracer
Objective:
To get familiarization with “Packet Tracer 8.0”
How to make Connections Between more than one Devices
How to test the Connectivity between the devices
Introduction:
Packet Tracer 8.0 is a standalone, simulation-based learning environment
to design, configure, and troubleshoot computer networks.
Selection of Devices:
Choose a device type from the Device-Type Selection box.
Click on the desired device model from the Device-Specific Selection
box.
Click on a location in the workspace to put your device in that
location.
If you want to cancel your selection, press the Cancel icon for that
device.
To quickly create many instances of the same device , press and hold the
Ctrl button, click on the device in the Device-Specific Selection box, and
then release the Ctrl button. The device is now locked, and you can click on
the workspace multiple times to add multiple copies of the device. Cancel
this operation by pressing the Cancel icon for that device. To duplicate
devices, you can press and hold the Ctrl button and then drag a device on
the workspace or select the devices and then use the Copy and Paste
buttons.
Packet Tracer 8.0 devices have modular bays or slots into which you can
insert
modules. In the workspace, click on a device to bring up its configuration
window. By default, you will be in the Physical Device View subpanel of the
device. An interactive picture of the device is on the right of the panel, and a
list of compatible modules is on the left.
Switches:
Switch: 2950-24
Member of the Cisco Catalyst 2950 series switch family.
Fixed-configuration, Standalone switch.
Can support 10/100 switch providing user connectivity for small- to
mid-sized networks.
Does not support add-in modules.
Switch: 2950T-24
Member of the Catalyst 2950 Series Intelligent Ethernet Switch family.
Fixed-configuration, Standalone switch.
Provides wire-speed Fast Ethernet and Gigabit Ethernet connectivity
for mid-sized networks.
Does not support add-in modules.
Switch: 2960-24TT
Member of the Catalyst 2960 Series Intelligent Ethernet Switch family.
Fixed-configuration, Standalone switch.
Provides wire-speed Fast Ethernet and Gigabit Ethernet connectivity
for mid-sized networks.
Does not support add-in modules.
Switch: Switch-PT
Generic switch.
10 slots, 1 console port, and 1 auxiliary port.
Switch: 3560-24PS
Member of the Catalyst 3560 Series Intelligent Ethernet Switch family.
Fixed-configuration, Standalone switch.
Provides wire-speed Fast Ethernet and Gigabit Ethernet connectivity for mid-
sized networks.
Does not support add-in modules.
Making Connections
Click the Connections icon from the Device-Type Selection box to
bring up the list of available connections.
Click the appropriate cable type.
You can choose “automatically select connection type” to select the
appropriate cable automatically.
The mouse pointer will change into a "connection" cursor. Click on
the first device and choose an appropriate interface to which to
connect.
Click on the second device and do the same.
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)
IP Addressing:
Click on the Devices.
Click on Desktop tab.
Click on IP Configuration.
Enter the IP Address of device.
Testing the Connectivity:
Click on any of the devices connected with Switch.
Click on Desktop Tab.
Click on Command Prompt Tab and write “ping < IP Address of any
device>” and press “Enter”.
If you get the reply from all the devices, then it means the devices can
communicate or share the data from each other otherwise you will
get Time Out message in case of devices are not connected.
Chapter 2:
The Cisco Router User Interface
OBJECTIVE
• To get familiarization with Routers
• To learn how to connect a router for configuration
• To learn about the different Configuration modes of Routers
• To learn editing and help features
TheCisco Internetwork Operating System (IOS) is the kernel of Cisco
routers and most switches (A kernel is a part of an operating system that
allocates resources and manages things such as low-level hardware
interfaces and security).
Almost all Cisco routers run the same IOS, in contrast to about half of their
switches because Cisco has acquired devices that they have not designed
and built themselves.
In this section, we shall discuss the Cisco IOS and learn how to configure a
Cisco router step-by-step, using setup mode. In the next section, we shall
learn to do this using the command-line interface (CLI).
The Cisco IOS could be accessed through:
The console port of a router.
Auxiliary (or Aux) port.
Telnet.
Access to the IOS command line is called anEXEC session.
Connecting to a Cisco Router
You can connect to a Cisco router to configure it, verify its configuration,
and check statistics.
There are different ways to do this:
The first place you would connect to is the console port. Theconsole
port is usually an RJ-45 (8 pin modular) connection located at the
back of the router—by default, there is no password set.
You can also connect to a Cisco router through anauxiliary port
—which is really the same thing as a console port. This auxiliary port
also allows you to configure modem commands so that a modem
can be connected to the router.
The third way to connect to a Cisco router is through the program
Telnet . Telnet is a terminal emulation program that acts as though it
is a dumb terminal. You can use Telnet to connect to any active
interface on a router, such as an Ethernet or a serial port.
Figure shows an illustration of a 2620XM Cisco router.
This router has one console and one auxiliary connection via RJ-45
connectors.
Bringing Up a Router
When you first bring up a Cisco router, it will run a power-on self-test
(POST). If it passes, it will then look for and load the Cisco IOS from flash
memory—if an IOS file is present.
The following messages appear when you first boot or reload a router:
Setup Mode
To enter setup mode, just say “yes” or “y” to the following question:
Basic Management setup configures only enough connectivity for
management of the system. We want to configure each interface on the
system so we will choose “No”. It will take us to the Extended mode.
You can go to CLI mode and discard the running-config (0); you can go
back to setup to do it all over again (1); or you can save this configuration
to NVRAM, something known as startup-config (2).
Command-Line Interface
Because it is so much more flexible, thecommand-line interface (CLI) truly
is the best way to configure a router.
To use the CLI, just say No to enter the initial configuration dialog. After you
do that, the router will respond with messages that tell you all about the
status of every one of the router’s interfaces.
Logging into the Router
After the interface status messages appear and you press Enter, the
Router> prompt will appear. This is calleduser exec mode (user
mode) and it is mostly used to view statistics.
You can only view and change the configuration of a Cisco router in
privileged exec mode (privileged mode), which you get into with the
enable command.
Router>
Router>enable
Router#
You now end up with a Router# prompt, which indicates that you are in
privileged mode , where you can both view and change the router’s
configuration. You can go back from privileged mode into user mode by
using the “disable ” command, as seen here:
Router#disable
Router>
At this point, you can type logout to exit the console:
Router>logout
Overview of Router Modes
To configure from a CLI, you can make global changes to the router by
typing
configure terminal (or config t for short), which puts you inglobal
configuration
mode and changes what is known as the running-config. A global
command (a command run from global config) is set only once and affects
the entire router.
You can type config from the privileged-mode prompt and then just press
Enter to take the default of terminal, as seen here:
Router#config
Configuring from terminal, memory, or network [terminal]?[Enter]
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#
CLI Prompts
It is important that you understand the different prompts you can find when
configuring a router.
Interfaces
Tomake changes to an interface , you use the interface command from
global
configuration mode:
Config-if means that you have entered in the fast ethernet interface 0/0 and
now you can make changes in it. To know what you can do here, just write
“?” .
Line Commands
Toconfigure user-mode passwords , use the line command.
Routing Protocol Configurations
To configure routing protocols such as RIP and IGRP, write name of
protocol after router and press Enter.
Editing and Help Features
You can use the Ciscoadvanced editing features to help you configure your
router. If you type in a question mark (?) at any prompt, you will be given a
list of all the commands available from that prompt:
Just press the Up-arrow key to redisplay the last command entered,
And if you receive the following error:
You have entered acommand incorrectly . See that little caret—the ^? It is s
a very helpful tool that marks the exact point where you blew it and entered
the command wrong.
Table shows the list of the enhanced editing commands available on a
Cisco router.
Command Meaning
Ctrl+A Moves your cursor to the beginning of the line
Ctrl+E Moves your cursor to the end of the line
Esc+B Moves back one word
Ctrl+B Moves back one character
Ctrl+F Moves forward one character
Esc+F Moves forward one word
Ctrl+D Deletes a single character
Backspace Deletes a single character
Ctrl+R Redisplays a line
Ctrl+U Erases a line
Ctrl+W Erases a word
Ctrl+Z Ends configuration mode and returns to EXEC
Tab Finishes typing a command for you
You can review the router-command history with the commands shown in
following Table
Command Meaning
Ctrl+P or Up arrow Shows last command entered.
Ctrl+N or Down
Shows previous commands entered.
arrow
Shows last 10 commands entered by default.
show history
Shows terminal configurations and history buffer
show terminal
size.
terminal history size
Changes buffer size (max 256)
LAB 3:
Router and Switch Administrative
Functions
Objective:
Setting Hostname
Setting Banners
Setting Passwords
Setting Hostname:
We can set the name of a router or a switch for our ease. This name is only
for local use and will not be visible outside the network.
Setting Banners:
Banners are used to show a message when someone tries to access your
router or switch. It is also used to provide information to people working
with that router or switch.
Setting Passwords:
There are five passwords used to secure your Cisco routers: console,
auxiliary, telnet (VTY), enable password, and enable secret.
The first two passwords are used to set your enable password that is
used to secure privileged mode. This will prompt a user for a
password when the enable command is used.
The other three are used to configure a password when user mode is
accessed either through the console port, through the auxiliary port,
or via Telnet.
Setting Enable Password:
Setting Enable Secret Password:
User-mode passwords are assigned by using the line command:
aux Sets the user-mode password for the auxiliary port. It’s usually used for
attaching a modem to the router, but it can be used as a console as well.
console Sets a console user-mode password.
vty Sets a Telnet password on the router. If this password isn’t set, then
Telnet can’t be used by default
Configuring Aux Password:
It is important to remember the login command, or the auxiliary port won’t
prompt for authentication.
Configuring Console Password:
Configuring Telnet Password:
“Show running-config” command can provide you information about the
passwords you have set on your router or switch.
Chapter 4
Router Interfaces
Objective:
Configuration of Router Interfaces
Verifying Your Configuration
Configuring Router:
By putting the cursor on the router, it will show you all the interfaces
on it.
To configure each interface, use command int fastethernet port
number or int serial port number in global configuration mode e.g., int
fa 0/1
By writing “?”, it will tell you all the commands you can use in it .
Commands
Bandwidth:
Bandwidth command is used to set the bandwidth.
Speed:
Speed Command is used to set the data rate.
Duplex:
Duplex command is used to set the duplex mode.
Shutdown:
You can turn an interface off with the interface command shutdown
and turn it on with the no shutdown command.
IP:
By entering “?” after IP, it will tell you all the commands related to IP.
To assign IP address, we use the command ip address and then write
the ip address and subnet mask as shown in the figure. Do not forget
to turn on an interface with the no shutdown command.
Verifying Your Configuration
show running-config would be the best way to verify your
configuration and show startup-config would be the best way to
verify the configuration that will be used the next time the router is
reloaded.
You can verify your configuration with utilities such as Ping and
Telnet. Ping is Packet Internet Groper, a program that uses ICMP
echo requests and replies. Ping sends a packet to a remote host, and
if that host responds, you know that the host is alive. You must
assign IP addresses before using the command ping. You must give
ip addresses of the same class.
Telnet is really the best tool, since it uses IP at the Network layer and
TCP at the Transport layer to create a session with aremote host . If
you can telnet into a device, your IP connectivity just must be good.
Another way to verify your configuration is by typing show interface
commands, the first of which is show interface.
The show ip interface command will provide you with information
regarding the layer 3 configurations of a router’s interfaces:
Show ip interface brief command provides a quick overview of the
router’s interfaces including the logical address and status:
The show protocols command is a helpful command you’d use to see
the quick status of layers 1 and 2 of each interface as well as the IP
addresses used.
Chapter 5
Configuring IP Routing
Objective:
To learn the Static Routing
To learn the Default Routing
To learn the Dynamic Routing
Configurations in LAB_A Router:
Copy running-config startup config command is used to save
configuration so that it can run when the router starts.
Configurations in LAB_B Router:
Configurations in R1 Router:
Configurations in R2 Router:
To view the IP routing tables created on a Cisco router, use the
command show ip route.
Notice that only the configured, directly connected networks are
shown in the routing table.
Now try pinging 192.168.20.1, 192.168.20.2, 192.168.40.1,
192.168.30.1 from router Lab_A,
Static Routing:
Static routing occurs when youmanually add routes in each router’s
routing table.
Static routing has the following benefits:
There isno overhead on the router CPU, which means you
could possibly buy a cheaper router than if you were using
dynamic routing.
There isno bandwidth usage between routers, which means
you could possibly save money on WAN links.
Itadds security because the administrator can choose to
allow routing access to certain networks only.
Static routing has the following disadvantages:
The administrator must reallyunderstand the internetwork
and how each router is connected to configure routes
correctly.
If a network is added to the internetwork, the administrator
has toadd a route to it on all routers—by hand.
It is not feasible in large networks because maintaining it
would be a full-time job.
Command:
ip route [destination_network ] [mask ] [next hop address or exit interface ]
administrative_distance ] [permanent]
ip route: The command used to create the static route.
destination_network : The network you are placing in the routing table.
mask: The subnet mask being used on the network.
next hop address: The address of the next-hop router that will
receive the packet and forward it to the remote
network.
exit interface: You can use it in place of the next-hop address if
you want, but it has got to be on a point-to-point
link, such as WAN. This command will not work on a
LAN such as Ethernet.
administrative_distance: By default, static routes have an
administrative distance of 1 (or even 0 if you
use an exit interface instead of a next-hop
address). You can change the default value by
adding an administrative weight at the end of the
command.
permanent: If the interface is shut down, or the router cannot
communicate to the next hop router, the
route will automatically be discarded from the
routing table. Choosing the permanent option
keeps the entry in the routing table no matter what
happens
Configuration at Router LAB A
Each routing table automatically includes directly connected
networks. To be able to route to all networks in the internetwork, the
routing table must include information that describes where these
other networks are located and how to get there.
The Lab_A router is connected to ips 192.168.10.1, 192.168.50.1 and
192.168.20.1. For the Lab_A router to be able to route to all ips, the
following
ips have to be configured in its routing table: 192.168.30.1,
192.168.40.1.
Note that, we have mentioned ips nor networks. You can also add
networks e.g., 192.168.30.0. In this case you will have access to all
the devices in that network.
The S in the routing table entries above means that the network is a
static entry. The [1/0] is the administrative distance and metric. Here
the next-hop interface is 0, indicating that it is directly connected.
Configuration at Router LAB B
Default Routing:
As we are considering the same example in which we first configured static
routing, so we must disable static routing before configuring default
routing.
Dynamic Routing:
As we are considering the same example in which we first configured
default routing, so we must disable default routing before configuring
dynamic routing.
Configuring RIP Routing
Configuration at Router LAB A
Configuration at Router LAB B
Configuring OSPF Routing
As we are considering the same example in which we first configured rip
routing, so we must disable rip routing before configuring OSPF routing.
Configuration at Router LAB A
Configuration at Router LAB B
Thank you
Remember in Prayers