0% found this document useful (0 votes)
62 views

CN Lab Manual

The document is a lab manual for the Computer Networks course at Parul University, detailing practical experiments for 4th semester students. It includes a certification section, a list of practicals, and specific experiments using tools like Cisco Packet Tracer and Wireshark to understand networking concepts. Key topics covered include network design, error correction using Hamming code, and the differences between network devices such as hubs and switches.

Uploaded by

meet
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views

CN Lab Manual

The document is a lab manual for the Computer Networks course at Parul University, detailing practical experiments for 4th semester students. It includes a certification section, a list of practicals, and specific experiments using tools like Cisco Packet Tracer and Wireshark to understand networking concepts. Key topics covered include network design, error correction using Hamming code, and the differences between network devices such as hubs and switches.

Uploaded by

meet
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

FACULTY OF ENGINEERING AND TECHNOLOGY

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

This is to certify that with


enrollment no. has successfully completed
his/her laboratory experiments in the
COMPUTER NETWORKS (203105256) from the
department of COMPUTER SCIENCE AND ENGINEERING during the
academic year 2024-25.

Date of Submission:......................... Staff In charge:...........................

Head Of Department:...........................................

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

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.

Experiments of Packet capture


tool: Wireshark
To understand the features of
wireshark as a packet capture tool
2
and understand encapsulation of
information. Also study effect of
few network commands

To study behaviour of generic


devices used for networking:
(CISCO PACKET TRACER)
Design a simple network with
multiple nodes and connect via
generic devices available in
library. Perform simulation and
trace communication behaviour of
specified network devices. 1: Use
3
only HUB to design a small
network having 4 to 6 hosts 2: Use
only a Switch to design a small
network with 4 to 6 hosts. 3: Use
both the device (HUB and
SWITCH) for a network and find
out functioning difference
between switch and hub.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)
Data Link Layer (Error
Correction): Write a program to
implement error detection and
4 correction using HAMMING code
concept. Make a test rum to input
data stream and verify error
correction feature.
Virtual LAN: Simulate Virtual
5 LAN configuration using CISCO
Packet Tracer Simulation.
Wireless LAN: Configuration of
6 Wireless LAN using CISCO
Packet Tracer

Internetworking 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:
7
Experiment on same subnet 2:
Perform Experiment across the
subnet and observe functioning of
Router via selecting suitable pair
of Source and destination.

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.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

PRATICAL 1

• Experiments on Simulation Tools: (CISCO PACKET TRACER): To understand


environment of CISCO PACKET TRACER to design simple network and perform
experiments.

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

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

The devices section of the CPT includes Networks devices, End devices, Components,
Connections, Miscellaneous and Multi-User Connections.

Network devices consists of


1. Switches
2. Routers
3. Hubs
4. Wireless Devices
5. Security
6. WAN Emulation.

End devices consists of,


1. Laptops
2. PC’s
3. Power grid
4. Industrial; etc

Connections consists of,


1. Console wire
2. Copper Straight-Through
3. Copper Cross-over
4. Fiber
5. Phone Wire
6. Co-axial
7. Serial DCE
8. Serial DTE
9. IoT Cable

Miscellaneous consists of, recently used devices or connections.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

• Designing a Simple Network in Cisco Packet Tracer.

Using a Hub and 3 Personal Computers we are designing a simple network.

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.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

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.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

PRACTICAL 2

Experiments of Packet capture tool:


AIM :To understand the features of wireshark as a packet capture tool and understand
encapsulation
of information. Also study effect of few network commands

Purpose:

▪ Wireshark is an open-source packet analyser, which is used for education, analysis,


software development, communication protocol development and network
troubleshooting.
▪ The main objective of proposed experiment is to give exposure of wire-shark tool to
students so
they can learn to monitor transmission packets being send in Wi-Fi and LAN
environments.

Setting Up Wireshark

Exercises

2.1 Monitor TCP packets in a LAN connection and record your observations

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

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

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

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.

1. Use only HUB to design a small network having 4 to 6 hosts

➢ Hub-PT is selected for this network

Packet datagrams can also be transferred successful from all the hosts to all the hosts.

2. Use only a Switch to design a small network with 4 to 6 hosts.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

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

• A hub is a networking device that connects multiple PCs to a single network,


2403031057044 (Meet Madhani)
PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)
whereas a Switch connects multiple devices on a single computer network.
• A hub operates on the OSI physical layer, whereas a switch operates on the OSI data
link layer.
• The hub uses a half-duplex cable, whereas the switch uses a full-duplex cable.
• The switch is an active device, whereas the hub is a passive device.
• The switch employs the Spanning Tree Protocol to avoid switching loops. On the
other hand, the hub cannot avoid switching loops.
• The hub shares the bandwidth between the ports. A switch, on the other hand, provides
dedicated bandwidth to the ports.
• The number of ports connecting to the device is significantly greater in switches
than in the hub.
• The hub’s data transmission speed is quite slow compared to a switch.

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

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

PRACTICAL 4

• Data Link Layer (Error Correction): Write a program to implement error


detection and correction using HAMMING code concept. Make a test rum to
input data stream and verify
error correction feature.

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:

1. Enter the Data to be transmitted


2. Calculate the no of redundant bits required
3. Determine the parity bits
4. Create error data for testing
5. Check for errors

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

Decoding a message in Hamming Code

Once the receiver gets an incoming message, it performs recalculations to detect errors and
correct them.
The steps for recalculation are −

Step 1 − Calculation of the number of redundant bits


Using the same formula as in encoding, the number of redundant bits are ascertained.
2r ≥ m + r + 1 where m is the number of data bits and r is the number of redundant bits.

Step 2 − Positioning the redundant bits


The r redundant bits placed at bit positions of powers of 2, i.e. 1, 2, 4, 8, 16 etc. Step 3 − Parity
checking

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.

Hamming Code in Python.

def calcRedundantBits(m):

for i in range(m):
if(2**i >= m + i + 1):
return i

def posRedundantBits(data, r):


j=0
k=1
m = len(data)
res = ''
for i in range(1, m + r+1):
if(i == 2**j):
res = res + '0'
2403031057044 (Meet Madhani)
PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)
j += 1
else:
res = res + data[-1 * k]
k += 1
return res[::-1]

def calcParityBits(arr, r):


n = len(arr)
for i in range(r):
val = 0
for j in range(1, n + 1):

if(j & (2**i) == (2**i)):


val = val ^ int(arr[-1 * j])
arr = arr[:n-(2**i)] + str(val) + arr[n-(2**i)+1:]
return arr

def detectError(arr, nr):


n = len(arr)
res = 0
for i in range(nr):
val = 0
for j in range(1, n + 1):
if(j & (2**i) == (2**i)):
val = val ^ int(arr[-1 * j])
res = res + val*(10**i)
return int(str(res), 2)
data = '1011001'
m = len(data)
r = calcRedundantBits(m)

arr = posRedundantBits(data, r)
arr = calcParityBits(arr, r)
print("Data transferred is " + arr)

arr = '11101001110'
print("Error Data is " + arr)
correction = detectError(arr, r)

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)
if(correction==0):
print("There is no error in the received message.")
else:
print("The position of error is ",len(arr)-correction+1,"from the left")

OUTPUT:

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

PRACTICAL 5

• Virtual LAN: Simulate Virtual LAN(VLAN) configuration using CISCO Packet


Tracer Simulation.

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

VLAN Configuration on Switch 1


After PC IP configurations, now, we can start our VLAN Packet Tracer Configuration steps.
Here, we will follow the below steps:

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.

Switch 1(config)# interface fastEthernet 0/2


Switch 1(config-if)# switchport mode access
Switch 1(config-if)# switchport access vlan 2
Switch 1(config)# interface fastEthernet 0/3
Switch 1(config-if)# switchport mode access
Switch 1(config-if)# switchport access vlan 2
Switch 1(config)# interface fastEthernet 0/4
Switch 1(config-if)# switchport mode access
Switch 1(config-if)# switchport access vlan 3
Switch 1(config)# interface fastEthernet 0/1
Switch 1(config-if)# switchport mode trunk
Switch 1(config-if)# switchport nonegotiate
Switch 1(config-if)# switchport trunk allowed vlan 2-4
Switch 1# copy running-config startup-config

The excepted outcome should be like the below picture; the command is do show history after
exiting from config t and then config.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

VLAN Configuration on Switch 2


After configuring the first switch, we will configure switch 2 similar to switch 1 as below.

Switch 2(config)# interface fastEthernet 0/2


Switch 2(config-if)# switchport mode access
Switch 2(config-if)# switchport access vlan 3
Switch 2(config)# interface fastEthernet 0/3
Switch 2(config-if)# switchport mode access
Switch 2(config-if)# switchport access vlan 2
Switch 2(config)# interface fastEthernet 0/4
Switch 2(config-if)# switchport mode access
Switch 2(config-if)# switchport access vlan 2
Switch 2(config)# interface fastEthernet 0/1
Switch 2(config-if)# switchport mode trunk
Switch 2(config-if)# switchport nonegotiate
Switch 2(config-if)# switchport trunk allowed vlan 2-4
Switch 2# copy running-config startup-config

The excepted outcome should be like the below picture; the command is do show history after
exiting from config t and then config.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

Checking VLAN Configuration


Our last step of VLAN configuration is verification. to verify our VLAN Packet Tracer
Configuration, we will use verification commands like “show vlan brief“, “show interfaces“,
“show interfaces trunk” etc.

The expected outcome after sending packet datagram units, from PC1(vlan1) TO PC5(vlan2)
and PC1 TO PC2 is successful.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

PRACTICAL 6

AIM :- Configuration of wireless LAN(WLAN) using CISCO Packet Tracer.

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.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

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.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

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.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

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.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

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:

Take 3 PCs, a switch and a router.

The IP Addresses and the Subnets for the computers are as follows,

First we have to give the same subnet for all three.

PC0 is 192.168.10.1 with subnet 255.255.255.0

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

PC1 is 192.168.10.2 with subnet 255.255.255.0

PC2 is 192.168.10.3 with subnet 255.255.255.0

Now the subnets are same across all three computer.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

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.

2. Performing experiments across subnets by using various subnet masks.

PC0 has the same address 192.168.10.1 but with the subnet 255.255.255.0

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

PC1 has IP address 192.168.10.2 but with subnet 255.255.0.0

PC2 has IP Address 192.168.10.3 but with subnet 255.0.0.0

By transferring PDU(packet datagram units), all the transmission are successful.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

Therefore,
There is no difference in the functioning of router between having same subnet and different
subnet.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

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.

The subnet connection of networks

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.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)
Click on the router0 then CLI(command line interpreter).

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

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.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)
Now assign the IP Addresses to the PCs accordingly,

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.

In a similar way allocate the IP Addresses to the computers under Switch-1(2)


PC2- 20.0.0.1
PC3-20.0.0.2
Default gateway is 20.0.0.3
Go to the router setting and update the address of Gig0/0/1 20.0.0.3
Turn on the router.

The PDU is transmitting successfully.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

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.

Go to the CLI of the router and execute the following commands,

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

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

PDU is transmitted successfully.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

PRACTICAL-10

Implementation of echo client server using TCP/UDP sockets.

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

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

SOURCE CODE:

SERVER:

import socket
localIP = "127.0.0.1"
localPort = 20001
bufferSize = 1024
msgFromServer = "Hello UDP Client"
bytesToSend = str.encode(msgFromServer)

# Create a datagram socket


UDPServerSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)

# Bind to address and ip


UDPServerSocket.bind((localIP, localPort))

print("UDP server up and listening,L")


# Listen for incoming datagrams
while(True):
bytesAddressPair = UDPServerSocket.recvfrom(bufferSize)
message = bytesAddressPair[0]
address = bytesAddressPair[1]
clientMsg = "Message from Client:{}".format(message)
clientIP = "Client IP Address:{}".format(address)
print(clientMsg)
print(clientIP)

# Sending a reply to client

UDPServerSocket.sendto(bytesToSend, address)

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

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)

msg = "Message from Server {}".format(msgFromServer[0])


print(msg)

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

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)
CLIENT:

Execution of Python TCP Server and Client modules


You can run both the server and client in separate Python instances. It is recommend that you use Python
version 3 for executing the above modules.
Next, you would first run the server module followed by the client. See below the output of both the client
and the server.

2403031057044 (Meet Madhani)


PARUL UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
COMPUTER NETWORKS (203105255) (4th SEM)

OUTPUT:

SERVER:

CLIENT:

2403031057044 (Meet Madhani)

You might also like