CN Lab Manual
CN Lab Manual
BACHELOR OF TECHNOLOGY
COMPUTER
NETWORKS
(203105214)
4th SEMESTER
COMPUTER SCIENCE & ENGINEERING DEPARTMENT
Lab
Manual
PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)
CERTIFICATE
Head Of Department:...........................................
LIST OF PRACTICALS
Page No
Sr. Date of Date of Marks (out
No Experiment Title Start Completion Sign of 10)
To From
Experiments on Simulation Tools:
(CISCO PACKET TRACER):
To understand environment of
1 CISCO PACKET TRACER to
design simple network and perform
experiments.
Implementation of
SUBNETTING: Design multiple
subnet with suitable number of
8 hosts. Make a plan to assign static
IP addressing across all subnet to
explain implementation of
SUBNETTING.
Routing at Network Layer:
Simulate Static and Dynamic
9 Routing.Protocol
Configuration using CISCO
Packet Tracer.
Experiment on Transport Layer:
Implement echo client server
10
using TCP/UDP sockets.
PRATICAL 1
The main purpose of Cisco Packet Tracer is to help students learn the principles of
networking with hands-on experience as well as develop Cisco technology specific skills.
Since the protocols are implemented in software only method, this tool cannot replace the
hardware Routers or Switches. Interestingly, this tool does not only include Cisco products
but also many more networking devices.
Workspace :
1. Logical –
Logical workspace shows the logical network topology of the network the user has
built. It represents the placing, connecting and clustering virtual network devices.
2. Physical –
Physical workspace shows the graphical physical dimension of the logical network. It
depicts the scale and placement in how network devices such as routers, switches and
hosts would look in a real environment. It also provides geographical representation of
networks, including multiple buildings, cities and wiring closets.
Key Features:
• Unlimited devices
• E-learning
• Customize single/multi user activities
• Interactive Environment
• Visualizing Networks
• Real-time mode and Simulation mode
• Self-paced
• Supports majority of networking protocols
• International language support
• Cross platform compatibility
The devices section of the CPT includes Networks devices, End devices, Components,
Connections, Miscellaneous and Multi-User Connections.
Hub-PT is selected from network devices and placed on the logical Workspace. Three
Computers from End-devices, IP Addresses are allocated to all the three computers as shown
in the figure. 10.0.0.1-10.0.0.3 from class A IP Range is used.
To know whether the network is running send a Packet from one computer to another.
Packet is a small amount of data that is been sent over a network. In cisco packet tracer a
packet is located
on the top ribbon bar.
Add simple PDU is the Packet Datagram Unit, select it and click on computer(PC0) that is
sending and
another computer(PC2) which is receiving.
After sending the PDU from all the sources of computers they are able to communicate with
each other.
All the Computers are interconnected in a network.
The status of the Packet Transmission can be viewed in the real-time(Shift+R) and also in
Simulation Mode(shift+S).
Here all the computers are communicating with each other.
PRACTICAL 2
Purpose:
Setting Up Wireshark
Exercises
2.1 Monitor TCP packets in a LAN connection and record your observations
No TCP Packets are travelled as the device is not connected to a Local Area Network.
2.2 Monitor TCP packets in a Wi-Fi connection and record your observations
2.4 Monitor UDP packets in a Wi-Fi connection and record your observations
PRACTICAL 3
Design a simple network with multiple nodes and connect via generic devices available in
library. Perform simulation and trace communication behavior of specified network devices.
Packet datagrams can also be transferred successful from all the hosts to all the hosts.
• For this network, 2960-24TT, PT-Empty, 2950T-24 are Compatible with a larger
number of connections, whereas switches like switch-PT switch are not capable
containing a large number of hosts.
• All the packet datagrams are transferring successfully.
Now 3: Use both the device (HUB and SWITCH) for a network and find
out functioning difference between switch and hub.
➢ The packet which is transmitted from PC4 to PC5 using HUB is still
in progress.
➢ The packet which is transmitted from PC0 to PC2 using SWTICH
is successful
Therefore, the main difference between the HUB and SWITCH is the speed of transmission
of data.
PRACTICAL 4
Hamming code is a set of error-correction codes that can be used to detect and correct the
errors that can
occur when the data is moved or stored from the sender to the receiver. It is a technique
developed by
R.W. Hamming for error correction.
Steps:
If the message contains m𝑚number of data bits, r𝑟number of redundant bits are added to it so
that m𝑟 is
able to indicate at least (m + r+ 1) different states. Here, (m + r) indicates location of an error
in
each of (𝑚 + 𝑟) bit positions and one additional state indicates no error. Since, r𝑟 bits can
indicate 2r𝑟
states, 2r𝑟 must be at least equal to (m + r + 1). Thus the following equation should hold
2r ≥ m+r+1 Step 2 − Positioning the redundant bits.
The redundant bits are parity bits. A parity bit is an extra bit that makes the number of 1s either
even or odd. The two types of parity are −
Even Parity − Here the total number of bits in the message is made even.
Odd Parity − Here the total number of bits in the message is made odd.
Each redundant bit, ri, is calculated as the parity, generally even parity, based upon its bit
position. It covers
2403031057044 (Meet Madhani)
PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)
all bit positions whose binary representation includes a 1 in the ith position except the position
of ri
Once the receiver gets an incoming message, it performs recalculations to detect errors and
correct them.
The steps for recalculation are −
The decimal equivalent of the parity bits binary values is calculated. If it is 0, there is no error.
Otherwise,
the decimal value gives the bit position which has error. For example, if c1c2c3c4 = 1001, it
implies that
the data bit at position 9, decimal equivalent of 1001, has error.
The bit is flipped to get the correct message.
def calcRedundantBits(m):
for i in range(m):
if(2**i >= m + i + 1):
return i
arr = posRedundantBits(data, r)
arr = calcParityBits(arr, r)
print("Data transferred is " + arr)
arr = '11101001110'
print("Error Data is " + arr)
correction = detectError(arr, r)
OUTPUT:
PRACTICAL 5
Procedure:
Step 1: Take 2 Switches and 6 PC
Step 2: Connect the pc’s to Switch and Switch to Router with copper straight-through wire.
Step 3: Assign ip’s to pc’s accordingly pc0(192.168.1.2), pc1(192.168.1.3) and
pc2(192.168.1.4)
Step 4 : Assign ip’s in pc3(192.168.1.6), pc4(192.168.1.7) and pc5(192.168.1.8)
Now divide the network into two virtual Local Area Networks, VLAN1 & VLAN2
VLAN1 PCs: PC1,PC2,PC3
VLAN2 P S: PC0,PC4,PC5
1. We will set access ports that will access specific VLANs. We will do this with
“switchport mode access” command under these interfaces.
2. We will also set the VLAN, that this port will access.
3. After that, we will set the trunk port that will carry multiple VLANs with “switchport
mode trunk” command.
4. Then we will also set this port with “no negotiate” command to prevent negotiation
about the port
role.
2403031057044 (Meet Madhani)
PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)
5. Lastly, we will set the allowed VLANs with “switchport trunk allowed vlan”
command on this
trunk and save our configuration.
The excepted outcome should be like the below picture; the command is do show history after
exiting from config t and then config.
The excepted outcome should be like the below picture; the command is do show history after
exiting from config t and then config.
The expected outcome after sending packet datagram units, from PC1(vlan1) TO PC5(vlan2)
and PC1 TO PC2 is successful.
PRACTICAL 6
Procedure:
Take a wireless router named WRT300N from /Network devices/Wireless devices.
Now, Connect the wireless router0 with End devices such as computers and laptops. Here
Unlike every
Other Wired connection do not make wired connections. Instead follow the below steps,
Double-click on the router and go to the graphical user interface section. Where we can
allocate Any classes’/classless IP Addresses.
In GUI, in the wireless section we can configure the SSID, Network mode and Radio Band.
For implementing security on wireless network go to the config section in the router,
where we can implement
Many types of Password methodologies. WPA-PSK,WEP etc.
Now that the router is configured we have to configure our end devices(computers and laptops)
Click on the PC and go to the physical section then turn off the power. Remove the PT-HOST
Module
From the bottom and insert WMP300N module at the bottom of the CPU. As shown in the
figure.
After this step the PC can be able to connect to wireless internet connections. For that go into
desktop section
In the PC then select PC WIRELESS.
Connect to the wireless network, enter the password. Now it is connected to the wireless
network.
Proceed with the same step again with another Computer.
Remove the PT-HOST Module and insert WMP300N wireless module to support wireless
connections.
Then, go to Desktop/PC-Wireless/ and connect with the same network.
Now that our computers are configured to connect the wireless network. Configure the laptop
the same way.
First, turn off the power of laptop and then remove PT-LAPTOP module, drag it on the main
menu of modules, Select WPC300N insert it on to the laptop.
For connecting it to the network follow the same steps as a computer.
/desktop/PC-Wireless. Find the network names LIGHT then click connect, enter WEP
Password. Now it’s connected.
Now all our End-devices are connected to the WRT300N wireless router. To verify the
connection.
A PDU(Packet Datagram Unit) has been sent from,
Laptop0 – PC4
PC3 – Laptop0
PC4 – PC3
All the three packet transmissions are successful. We can say we correctly configured the
WLAN network.
PRACTICAL 7
AIM :- Interworking with routers: Design a three or four simple networks (with 3 to 4
hosts) and connect via Router. Perform simulation and trace how routing is done in
packet transmission.
1. Experiment on same subset
2. Perform experiment across the subnet and observe functioning of Router via
selecting suitable pair of source and destination.
Step 1: Setup the router and hosts in CISCO Packet Tracer and assign the IP address to all the
hosts respectively.
● We will give IP address to the hosts and we will only change the subnet ID of all the IP
address because we want all the hosts to remain in the same network.
Subnet Mask of all the end devices are given as follow:
The IP Addresses and the Subnets for the computers are as follows,
Perform simulation and trace how routing is done by sending a PDU(packet datagram Unit)
from PC0-PC2, PC1-PC0, PC2-PC0 vice-versa.
The transmission of all the Packets from all the sources are successfully transmitted to all the
destinations.
PC0 has the same address 192.168.10.1 but with the subnet 255.255.255.0
Therefore,
There is no difference in the functioning of router between having same subnet and different
subnet.
PRACTICAL 8
AIM :- Design multiple subnet with suitable number of hosts. Make a plan to
assign static IP addressing across all subnet to explain implementation of
subnetting.
THEORY:
☐ Subnetting is the practice of dividing up a network into two or more networks. Common
advantages
of subnetting include enhancing routing efficiency, network management control, and
improving network security. While these are just a few of the benefits that subnetting
provides, they are
the most noticeable after immediately implementing a subnet system.
☐ This results in the logical division of an IP address into two fields: the network number
or routing prefix and the rest field or host identifier. Addresses help to identify the
pieces of hardware
connected to your network. To locate a particular device you would need to organize
the IP
addresses in a logical way. This is where subnetting excels as a tool to help you maintain
efficiency across your network.
Configuring routers in two ways as shown above for the individual networks.
As we connected all the devices in the terminal now, Configure the router.
PRACTICAL-9
Routing at Network Layer:
Simulate Static and Dynamic Routing Protocol Configuration using CISCO Packet
Tracer.
Static routing is a form of routing that occurs when a router uses a manually-configured
routing entry, rather than information from dynamic routing traffic. In many cases, static
routes are manually configured by a network administrator by adding in entries into a routing
table, though this may not always be the case. Unlike dynamic routing, static routes are fixed
and do not change if the network is changed or reconfigured.
Step to implement statis routing, In this example we are using a router, two switches and four
PCs.
Step 1: Take a router, two switch and four pc and connect them with the suitable wire.
Step 2: then we will click on pc0 and pc1 then go to desktop then go to ip configuration and
give pc0 and pc1 IP address and default gateway.
Step 3: Now we will assign IP Address and subnet mask by clicking on the router and
configuring it, going to config in Gig0/0/0, clicking on the Port status and then go to the same
setting and save.
PC0- 10.0.0.1
PC1-10.0.0.2
The default gateway Address is 10.0.0.3
The address of Gig0/0/0 (Gigabit Ethernet 0/0) will be 10.0.0.3
*After updating the IP in router do not forget to turn on the router.
Dynamic routing, also called adaptive routing, is a process where a router can forward data
via a different route for a given destination based on the current conditions of the
communication circuits within a system. The term is most commonly associated with data
networking to describe the capability of a network to 'route around' damage, such as loss of a
node or a connection between nodes, so long as other path choices are available. Dynamic
routing allows as many routes as possible to remain valid in response to the change.
*Note, int Gig0/0/0/ or Gig0/0/1 might change depending on the type of router used.
Use Router 4331 for ease.
The usage of IP Addresses in the DHCP Pool can be left the same or can be changed.
In this case, it is changed to check the commands are working, if they are executed the
IP Address in the PCs will also change.
PRACTICAL-10
AIM:
To write a program for UDP echo client server.
ALGORITHM:
SERVER:
STEP 1: Start
STEP 2: Declare the variables for the socket
STEP 3: Specify the family, protocol, IP address and port number
STEP 4: Create a socket using socket() function
STEP 5: Bind the IP address and Port number
STEP 6: Listen and accept the client’s request for the connection
STEP 7: Read and Display the client’s message
STEP 8: Stop
CLIENT:
STEP 1: Start
STEP 2: Declare the variables for the socket
STEP 3: Specify the family, protocol, IP address and port number
STEP 4: Create a socket using socket() function
STEP 5: Call the connect() function
STEP 6: Read the input message
STEP 7: Send the input message to the server
STEP 8: Display the server’s echo
STEP 9: Close the socket
STEP 10: Stop
SOURCE CODE:
SERVER:
import socket
localIP = "127.0.0.1"
localPort = 20001
bufferSize = 1024
msgFromServer = "Hello UDP Client"
bytesToSend = str.encode(msgFromServer)
UDPServerSocket.sendto(bytesToSend, address)
CLIENT:
import socket
msgFromClient = "Hello UDP Server"
bytesToSend = str.encode(msgFromClient)
serverAddressPort = ("127.0.0.1", 20001)
bufferSize = 1024
# Create a UDP socket at client side
UDPClientSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
# Send to server using created UDP socket
UDPClientSocket.sendto(bytesToSend, serverAddressPort)
msgFromServer = UDPClientSocket.recvfrom(bufferSize)
OUTPUT:
SERVER:
CLIENT:
RESULT:
Thus the program for UDP echo client server was executed and the output was verified.
2403031057044 (Meet Madhani)
PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)
AIM:
To write a program for TCP echo client server.
SOURCE CODE:
SERVER
OUTPUT:
SERVER:
CLIENT: