Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 28

COMSATS University Islamabad, Sahiwal Campus Computer Network

Lab

COMSATS University Islamabad

Sahiwal Campus

Computer Networks Lab

Student Name: ZEESHAN SOHIAL

Student ID: SP22-BCS-124

BS (Computer Science)
________________________________________________________

Engr. M. Kashif Rao


________________________________________________________

DEPARTMENT OF COMPUTER SCIENCE


COMSATS University Islamabad
Sahiwal Campus

Computer Networks Lab Page 1


LAB NO: 1 Setting up a small network.
Objective:

This lab exercise is designed to demonstrate and help in learning & understanding
of the procedure of setting up a small network.
Equipment:
 Straight & Cross Cat5 UTP cables – (made in last lab)
 Computers
 A Switch/Hub (if network size is to be increased)
 A Router (if communication is to be done with WAN/Internet)
Introduction:

This lab introduces NIC (Network Interface Controller/Card), Switch/Hub &


Router. Before going to the procedure, firstly a small introduction of the devices is
given.

 NIC (Network Interface Card):

A network interface controller is a computer hardware component that


connects a computer to a computer network. The controller may also be referred
to as a network adapter, or a LAN adapter. Also known as a network interface
card, network card or LAN card.

 Hub:

An Ethernet hub, active hub, network hub, repeater hub or hub is a device
for connecting multiple twisted pair or fiber optic Ethernet devices together and
making them act as a single network segment. Hub works at the physical layer
(layer 1) of the OSI model. The device is a form of multiport repeater. Repeater
hubs also participate in collision detection, forwarding a jam signal to all ports if it
detects a collision.
Figure 1 hub

 Switch (LAN Switch):

Switches are devices capable of creating temporary connections


between two or more devices linked to the switch. It acts just like hub but
has advanced features for network optimization & better security. Switch
works at the Data Link layer (layer 2) of the OSI model. The work a switch
does is called switching.

Figure 2 SWITCH

 PING:

Ping is a computer network administration utility used to test the


reachability of a host on an Internet Protocol (IP) network and to measure the
round-trip time for messages sent from the originating host to a destination
computer.
LAB NO: 2 This lab exercise is designed to understand the difference and
working of network emulators and simulators.
Objective:
To understand the configuration of pc and routers and assigning ip address.
Equipment:

 PCs
 Wires
 Routers (2621XM)
 Switch(2950T-24)

Introduction:
This lab introduces Packet Tracer which is a network simulator provided by
Cisco. Before using it we’ll learn about network emulators and simulators.
Procedure:

1- Open Packet Tracer 5 from Desktop or Start Menu

2- Click on Routers in lower left part, click on 2621XM and then again click in

the main window. The router will appear in the main window.
3- Do the same process to have switch 2950T (in Switches) and five PCs

Generic (in End Devices) in the main window.


4- Find suitable connections in Connections to have the following

topology
5- Double-click on the router and go to Config tab. Choose the FastEthernet

0/0, check the On box and enter 192.168.1.1 as the IP address and
255.255.255.0 as subnet mask. Then choose FastEthernet 0/1, check the On
box an enter 192.168.2.1 as the IP address and 255.255.255.0 as subnet
mask.
6- Double-click on PC0 and go to Desktop tab. Click on IP Configuration

and enter 192.168.1.2 as the IP address and 255.255.255.0 as subnet


mask. 192.168.1.3 for PC1 and 192.168.2.2 for PC2. Enter any IP
address for PC3 and PC4 (in same network)
7- To check communication, go to Desktop tab of any PC, click on the

Command Prompt and use any networking command (ping,tracert etc).


8- You can also use the closed envelope with a plus sign (Add Simple PDU) in

the right menu of the Packet Tracer window. Click on it, then the two nodes
to be checked. This a much better way. To check it benefits, go to
Simulations mode using Shift +
 Diagram:

Figure 3 working of emulator and simulator

 IP config of Ethernet fa0/0:


Figure 4 IP configuration of FA0/0

 IP confi of ethernet fa0/1:

Figure 5 IP configuration of FA0/1

 Results:
When we try to send packet from PC0 to PC2 that are both connected from
same router the packet successfully delivers.

Questions:
Q.1 What is difference between IP address & MAC address?
Ans: The main difference between MAC and IP address is that MAC Address is
used to ensure the physical address of the computer. It uniquely identifies the
devices on a network. While IP addresses are used to uniquely identifies the
connection of the network with that device takes part in a network.

Q.2 Identify the differences between Network Emulator and Simulator?


Ans: A simulator is designed to create an environment that contains all of the
software variables and configurations that will exist in an app's actual production
environment. In contrast, an emulator attempts to mimic all of the hardware
features of a production environment and software features.

Q.3 Can Layer2 Switch be used to connect two LANs? Give reasons for your
answer?
Ans: The layer-2 switch fails when we need to transfer the data between different
LAN or VLAN's. This is where the Layer-3 switches come in the picture as the
technique they use for routing the data packets to the destination is using IP
addresses and subnetting.
LAB NO: 3 a) Make static configuration of router
Objective:
To understand how static configuration of routers work and sending data to
another network.
Equipment:
 PCs
 Wires
 Routers (1841)
 Switch(2950T-24)
Procedure:
1. Add Routers, Switch, PCs to the Topology:
 Drag and drop two routers from the "Router" category in the device list onto
the workspace.
 Drag and drop two switches from the "Switches" category onto the
workspace. Connect one switch to each router.
 Drag and drop two PCs from the "End Devices" category onto each switch.
Connect each PC to its respective switch.

2. Cable Connections:
 Use the "Copper Straight-Through" cable type to connect the routers to
the switches and the switches to the PCs. Click and drag from one
device's port to another to create the connections.

3. Configure IP Addresses on Routers:


 Click on a router to select it.
 Go to the "Config" tab in the router's properties panel.
 Under "FastEthernet0/0" (or similar), click the "Edit" button to configure
the IP address. Assign an IP address like 192.168.1.1 with a subnet mask
of 255.255.255.0.
 Repeat the same process for the second router, giving it an IP address like
192.168.2.1 with the same subnet mask.
4. Configure IP Addresses on PCs:
 Click on a PC to select it.
 Go to the "Config" tab in the PC's properties panel.
 Under "FastEthernet0" (or similar), click the "Edit" button to configure
the IP address. Assign an IP address in the same subnet as the router it's
connected to. For example, for the PC1 connected to Router 1, use
192.168.1.2 with the same subnet mask (255.255.255.0) and PC2
connected to Router 1, use 192.168.1.3 with the same subnet mask
(255.255.255.0).
 Repeat the same process for the other PCs, giving them IP addresses in
their respective subnets.
5. Configure Static Routes on Routers:
 Click on the first router to select it.
 Go to the "Config" tab in the router's properties panel.
 Under "Routing," click on "Static" to access the static routing
configuration.
 Click the "Add" button to create a new static route.
 In the "Destination Network" field, enter the network address you want to
reach through this static route. For example, if you're configuring the first
router, which is connected to the 192.168.1.0/24 subnet, and you want to
reach the 192.168.2.0/24 subnet via Router 2, enter "192.168.2.0."
 In the "Subnet Mask" field, enter the subnet mask for the destination
network, which is "255.255.255.0" for a Class C network.
 In the "Next Hop IP Address" field, enter the IP address of the PC
connected to the other router. For example, for Router 1, enter the IP
address of the connected Router 2 (e.g., 192.168.3.3).
 Click "OK" to add the static route.
 Repeat the same process for the second router:
 Click on the second router to select it.
 Go to the "Config" tab.
 Under "Routing," click on "Static."
 Click the "Add" button to create a new static route.
 Enter the destination network, subnet mask, and the IP address of the
connected to router (e.g., 192.168.2.0, 255.255.255.0, and 192.168.3.2
for Router 2)

 DIAGRAM:
Figure 6 Static configuration of routers
 Ip config of router 1 Fast Ethernet fa0/0:

Figure 7 IP configuration of FA0/0

 Ip config of router 1 fast ethernet fa0/1:

Figure 8 IP configuration of FA0/1


 IP config of router 2 Fast ethernet fa0/0:

Figure 9 IP configuration of FA0/0

 IP config of router 2 Fast ethernet fa0/1:

Figure 10 IP configuration of FA0/1

Working:
 From the above toolbar use “ADD SIMPLE PACKET”.
 Select source of packet which will be PC4 of router 0.
 Select destination of packet which will be PC2 of router1 of other network.
 In the down right corner, we will see progress window which will show
“successful” after we add destination of packet.
 After successful configuration click on simulation button.
 It will simulate a packet going from PC4 of router0 to PC2 of router1.
Figure 11 Results of successful data transmission

Conclusion:
After simulating, we can see how PC4 of router0 of one network is
communicating with PC2 of router1 of another network. Soo our static
configuration of routers is successful.
We can also see the progress of sending and receiving of packets between PC4 and
PC0 by using “PING” on command prompt of PC4.

Figure 12 Pinging from PC0 to PC4

Lab no: 3 b) Static and Default Route Configuration


1. Objective
Upon completion of this lab, you will be able to:

 Routing basics
 Cable a network according to the Topology Diagram.
 Perform basic configuration tasks on a router.
 Configure and activate Serial and Ethernet interfaces.
 Configure a static route using an intermediate address.
 Configure a default static route.
 Document the network implementation.

2. Routing Basics
Once you create an internetwork by connecting your WANs and LANs to a router,
you’ll need to configure logical network addresses, like IP addresses, to all hosts on
that internetwork for them to communicate successfully throughout it.
The term routing refers to taking a packet from one device and sending it through the network to
another device on a different network.

 Destination address
 Neighbour routers from which it can learn about remote networks
 Possible routes to all remote networks
 The best route to each remote network
 How to maintain and verify routing information
The router use one of the following two ways to learn how to get to the remote
network.
 Static Routing
 Dynamic Routing
Static Routing:
The static routing method requires someone to hand-type all network locations into the
routing table, which can be a pretty daunting task when used on all but the smallest of
networks!
Dynamic Routing:
In dynamic routing, a protocol on one router communicates with the same protocol
running on neighbouring routers. The routers then update each other about all the
networks they know about and place this information into the routing table. If a
change occurs in the network, the dynamic routing protocols automatically inform all
routers about the event. If static routing is used, the administrator is responsible for
updating all changes by hand onto all routers.
In-Lab Exercise
In this lab activity, you will create a network that is similar to the one shown in the
Topology Diagram. Begin by cabling the network as shown in the Figure 3.1. Use any
Class C Network ID and fill in the Addressing Table to apply an addressing scheme to the
network devices. You will then perform the initial router configurations required for
connectivity according to your IP assignment. After completing the basic configuration,
test connectivity between the devices on the network. First test the connections between
directly connected devices, and then test connectivity between devices that are not
directly connected. Static routes must be configured on the routers for end-to-end
communication to take place between the network hosts.

Default administrative distances:


Route Source Default AD
Connected interface 0
Static route 1
EIGRP 90
OSPF 110
RIP 120

Topology diagram:

Figure 13 static configuration of network

Routing Table:
device interface Ip address Subnet mask Default gateway
R0 FA 0/0 192.168.1.1 255.255.255.0 -
S 0/0/0 10.0.0.1 255.255.255.0 -
R1 FA 0/0 192.168.2.1 255.255.255.0 -
S 0/0/0 10.0.0.2 255.255.255.0 -
S 0/0/1 11.0.0.1 255.255.255.0 -
R2 FA 0/0 192.168.3.1 255.255.255.0 -
S 0/0/0 11.0.0.2 255.255.255.0 -
PC 0 NIC 192.168.1.2 255.255.255.0 192.168.1.1
PC 1 NIC 192.168.2.2 255.255.255.0 192.168.2.1
PC 2 NIC 192.168.3.2 255.255.255.0 192.168.3.1

Procedure:
1. Add Routers, Switch, PCs to the Topology:
 Drag and drop two routers from the "Router" category in the device list onto the workspace.
 Drag and drop two switches from the "Switches" category onto the workspace. Connect one
switch to each router.
 Drag and drop two PCs from the "End Devices" category onto each switch. Connect each PC to
its respective switch.

2. Cable Connections:
 Use the "Copper Straight-Through" cable type to connect the routers to the switches and the
switches to the PCs. Click and drag from one device's port to another to create the
connections.

3. Configure IP Addresses on Routers:


 Click on a router to select it.
 Go to the "Config" tab in the router's properties panel.
 Under "FastEthernet0/0" (or similar), click the "Edit" button to configure the IP address.
Assign an IP address like 192.168.1.1 with a subnet mask of 255.255.255.0.
 Repeat the same process for the second router, giving it an IP address like 192.168.2.1 with
the same subnet mask.
4. Configure IP Addresses on PCs:
 Click on a PC to select it.
 Go to the "Config" tab in the PC's properties panel.
 Under "FastEthernet0" (or similar), click the "Edit" button to configure the IP address. Assign
an IP address in the same subnet as the router it's connected to. For example, for the PC1
connected to Router 1, use 192.168.1.2 with the same subnet mask (255.255.255.0) and PC2
connected to Router 1, use 192.168.1.3 with the same subnet mask (255.255.255.0).
 Repeat the same process for the other PCs, giving them IP addresses in their respective
subnets.
5. Configure Static Routes on Routers:
 Click on the first router to select it.
 Go to the "Config" tab in the router's properties panel.
 Under "Routing," click on "Static" to access the static routing configuration.
 Click the "Add" button to create a new static route.
 In the "Destination Network" field, enter the network address you want to reach through this
static route. For example, if you're configuring the first router, which is connected to the
192.168.1.0/24 subnet, and you want to reach the 192.168.2.0/24 subnet via Router 2, enter
"192.168.2.0."
 In the "Subnet Mask" field, enter the subnet mask for the destination network, which is
"255.255.255.0" for a Class C network.
 In the "Next Hop IP Address" field, enter the IP address of the PC connected to the other
router. For example, for Router 1, enter the IP address of the connected Router 2 (e.g.,
192.168.3.3).
 Click "OK" to add the static route.
 Repeat the same process for the second router:
 Click on the second router to select it.
 Go to the "Config" tab.
 Under "Routing," click on "Static."
 Click the "Add" button to create a new static route.
 Enter the destination network, subnet mask, and the IP address of the connected to router
(e.g., 192.168.2.0, 255.255.255.0, and 192.168.3.2 for Router 2)

Command line:
The command used for adding static configuration of router is:
1. Router>enable
2. Router#
3. Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
4. Router(config)#
5. Router(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.3

Configuration of router 0:

Figure 14 Configuration of router 0

Configuration of router 1:

Figure 15 Configuration of router 1

Configuration of router 2:

Figure 16 Configuration of router 2


Working:
1- From the above toolbar use “ADD SIMPLE PACKET”.
2- Select source of packet which will be PC4 of router 0.
3- Select destination of packet which will be PC2 of router1 of other network.
4- In the down right corner, we will see progress window which will show “successful” after we add
destination of packet.
5- After successful configuration click on simulation button.
6- It will simulate a packet going from PC4 of router0 to PC2 of router1.

Figure 17 Results of successful data transmission

result:
After simulating, we can see how PC4 of router0 of one network is communicating with PC2 of
router1 of another network. Soo our static configuration of routers is successful.

We can also see the progress of sending and receiving of packets between PC4 and PC0 by using “PING”
on command prompt of PC4.
LAB NO: 4 Dynamic configuration of routers
Objective:
To understand how dynamic configuration of routers work and sending data to
another network dynamically.
Equipment:
6-PCs, 3-switches (2950-24),3- routers (1841), serial cable
PROCEDURE:
1- Add Routers, Switch, PCs to the Topology:
 Drag and drop three routers from the "Router" category in the device list
onto the workspace.
 Drag and drop three switches from the "Switches" category onto the
workspace. Connect one switch to each router.
 Drag and drop six PCs from the "End Devices" category onto each switch.
Connect each PC to its respective switch.
2- Configuration of routers:
 Go to physical mode of router and turn them off. Then add WIC-2T module
in router and turn it back on. (Do this for all the routers).
 Assign ip address in FA0/0 of router 0, router 1 and router 2 as 192.168.1.1,
192.168.2.1 and 192.168.3.1 respectively.
 Now assign ip to serial 0/0 of routers as 10.0.0.1, 10.0.0.2, 11.0.0.1 and
11.0.0.2 respectively.
 Connect all routers together with serial cable in serial ports.
3- Configuration of switches:
 Attach one switch with each router.
 Connect 2 PCs with each switch.
4- Configuration of PCs:
 Connect two PCs each with a switch which are further connected with
routers.
 Enter the default gateway for PC 0 and 1 as 192.168.1.1, for PC 2 and 3 as
192.168.2.1 and for PC 3 and 4 as 192.168.3.1.

 Assign ip addresses to PCs as follow:


1- PC 0 = 192.168.1.2
2- PC 1 = 192.168.1.3
3- PC 2 = 192.168.2.2
4- PC 3 = 192.168.2.3
5- PC 4 = 192.168.3.2
6- PC 5 = 192.168.3.3
5- Dynamic configuration of routers:
 Select the router 0. In the RIP section of routing click on network.
 Add the following networks:
1- 192.168.1.0
2- 192.168.2.0
3- 192.168.3.0
4- 10.0.0.0
5- 11.0.0.0
 Every time you write a network click on “ADD” button to save the network
addresses.
 Repeat these same steps for dynamic configuration of Router 1 and Router 2.
Working:
 From the above toolbar use “ADD SIMPLE PACKET”.
 Select source of packet which will be PC0 of router 0.
 Select destination of packet which will be PC5 of router 2 of other network.
 In the down right corner, we will see progress window which will show
“successful” after we add destination of packet.
 After successful configuration click on simulation button.
 It will simulate a packet going from PC0 of router0 to PC5 of router2.
Diagram:

Figure 18 Dynamic configuration of routers

Result:
As we send packet of data from PC1 to PC5, it will be received by PC5 of other
network. So the two PCs of other network communicate with each other using
dynamic configuration of router.

Figure 19 successful transmission from PC0 to PC5


LAB NO: 5 Basic Switch Configuration
Objective:
This lab exercise is designed for understanding and using basic
configuration commands on a Cisco Switch interacting through Cisco IOS.
Equipment:
 Computer
 Packet Tracer (version 5 or higher)
Procedure:
Open Packet Tracer 5 and setup a network similar to the following network. Use
Cisco 2950T switch.
1- Enter privileged mode
Privileged mode gives access to all the switch commands. Many of the privileged
commands configure operating parameters. Therefore, privileged access should be
password-protected to prevent unauthorized use.
Switch>enable Switch# b.
Notice the prompt changed in the configuration to reflect privileged EXEC mode.

2- Examine the current switch configuration:


Examine the following current running configuration file:
Switch#show running-config
Figure 20 running config of router

3- Assign a name to the switch:


Enter enable and then the configuration mode Enter ALSwitch, the name this
switch will be referred to in the following: Switch(config)#hostname ALSwitch
ALSwitch(config)#exit

Figure 21 assigning name to switch

4- Examine the current running configuration:


Examine the current configuration that follows to verify that there is no
configuration except for the hostname
ALSwitch#show running-config
Figure 22 current running configuration

5- Set the access passwords:


Enter config-line mode for the console. Set the password on this line as cisco for
login. Configure the vty lines 0 to 15 with the password cisco as follows:
ALSwitch#configure terminal Enter the configuration commands, one for each
line. End by pressing Ctrl-Z.
ALSwitch(config)#line con 0
ALSwitch(config-line)#password cisco
ALSwitch(config-line)#login
ALSwitch(config-line)#line vty 0 15
ALSwitch(config-line)#password cisco
ALSwitch(config-line)#login
ALSwitch(config-line)#exit
Figure 23 set access password

6- Set the command mode passwords:


Set the enable password to cisco and the enable secret password to class as
follows:
ALSwitch(config)#enable password cisco
ALSwitch(config)#enable secret class

Figure 24 command mode passwords

7- Configure the layer 3 access to the switch:


Set the IP address of the switch to 192.168.1.2 with a subnet mask of
255.255.255.0 as follows:
ALSwitch(config)#interface VLAN 1
ALSwitch(configif)#ip address 192.168.1.2 255.255.255.0
ALSwitch(config-if)#exit
Set the default gateway for the switch and the default management VLAN
ALSwitch(config)#ip default-gateway 192.168.1.1
ALSwitch(config)#exit

8- Verify the management LANs settings:


ALSwitch#show interface VLAN 1
ALSwitch(config)#interface VLAN 1
ALSwitch(config-if)#no shutdown
ALSwitch(config-if)#exit

9- Save the configuration:


ALSwitch#copy running-config startup-config Destination filename
[startup-config]?[Enter] Building configuration... [OK]
ALSwitch#

Examine the startup configuration file:


To see the configuration that is stored in NVRAM, type show startup-config
from the privileged EXEC
(enable mode) ALSwitch#show startup-config

Diagram:

Figure 25 switch configration


LAB WORKSHEET
Q.1 What is Cisco IOS and what are its functions?
Ans: Cisco IOS (Internetwork Operating System) is a proprietary operating system used by
Cisco Systems in their networking hardware, including routers, switches, and other
networking devices. Some of its key functions and features include:
1- Routing
2- Switching
3- Security
4- Device management
5- Quality of service

Q.2 Identify the differences between line and interface of a Cisco device.
Ans: In the context of a Cisco networking device, such as a router or switch, "line" and
"interface" are distinct concepts that serve different purposes.
Line:
1- Logical Connection:
A line represents a logical connection to the device, typically for the purpose of
remote management and access.
2- Examples:
Common types of lines in a Cisco device include console lines, auxiliary lines, and
virtual terminal (VTY) lines.
3- Auxiliary Line:
The auxiliary line, often referred to as "AUX," provides an additional way to access
and manage the device, often used for out-of-band management.
4- Access Control:
Access to these lines can be controlled through various methods, including password
protection, privilege levels, and access lists.

Interface:
1- Physical Connection:
An interface represents a physical or virtual network connection on the device,
connecting it to the data plane, where data traffic flows.
2- Ethernet Interface:
These represent physical Ethernet ports on the device and are used to connect to
Ethernet-based networks.
3- Loopback Interface:
A loopback interface is a virtual interface used for internal device testing and
management. It doesn't connect to external networks.
4- Interface Configuration: Configuration of interfaces includes IP addressing,
routing protocols, access control lists, and other parameters related to the
forwarding of network traffic.
Q.3 If switch doesn’t know the destination address, what will it do? If it does then
what action is taken?
Ans: When a switch receives an Ethernet frame and needs to determine what to do with it based
on the destination MAC (Media Access Control) address, In this case, the switch will flood the
frame out to all the ports in the same VLAN (except the port on which it was received). This is
known as broadcast or flooding behavior. Flooding ensures that the frame reaches its intended
destination if the destination device is connected to the same network segment.

Q.4 What are the differences between running-config and startup-config?


Ans: In Cisco devices and many other networking equipment, there are two important
configuration files: "running-config" and "startup-config." The key differences are:

Running configuration:
1- Current State:
The running configuration represents the current operational state of the device. It
contains the configuration settings that are actively in use by the device at any given
time.
2- Temporary:
Any changes made to the device's configuration using commands or through a
configuration interface are reflected in the running configuration immediately.
3- Temporary Testing:
Network administrators often use the running configuration for temporary testing or
troubleshooting because changes made here do not survive a reboot.
4- Volatile:
The running configuration is stored in volatile memory (RAM), which means that it
is lost when the device is rebooted or powered off. It is only retained while the device
is powered on.

Startup configuration:
1- Saved Configuration:
The startup configuration represents the saved configuration of the device. It
contains the configuration settings that are saved to non-volatile storage (typically
NVRAM) and persist across reboots and power cycles.
2- Non-Volatile:
The startup configuration is stored in non-volatile memory, ensuring that it
remains intact even if the device loses power or is rebooted.
3- Preserves Desired Settings:
Network administrators save critical configurations to the startup configuration to
ensure that they are retained even after a reboot.

You might also like