0% found this document useful (0 votes)
143 views67 pages

Computer Networks Lab Manual 2025-26

Uploaded by

vaxak78844
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)
143 views67 pages

Computer Networks Lab Manual 2025-26

Uploaded by

vaxak78844
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

G H Raisoni College of Engineering & Management,

Wagholi, Pune – 412 207


(An Empowered Autonomous Institute Affiliated to Savitribai Phule Pune University)

Department of Computer Engineering

D-19

6ab Manual (2025-25)

Class: TY Computer
Term: V
Computer Networks Lab
(23UCOPCL3509)

Faculty Name: Prof. Siddhasen Patil (Div-A)


Prof. Amol Rindhe (Div-B)
Prof. Suvarna Satkar (Div-C)
G H Raisoni College of Engineering & Management,
Wagholi, Pune – 412 207

Department: Computer Engineering


Course Details
Course : Computer Networks Lab
(23UCOPCL3509)

Class: TY BTECH Division: A,B &C


Internal Marks: External marks:-25
Credits: 1 Pattern: 2023
G H Raisoni College of Engineering and Management, Wagholi, Pune
(NAAC Accredited with A+ Grade)
New Gat. No. 1200, Domkhel Road, Wagholi, Pune – 412 207
Email:- [Link]@[Link] Web:- [Link]

Department of Computer Engineering


(NBA Accredited)

23UCOPCL3509: Computer Networks Lab


(Session 2025-26 Term-I)
Name of Subject: Computer Networks Lab Semester: V
COURSE OUTCOME
CO1 Describe fundamental concepts of Computer Networks & role of network Models.
CO2 Apply application and transport layer protocols to implement networking services.
CO3 Discuss skills in configuring network devices and implementing different routing protocols.
CO4 Apply the functionality of VLANs and their role in designing the logically segmenting LANs.
List of Experiment
Sr. Mapping
Experiment List Mapping With PO & PSO
No. With CO
Design and simulate Packet Tracer, Create LAN and WAN topologies & configure CO1
1 PO1,PO2,PO3,PO10
basic device settings (IP addressing, device naming).
2 Create and compare different topologies (Bus, Ring, Star, Mesh) using Packet Tracer. CO1 PO1,PO2,PO3,PO10
3 Setup and use an FTP server (FileZilla or similar). CO1 PO1,PO2,PO3,PO10
Send/receive email via SMTP and POP3 by using telnet or a mail client. CO2 PO1,PO2,PO3,PO4,PO5,PO9, PO10,
4
PO11,PSO1
Write a client-server program in Java or Python using TCP sockets. CO2 PO1,PO2,PO3,PO4,PO5,PO9, PO10,
5
PO11,PSO1
Implement a TCP-IP client-server application. The server accepts a string as a request CO2 PO1,PO2,PO3,PO4,PO5,PO9, PO10,
6
and sends the capitalized version back. PO11,PSO1
Use Packet Tracer to simulate and analyze socket programming & packet flow CO3 PO1,PO2,PO3,PO4,PO5,PO9, PO10,
7
differences between sockets. PO11,PSO1
G H Raisoni College of Engineering and Management, Wagholi, Pune
(NAAC Accredited with A+ Grade)
New Gat. No. 1200, Domkhel Road, Wagholi, Pune – 412 207
Email:- [Link]@[Link] Web:- [Link]

Department of Computer Engineering


(NBA Accredited)

Design and implement subnetting schemes for a given IP address. CO3 PO1,PO2,PO3,PO4,PO5,PO9, PO10,
8
PO11,PSO1
Configure routing tables and enable routing using Packet Tracer or GNS3. CO3 PO1,PO2,PO3,PO4,PO5,PO9, PO10,
9
PO11,PSO1
10 Configure IPv6 addressing on virtual/physical machines. CO4 PO1,PO2,PO3,PO10,PO11,PO12,PSO1,PSO2
11 Configure a basic wireless network using 802.11 standards in Packet Tracer. CO4 PO1,PO2,PO3,PO10,PO11,PO12,PSO1,PSO2
Virtual Lab Experiments
To implement OSPF protocol using 5 routers scenario. CO4
12 PO1,PO2,PO3,PO10,PO11,PO12,PSO1,PSO2
[Link]
Configure Multiple VLANs in Layer 2 Devices (Managed Switch(es)) CO4
13 PO1,PO2,PO3,PO10,PO11,PO12,PSO1,PSO2
[Link]
Experiment No: 01

Experiment Title:

Design and Simulate in Cisco Packet Tracer: Create LAN and WAN Topologies &
Configure Basic Device Settings (IP Addressing, Device Naming)

Objective:

To design and simulate Local Area Network (LAN) and Wide Area Network (WAN)
topologies using Cisco Packet Tracer. Also, to configure IP addressing and basic device
settings like device naming.

Tools Required:
 Cisco Packet Tracer (version 7.2 or later)
 A system with Windows/Linux/Mac

Experiment Steps
PART A: Create LAN TopologyGoal: Connect multiple PCs via switches and
configure IPs and names

Step 1: Open Cisco Packet Tracer

 Launch Cisco Packet Tracer.


 Open a new blank workspace.

Step 2: Add Devices

Drag and drop the following from the bottom Device-Type box:
 2 Switches → Switches → 2960
 6 PCs → End Devices → PC
 1 Router → Routers → 1841 (optional, if inter-LAN or gateway simulation is
needed)

Step 3: Connect Devices using Copper Cables

Use “Copper Straight-Through Cable” to connect:


 PC0 → Switch0 (FastEthernet 0)
 PC1 → Switch0 (FastEthernet 1)
 PC2 → Switch0 (FastEthernet 2)
 PC3 → Switch1 (FastEthernet 0)
 PC4 → Switch1 (FastEthernet 1)
 PC5 → Switch1 (FastEthernet 2)
 Connect Switch0 to Switch1 using FastEthernet port (any unused)

Step 4: Assign IP Addresses to PCs


Click on each PC → Desktop → IP Configuration:
Device IP Address Subnet Mask
PC0 [Link] [Link]
PC1 [Link] [Link]
PC2 [Link] [Link]
PC3 [Link] [Link]
PC4 [Link] [Link]
PC5 [Link] [Link]
PART B: Create WAN Topology
Goal: Connect 2 LANs using Routers

Step 1: Add Devices

 2 Routers → Router0, Router1 (e.g., 1841)


 2 Switches
 4 PCs (2 for each LAN)

Step 2: Connect Each LAN

LAN A:
PC0 & PC1 → Switch0 → Router0 (via FastEthernet 0/0)
LAN B:
PC2 & PC3 → Switch1 → Router1 (via FastEthernet 0/0)

Use Serial connection between Router0 and Router1:

 Serial 0/0/0 ↔ Serial 0/0/0

Step 3: Assign IP Addresses

Device Interface IP Address Subnet Mask


PC0 NIC [Link] [Link]
PC1 NIC [Link] [Link]
Router0 FastEthernet 0/0 [Link] [Link]
Router0 Serial 0/0/0 [Link] [Link]
Router1 Serial 0/0/0 [Link] [Link]
Router1 FastEthernet 0/0 [Link] [Link]
PC2 NIC [Link] [Link]
PC3 NIC [Link] [Link]
Step 4: Configure Router Interfaces

Click on Router → CLI or Config tab:

Router0:

arduino
Router> enable
Router# configure terminal
Router(config)# interface fa0/0
Router(config-if)# ip address [Link] [Link]
Router(config-if)# no shutdown
Router(config-if)# exit
Router(config)# interface s0/0/0
Router(config-if)# ip address [Link] [Link]
Router(config-if)# clock rate 64000
Router(config-if)# no shutdown

Router1:

arduino
Router> enable
Router# configure terminal
Router(config)# interface fa0/0
Router(config-if)# ip address [Link] [Link]
Router(config-if)# no shutdown
Router(config-if)# exit
Router(config)# interface s0/0/0
Router(config-if)# ip address [Link] [Link]
Router(config-if)# no shutdown

Step 5: Add Static Routes (Optional)

On Router0:

arduino
CopyEdit
Router(config)# ip route [Link] [Link] [Link]

On Router1:

arduino
Router(config)# ip route [Link] [Link] [Link]

Step 6: Test End-to-End Connectivity

From PC0, ping PC3:

 ping [Link]

You should receive replies.


� Suggested Screenshots for Assignment Submission
1. LAN topology layout with device labels
2. IP configuration window for 1–2 PCs
3. CLI of Router showing interface config
4. Ping result window showing connectivity
5. WAN topology layout
Conclusion:
In this experiment, we successfully designed and simulated both LAN (Local Area Network)
and WAN (Wide Area Network) topologies using Cisco Packet Tracer. We interconnected
multiple end devices, switches, and routers to form efficient network structures and
configured basic device settings such as IP addresses and device naming.

The exercise reinforced the importance of:

Proper IP address assignment using subnetting principles


Accurate device labelling for effective network management
Understanding LAN vs. WAN topology differences
Testing connectivity using basic tools like ping

Through this simulation, we gained hands-on experience with core network setup tasks that
form the foundation for all advanced networking configurations. The successful
communication between devices validated the correctness of the topology and configuration.
Experiment No: 02

Experiment Title:

Create and compare different topologies (Bus, Ring, Star, Mesh) using Packet Tracer.

Tools Required:
 Cisco Packet Tracer (version 8.x recommended)

Objective:

Design and simulate four network topologies — Bus, Ring, Star, and Mesh — and compare
their configuration, working, and performance basics.

1. Bus Topology

Steps:

1. Open Cisco Packet Tracer


2. From End Devices, drag and drop 4 PCs (PC0 to PC3).
3. From Network Devices → Hubs, drag and drop 1 Hub.
4. Arrange devices in a straight line (to represent a bus).
5. Connections:
o Use Copper Straight-Through cable.
o Connect each PC to the Hub (PC0 → Hub, PC1 → Hub, etc.)
6. IP Configuration:
o Click each PC → Desktop → IP Configuration.
o Assign the following IPs:
 PC0: [Link] / [Link]
 PC1: [Link] / [Link]
 PC2: [Link] / [Link]
 PC3: [Link] / [Link]
7. Testing:
o Open Command Prompt on PC0 → Type ping [Link] and check
connectivity.
o Repeat for all PCs.
2. Ring Topology
Steps:

1. Add 4 PCs (PC0 to PC3).


2. No Hub/Switch is required.
3. Arrange them in a circle.
4. Connections:
o Use Cross-Over Cable.
o Connect as follows:
 PC0 ↔ PC1
 PC1 ↔ PC2
 PC2 ↔ PC3
 PC3 ↔ PC0 (to complete the ring)
5. IP Configuration:
o Assign similar IPs:
 PC0: [Link] / [Link]
 PC1: [Link] / [Link]
 PC2: [Link] / [Link]
 PC3: [Link] / [Link]
6. Testing:
o Ping all PCs from PC0 and verify connectivity.

3. Star Topology

Steps:

1. Add 4 PCs and 1 Switch.


2. Arrange PCs around the switch in star shape.
3. Connections:
o Use Straight-Through Cable.
o Connect each PC to the Switch.
4. IP Configuration:
o PC0: [Link] / [Link]
o PC1: [Link] / [Link]
o PC2: [Link] / [Link]
o PC3: [Link] / [Link]
5. Testing:
o Ping from PC0 to others to verify connectivity.

4. Mesh Topology
Steps:

1. Add 4 PCs.
2. In mesh topology, each device is connected to every other device.
3. Connections:
o Use Cross-Over Cable.
o Connect each pair:
 PC0 ↔ PC1
 PC0 ↔ PC2
 PC0 ↔ PC3
 PC1 ↔ PC2
 PC1 ↔ PC3
 PC2 ↔ PC3
4. IP Configuration (Manual/Custom):
o Each PC can have multiple IPs on multiple interfaces (Advanced).
o For simple simulation, use routers or multi-interface PCs (optional).
o Alternatively, simulate using Switch and routers for scalability.
5. Testing:
o Ping between all possible pairs.

Comparison Table:
Devices Cabling Central
Topology Fault Tolerance Scalability Cost
Needed Complexity Device
Bus Few Low Hub Low Low Low
Ring Moderate Moderate No Low Moderate Low
High (central fails
Star Moderate Low Switch High Medium
= network down)
Low (for full
Mesh High Very High No Very High High
mesh)
Conclusion:
In this experiment, we successfully designed and simulated four different network topologies
Bus, Ring, Star, and Mesh — using Cisco Packet Tracer. Each topology demonstrated
unique characteristics in terms of structure, communication, fault tolerance, cost, and
scalability.

 Bus topology was simple and economical but suffered from high chances of data
collisions and lacked fault tolerance.
 Ring topology ensured orderly data transmission but was vulnerable — a single link
failure could disrupt the entire network.
 Star topology offered efficient communication and scalability with centralized
control, but it heavily depended on the central switch.
 Mesh topology provided maximum redundancy and reliability, ideal for fault-
tolerant systems, but required complex wiring and was cost-intensive.

Through this comparison, we observed that:

 Star topology is best suited for most practical LAN implementations due to its
balance of cost, performance, and reliability.
 Mesh topology is preferable in critical environments where high fault tolerance is
essential.
 Bus and Ring topologies are less commonly used today due to their limited
scalability and fragility.

This experiment highlighted the importance of selecting an appropriate topology based on


network requirements, budget constraints, and performance expectations.
Experiment No: 03

Experiment Title: Setup and Use an FTP Server (FileZilla or Similar

Objective:

To install, configure, and use an FTP (File Transfer Protocol) server to transfer files between
client and server over a network.

Tools Required:

 FileZilla FTP Server (Windows) OR vsftpd (Linux)


 FileZilla FTP Client or web browser
 Two networked devices (can be PCs or VMs)
 Local network setup (LAN) or simulation using Cisco Packet Tracer with FTP-
compatible OS (e.g., Server OS or simulation of FTP server on Packet Tracer)

PART A: Setting Up FTP Server using FileZilla


(Windows)

Step 1: Download & Install FileZilla Server

1. Go to [Link]
2. Download FileZilla Server (not the client).

3. Run the installer and follow the steps.


4. Choose default settings and start the service after installation.

Step 2: Configure FTP Server

1. Launch FileZilla Server Interface

2. If prompted, connect to localhost ([Link]), port 14147.


Step 3: Create a User Account

1. Click on "Edit" → "Users"

2. Click "Add" to create a new user (e.g., ftpuser)

3. Click "Shared folders"


4. Click "Add" to select a folder for FTP access (e.g., C:\FTP_Shared)
5. Assign permissions like Read, Write, Delete, etc.

Step 4: Allow FTP Through Firewall

1. Open Control Panel → Windows Defender Firewall


2. Click on "Allow an app through Windows Firewall"
3. Add FileZilla Server to the list.

4. Also, allow port 21 (default FTP port) through firewall if not already allowed.
Step 5: Get the Server IP Address

1. Open Command Prompt on the server PC.


2. Type: ipconfig
3. Note the IPv4 address (e.g., [Link])

PART B: Access FTP Server from Client


Option 1: Use FileZilla FTP Client

1. Download and install FileZilla Client on a different PC (client).


2. Open FileZilla Client and enter:
o Host: [Link] (server IP)
o Username: ftpuser
o Password: root (leave blank or use the one you created)
o Port: 21
3. Click Quickconnect
Option 2: Use Web Browser

1. Open any browser.


2. In the address bar, type:
ftp:// [Link]
3. When prompted, enter username and password.

PART C: Upload and Download Files

To Upload:

1. On FileZilla Client, locate your local files (left panel)


2. Drag and drop files into the remote folder (right panel)

To Download:

1. On the right panel (remote server), right-click any file


2. Choose Download to save it to the client system
Screenshots to Include in Assignment Report
1. FileZilla Server interface
2. User account setup
3. Shared folder configuration
4. FTP client connection window
5. Upload/download file confirmation
6. Successful connection logs

Conclusion:
In this experiment, we successfully installed, configured, and used an FTP (File Transfer
Protocol) server using FileZilla Server to simulate file sharing between a client and a server
over a network. We created user accounts, defined access permissions, and transferred files
using both GUI-based FTP client and command-line utilities.

This experiment provided practical understanding of:

 Setting up a real-world FTP server environment


 Using port 21 for FTP communication
 Understanding how file permissions and directories are managed
 Performing basic file transfer operations such as upload (PUT) and download (GET)

By completing this task, we demonstrated the use of FTP as an application layer protocol,
learned how clients and servers interact using predefined commands, and understood the
importance of user authentication and network accessibility in file-sharing systems.
Experiment No: 04

Experiment Title:

Send/receive email via SMTP and POP3 by using telnet or a mail client.

Objective

To configure and simulate the sending and receiving of emails using SMTP (for sending)
and POP3 (for receiving) through Telnet or a mail client in a simulated network.

Course Outcome Mapped

 CO2: Apply application and transport layer protocols to implement networking


services.

Tools Required

 Cisco Packet Tracer


 Email Server (built-in)
 PCs (at least 2: sender and receiver)
 Switch
 Copper Straight-through Cables
 Telnet Client (built-in in Packet Tracer)

Step-by-Step Execution in Cisco Packet Tracer

Step 1: Set Up the Devices

Add the following to the workspace:

 1 Server
 2 PCs (PC0 = sender, PC1 = receiver)
 1 Switch
 Cables (Copper Straight-through)
Step 2: Connect the Devices

Use cables to connect:

 PC0 → Switch
 PC1 → Switch
 Server → Switch

Step 3: Assign IP Addresses


Device IP Address Subnet Mask
PC0 [Link] [Link]
PC1 [Link] [Link]
Server [Link] [Link]
Configure each device using:
Desktop > IP Configuration
Step 4: Configure the Email Server

1. Click on the Server


2. Go to the Services tab
3. Click on Email
4. Ensure both SMTP and POP3 services are turned ON
5. Add users:
o Username: ABC | Password: 1234 | Email: abc@[Link]
o Username: XYZ | Password: 6789 | Email: xyz@[Link]

Now, the server is ready to send and receive emails.


PART A: Send Email Using a Mail Client

Step 1: Configure Email Client on PC0 (Sender)

1. Click PC0 > Desktop > Email


2. Fill out:
o Display Name: ABC
o Email: abc@[Link]
o Incoming Mail Server: [Link]
o Outgoing Mail Server: [Link]
o Username: ABC
o Password: 1234

Click “Set” to confirm configuration.


Step 2: Send an Email from ABC to XYZ

Still in PC0 > Email tab:

1. Click Compose
2. To: xyz@[Link]
3. Subject: Test Email
4. Body: This is a test email to XYZ
5. Click Send

Step 3: Receive Email on PC1

1. Go to PC1 > Desktop > Email


2. Configure with:
o Display Name: XYZ
o Email: xyz@[Link]
o Incoming Mail Server: [Link]
o Outgoing Mail Server: [Link]
o Username: XYZ
o Password: 6789
3. Click “Receive” to fetch the email

The message from ABC will appear in the inbox.

PART B: Use Telnet to Simulate SMTP & POP3


Step 4: Use Telnet for Sending Email (SMTP)

1. On PC0 → Open Command Prompt


2. Connect to the SMTP server:
telnet [Link] 25

Now type SMTP commands:

HELO [Link]
MAIL FROM:<b=abc@[Link]>
RCPT TO:<xyz@[Link]>
DATA
Subject: Hello XYZ
This is a test message using Telnet.
.
QUIT

Email sent to XYZ manually using SMTP commands.

Step 5: Use Telnet for Receiving Email (POP3)

1. On PC1 → Open Command Prompt

telnet [Link] 110

Now type SMTP commands:

Sql

USER XYZ
PASS 6789
LIST
RETR 1
QUIT

Email from ABC retrieved manually using POP3 commands.

Conclusion:
In this experiment, we successfully demonstrated how emails are sent and received over a
network using two essential application layer protocols: SMTP (Simple Mail Transfer
Protocol) and POP3 (Post Office Protocol 3). We configured an email server, created user
accounts, and simulated the complete email exchange process using both a GUI-based mail
client and Telnet commands.

This experiment enhanced our understanding of:


 The roles of SMTP (for sending mail) and POP3 (for receiving mail)
 The working of email services over TCP/IP
 How to manually connect and interact with servers using Telnet
 Verifying connectivity and mail delivery through real-time simulation

By completing this experiment, we gained valuable insight into email protocol


communication and the practical aspects of configuring and troubleshooting mail services in
both manual and client-based scenarios.
Experiment No: 05
Aim: Write a client-server program in Java or Python using TCP sockets.

Software/Tools Required:
IDE or Text Editor (e.g., VS Code, PyCharm, Eclipse), Terminal or Command
Prompt.

Theory:
Python’s socket module is a powerful tool for creating network applications. The socket
is the endpoint of a bidirectional communications channel between the server and the
client. Sockets may communicate within a process, between processes on the same
machine, or between processes on different machines.

Steps to communicate both server and client model:


1. Python socket server program executes at first and waits for any request
2. Python socket client program will initiate the conversation at first.
3. Then server program will response accordingly to client requests.
4. Client program will terminate if user enters “bye” message. Server program will also
terminate when client program terminates, this is optional and we can keep server
program running indefinitely or terminate with some specific command in client
request.

To use python socket connection, we need to import socket module. Then, sequentially we
need to perform some tasks to establish connection between server and client. We can
obtain host address by using [Link]() function. The user port address should
above 1024 because port number lesser than 1024 are reserved for standard internet
protocol.

Python socket server code:

import socket

def server_program():
# get the hostname
host = [Link]()
port = 5000 # initiate port no above 1024

server_socket = [Link]() # get instance


# look closely. The bind() function takes tuple as argument
server_socket.bind((host, port)) # bind host address and port together

# configure how many client the server can listen simultaneously


server_socket.listen(2)
conn, address = server_socket.accept() # accept new connection
print("Connection from: " + str(address))
while True:
# receive data stream. it won't accept data packet greater than 1024 bytes
data = [Link](1024).decode()
if not data:
# if data is not received break
break
print("from connected user: " + str(data))
data = input(' -> ')
[Link]([Link]()) # send data to the client

[Link]() # close the connection

if __name__ == '__main__':
server_program()

Python Socket Client:


import socket

def client_program():
host = [Link]() # as both code is running on same pc
port = 5000 # socket server port number

client_socket = [Link]() # instantiate


client_socket.connect((host, port)) # connect to the server

message = input(" -> ") # take input

while [Link]().strip() != 'bye':


client_socket.send([Link]()) # send message
data = client_socket.recv(1024).decode() # receive response

print('Received from server: ' + data) # show in terminal

message = input(" -> ") # again take input

client_socket.close() # close the connection

if __name__ == '__main__':
client_program()

[Link]
server-client

Result:

The client-server program was successfully executed using TCP sockets in Python (or
Java). The client was able to establish a connection with the server, send a message, and
receive a response from the server over a reliable TCP connection. This demonstrated
basic socket communication and connection-oriented networking.

Conclusion:

This experiment demonstrated how to implement a connection-oriented communication


model using TCP sockets. It provided a practical understanding of how servers listen for
client connections, and how clients initiate communication over a specific port. The
experiment reinforced core networking concepts such as socket creation, binding, listening,
accepting, sending, and receiving messages using the TCP protocol. This forms the
foundation of many real-world networked applications, including web servers, chat systems,
and file transfer utilities.

Oral Questions:

1. What is a socket in networking?


2. What is the difference between TCP and UDP sockets?
3. What is the role of the server and client in socket communication?
4. What are the typical port numbers used for socket programming?
5. Why is TCP called a connection-oriented protocol?
6. Which function is used to create a socket in Python/Java?
7. What is the use of bind() in server-side programming?
8. What does the listen() function do?
9. What is the role of accept() on the server side?
10. How does the client connect to the server?
Experiment No: 06

Aim: Implement a TCP-IP client-server application. The server accepts a string as a request
and sends the capitalized version back.

Software/Tools Required:
Python, Terminal/Command Prompt, Text editor or IDE (VS Code, PyCharm, etc.)
.

Theory:
In computer networks, communication between systems (hosts) is carried out using
protocols—rules that govern data transmission. The TCP/IP model, also known as the
Internet Protocol Suite, is the foundation of modern networking.
The TCP/IP model consists of four layers:
1. Application Layer – Supports network applications (e.g., HTTP, FTP, SMTP).
2. Transport Layer – Provides reliable data transfer using TCP or faster, connectionless
transfer using UDP.
3. Internet Layer – Handles logical addressing (IP addresses) and routing.
4. Network Access Layer – Deals with physical transmission of data over network
media.
Client-Server Architecture involves two components:
 Client: Initiates communication by sending a request.
 Server: Waits for incoming requests and sends back responses.
TCP (Transmission Control Protocol) is connection-oriented and ensures reliable
delivery of data.

Socket Programming: Involves using APIs to send/receive data over a network.


The entire process can be broken down into the following steps:

TCP Server -
1. Using create(), Create TCP socket.
2. Using bind(), Bind the socket to server address.
3. Using listen(), put the server socket in a passive mode, where it waits for the client
to approach the server to make a connection
4. Using accept(), At this point, connection is established between client and server,
and they are ready to transfer data.
5. Go back to Step 3.
TCP Client -
1. Create TCP socket.
2. Connect newly created client socket to server.

Python socket server code:

import socket

# Create a TCP/IP socket


server_socket = [Link](socket.AF_INET, socket.SOCK_STREAM)

# Bind the socket to localhost and a port


server_socket.bind(('localhost', 12345))
# Listen for incoming connections
server_socket.listen(1)
print("Server is listening on port 12345...")

# Accept connection
conn, addr = server_socket.accept()
print(f"Connected by {addr}")

# Receive data
data = [Link](1024).decode()

# Process and send back response


capitalized_data = [Link]()
[Link](capitalized_data.encode())

# Close connection
[Link]()

Python Socket Client:

import socket

# Create a socket

client_socket = [Link](socket.AF_INET, socket.SOCK_STREAM)

# Connect to server

client_socket.connect(('localhost', 12345))

# Send input

message = input("Enter a string: ")

client_socket.send([Link]())

# Receive response

response = client_socket.recv(1024).decode()

print("Capitalized string from server:", response)

# Close socket

client_socket.close()

Procedure:
1. Open a terminal and run [Link].
2. Open another terminal and run [Link].
3. Enter a string in the client terminal.
4. Observe the capitalized string returned by the server.

Result:
The TCP/IP client-server application was successfully implemented. The server received a
string input from the client, processed it by converting it into uppercase letters, and sent the
transformed string back to the client. This demonstrated reliable, bidirectional
communication using TCP sockets, validating the concepts of socket programming, client-
server architecture, and TCP/IP protocol operations.

Conclusion:
In this lab experiment, we successfully developed a TCP/IP-based client-server application
using socket programming. The client sent a string to the server, which processed the input
by converting it to uppercase and returned the modified string.

Oral Questions:
1. What is the main objective of this experiment?
2. What did you conclude from this experiment?
3. Why was TCP used instead of UDP in this application?
4. What happens if the server is not running when the client tries to connect?
5. How does the server know when to stop receiving data?
6. What is the role of bind(), listen(), and accept() functions in the server program?
7. What does socket.AF_INET and socket.SOCK_STREAM mean in Python socket
programming?
8. Can this server handle multiple clients? Why or why not?
9. What is the importance of encoding and decoding messages in socket communication?
10. What changes would you make to convert this from a single-use to a multi-client server?
Experiment No: 07

Aim: Use Packet Tracer to simulate and analyse socket programming & packet flow
differences between sockets.

Software Required: Packet Tracer

Theory:
A network socket is a software abstraction that serves as an endpoint for
communication between two processes over a network. It encapsulates both an IP address
and a port number, uniquely identifying each connection endpoint. On UNIX-like systems,
sockets are treated similarly to files and represented by file descriptors, enabling network
I/O to follow standard file read/write interactions.

Connection-Oriented vs. Connectionless Communication


Socket programming typically employs one of two transport-layer protocols: TCP
(Transmission Control Protocol) or UDP (User Datagram Protocol).

TCP (Connection-Oriented)

 Connection Establishment:
Uses a three-way handshake (SYN → SYN-ACK → ACK) before data is sent, ensuring
both endpoints are ready
 Reliable & Ordered Data Transfer:
Data is sent as a byte-stream using sequence numbers. The receiver sends ACKs; lost or
corrupted segments are retransmitted
 Flow & Congestion Control:
Utilizes sliding windows and congestion algorithms to adapt to network load, preventing
packet loss
 Connection Termination:
Ends with a four-step teardown (FIN/ACK cycles), ensuring a graceful closure
 Summary:
TCP ensures reliable, ordered, and error-checked delivery, making it ideal for
applications like web browsing, file transfers, email, and remote shells

UDP (Connectionless)

 No Connection Setup:
Data is sent directly as independent datagrams, without handshakes
 Unreliable & Unordered Delivery:
Packets have no sequence numbers or acknowledgments; they may be lost, arrive out-of-
order, or be duplicated
 Minimal Overhead:
With just an 8-byte header and no congestion control, UDP is lightweight and fast
 Summary:
UDP offers low-latency, high-speed transmission and suits applications like live
streaming, online gaming, and DNS, where occasional data loss is acceptable

Lifecycle of a TCP Client–Server Connection


In TCP-based socket programming, the server typically runs these systems call steps:
 socket() → bind() → listen() → accept()
Upon accept(), the server obtains a new socket descriptor for processing client requests,
while continuing to listen for new connections.
The client performs:
 socket() → connect() → send()/recv() → close()
Callback functions handle incoming data until the connection is terminated. Each client
connection is identified by a tuple: (client IP, client port, server IP, server port, protocol).

Error Handling and Non-blocking I/O


Error handling is critical for robust networking. System calls may fail, returning error codes
indicating issues like timeouts or disconnections. In languages like C and C++, errno can
provide diagnostic context, and using perror() or structured exception handling helps log
issues programmatically.

Sockets can be either blocking or non-blocking:


 Blocking sockets pause execution until operations complete successfully (e.g. recv() waits
for data).
 No-blocking sockets return immediately, enabling asynchronous workflows. Tools like
select(), poll(), or epoll() are often used for managing multiple concurrent socket
connections without multithreading.

Applications and Use-Cases


 TCP sockets are used when data integrity and order are crucial—such as HTTP/HTTPS in
web browsing, SMTP/IMAP in email, SSH for remote access, and reliable file-transfer
protocols.
 UDP sockets excel in systems requiring low-latency communication, such as real-time
video/voice, DNS responses, multiplayer gaming, and network discovery protocols.

 Step-by-step instructions to simulate and analyze socket programming in Cisco


Packet Tracer, without writing any code. Instead, you’ll use built-in services and
Packet Tracer tools to explore client-server communication.

1. Build Your Network Topology


 Open Packet Tracer and switch to Logical Workspace.
 Drag in devices: one server and one or two PCs (or IoT devices supporting services).
 Connect devices with a switch or hub using appropriate cables.
2. Assign IP Addresses
 Double-click each device, go to Desktop → IP Configuration, and assign static IPs (e.g.,
[Link] for the server, .11/.12 for PCs).

3. Enable Server Services


 Click the server and go to the Services tab.
 Enable HTTP, FTP, DNS, or Telnet services (according to your learning objective).
 Note default port numbers (e.g., HTTP = 80, FTP = 21).

4. Launch Clients
 On each PC, open Desktop → Web Browser, Command Prompt, or FTP client.
 Point to the server's IP or hostname to initiate connections (e.g., [Link]).
5. Switch to Simulation Mode
 Click the Simulation tab.
 Use Edit Filters to select relevant protocols (TCP, HTTP, UDP, DNS).
6. Generate Traffic
 In the simulation, create a Simple PDU from PC to Server for HTTP, FTP, or DNS.
 Run the simulation step-by-step using Capture/Forward to see packet flow.
7. Inspect Packet Details
 Click each PDU envelope to view headers (IP, TCP/UDP, application layer).
 Note details like source/destination ports, sequence/ACK numbers, and flags (SYN, ACK).

8. Interpret Observations
 Identify the TCP three-way handshake (SYN → SYN-ACK → ACK).
 Observe data packet transfers and session teardown (FIN/ACK).
 For UDP/DNS: note the lack of handshake and data confirmation.
9. Correlate With Service Logs
 On the PC, check console logs (e.g., Browser response, FTP login success).
 Match events to packet simulation—helpful for understanding the mapping between
application behavior and network traffic.

Packet flow differences between TCP (stream sockets) and UDP (datagram sockets),

TCP (Stream Sockets)


 **Connection setup (3-way handshake):**
Client → Server: SYN
Server → Client: SYN-ACK
Client → Server: ACK
This establishes a reliable session before data transfer begins

Data is sent as a continuous, ordered byte stream. Each segment carries sequence numbers;
the receiver reassembles and acknowledges these segments. Missing or corrupted segments
are automatically retransmitted.

 Flow and congestion control:


TCP uses a sliding window mechanism and adapts to network congestion, preventing
buffer overflows and ensuring stable data flow
 Connection teardown:
After data transfer, TCP initiates a graceful four-step closure: FIN, ACK, FIN, ACK —
releasing resources reliably

UDP (Datagram Sockets)

 No connection establishment:
Data packets (datagrams) are sent immediately without any handshake
 Message-based, unordered delivery:
Each datagram remains independent; there is no guarantee of order, delivery, or
duplication prevention Minimal overhead:
UDP headers are small (only 8 bytes), with no sequence numbers, handshaking,
retransmission, or congestion control
 Use-case efficiency:
Ideal for real-time applications like video/audio streaming, gaming, or DNS, where speed
is prioritized over reliability

Comparison Table

Feature TCP (Stream) UDP (Datagram)


Connection Setup Three-way handshake None
Data Ordering Guaranteed ordered delivery No ordering guarantees
Reliability ACK + retransmission No built-in reliability
Flow/Congestion Control Present None
Header Size 20–60 bytes 8 bytes
Ideal Use Case Web, email, file transfer Streaming, gaming, DNS

Conclusion:
Experiment No: 08

Aim : Design and implement subnetting schemes for a given IP address.

Software required : Packet Tracer

Theory:
Design and implement subnetting schemes for a given IPv4 address—using CIDR,
VLSM, and practical example is given below

Subnetting

Subnet Mask & CIDR

A subnet mask (e.g., [Link]) divides an IPv4 address into the network and host
portions. In binary, valid masks always begin with consecutive 1-bits followed by 0-bits

CIDR (Classless Inter-Domain Routing) allows flexible allocation of IP address blocks using
a slash notation (e.g., [Link]/24). The /24 indicates the first 24 bits (network), and
remaining 8 bits for hosts. CIDR superseded rigid classful addressing, enabling efficient
routing and IP utilization [].

VLSM (Variable-Length Subnet Mask)

VLSM enables subnetting a network into parts of different sizes—unlike fixed-length


subnetting (FLSM). This means each subnet can be sized precisely based on host
requirements, reducing IP wastage and boosting scalability [].

 FLSM: All subnets have the same size (legacy/classful).


 VLSM: Subnet masks vary per subnet based on need, ideal for modern networks and
variable host counts

Benefits of Subnetting with CIDR and VLSM

 Efficient IP usage: Minimizes wasted addresses by customizing subnet sizes ([****]).


 Scalable network structure: Supports incremental growth without redesigning the entire
IP block ([****]).
 Reduced routing overhead: CIDR aggregates contiguous networks into fewer routes,
simplifying routing tables
 Improved broadcast containment and security: Smaller subnets limit broadcast domains
and help isolate traffic

Calculating Subnets, Hosts, and Addresses

For CIDR notation, if the network prefix length is /n, number of addresses is 2^(32−n), and
usable hosts is 2^(32−n) − 2 (subtracting network and broadcast)

To calculate key addresses:


 Network ID = floor(host_address / subnet_size) × subnet_size
 Broadcast ID = network_ID + (subnet_size − 1)
 First usable IP = network_ID + 1
 Last usable IP = broadcast_ID − 1

Example Summary

Using [Link]/24 split into four equal subnets:

 New prefix: /26


 Mask: [Link]
 Each subnet supports 62 hosts (2^6 − 2), starting at:
o [Link]/26 → hosts .1–.62, broadcast .63
o And so on through .192–.254

Summary Table

Concept Purpose

Subnet mask Divides IP into network and host portions

CIDR Flexible prefix-based addressing

VLSM Create subnets of different sizes as needed

Host calculation Usable hosts = 2^(host_bits) − 2

Network/Broadcast formula Calculates network/broadcast and usable ranges

Step-by-Step Sub netting Process

Step 1: Determine Requirements

Identify:

 Total IP network block (e.g., [Link]/16)


 The number of hosts needed per subnet/groups

Step 2: Decide Subnet Sizes

Calculate how many host bits are needed:

 Required hosts + network & broadcast => 2^h ≥ required_hosts + 2


 Host bits = h = ceil(log₂(required_hosts + 2))
 Borrowed bits s = original_host_bits − h
 New prefix = original prefix + s

E.g. For [Link]/16 and 500 hosts:


 h = 9 (because 2^9 = 512 ≥ 502)
 Borrow s = 16 − 9 = 7 bits
 New prefix: /23 (16 + 7) → supports 510 usable hosts Step 3: Calculate Subnet Mask &
Ranges

Convert prefix to mask:

 /23 → binary mask: 11111111.11111111.11111110.00000000 → [Link]


Then derive:
 Subnet IDs, broadcast addresses, and host IP ranges for each segment.

Step 4: Assign Subnets in Order

Allocate contiguous subnets from the original block:

 Dept A: [Link]/23 → 510 hosts


 Dept B (e.g., 250 hosts): /24 → 254 hosts → [Link]/24
 Dept C (100 hosts): /25 → 126 hosts → [Link]/25
 Dept D (50 hosts): /26 → 62 hosts → [Link]/26

Step 5: Verify & Document

 Number of subnets = 2^s


 Usable hosts = 2^h − 2
 Document each subnet’s Network ID, Broadcast, and usable range

Practical Example

Given: [Link]/24, need 4 subnets.

 Borrow 2 bits → 4 subnets (2^2 = 4)


 New mask: /26 → subnet mask [Link]
 Usable hosts per subnet: 2^6 − 2 = 62

Subnets:

 [Link]/26 → hosts .1–.62 (broadcast .63)


 [Link]/26 → .65–.126 (broadcast .127)
 [Link]/26 → .129–.190 (broadcast .191)
 [Link]/26 → .193–.254 (broadcast .255)

Conclusion:
Experiment No: 09

Aim : Configure Routing Tables and Enable Routing using Packet Tracer or GNS3

Theory:

Routing is the process of selecting paths in a network along which to send network traffic.
Routers use routing tables to determine the best path for forwarding packets.

There are two types of routing:

 Static Routing: Manually configured routes by a network administrator.


 Dynamic Routing: Routers communicate with each other using protocols like RIP,
EIGRP, or OSPF to automatically update their routing tables.

Routing is essential for inter-network communication and ensures data reaches its intended
destination.

Requirements:

 Cisco Packet Tracer or GNS3


 Minimum two routers
 PCs/Switches and required cables

Steps:

1. Topology Setup:

 Add two or more routers in Packet Tracer.


 Connect routers using serial or Ethernet cables.
 Add PCs and switches to each router's LAN.

2. Assign IP Addresses:

 Assign appropriate IP addresses to router interfaces and PCs.


 Ensure that interfaces are brought up using no shutdown.

3. Configure Routing:

For Static Routing:

Router(config)# ip route <destination-network> <subnet-mask> <next-hop-IP>


Example:

RouterA(config)# ip route [Link] [Link] [Link]

For RIP (Dynamic Routing):

Router(config)# router rip


Router(config-router)# version 2
Router(config-router)# network <network-address>

4. Verify Configuration:

 Use show ip route to verify routing table entries.


 Use ping or tracert to test connectivity between end devices.

Conclusion:

By configuring routing tables and enabling routing protocols in Packet Tracer or GNS3, we
successfully established communication between devices in different networks. This activity
helps understand how routers direct traffic based on routing information.
Experiment No: 10

Aim:

Configure IPv6 addressing on virtual/physical machines.

Theory:

The Internet Protocol version 6 (IPv6) is the most recent version of the Internet Protocol
designed to address the limitations of IPv4, especially the exhaustion of address space. IPv6
uses a 128-bit address format, allowing for a vastly larger number of unique IP addresses than
the 32-bit IPv4.

Key Features of IPv6:

 128-bit addressing, offering 3.4 × 10³⁸ possible addresses.


 Simplified header structure for efficient packet processing.
 Built-in support for security (IPSec) and improved mobility.
 No need for NAT (Network Address Translation).
 Supports auto-configuration (both stateless and stateful).

IPv6 Address Format:

 128-bit address, written in hexadecimal and separated by colons :.


 Example: [Link]
 Can be abbreviated using rules for zero compression and suppression.

Requirements:

 Two or more virtual machines (e.g., VirtualBox, VMware) or physical machines.


 Operating systems supporting IPv6 (Windows/Linux/Ubuntu).
 Administrator/root access.
 Basic networking tools: ping, ip (Linux) or ipconfig (Windows).

Procedure:

On Linux/Ubuntu Machine:

1. Open Terminal with root privileges.


2. Check current IPv6 configuration:

bash
CopyEdit
ip -6 addr
3. Assign an IPv6 address to a network interface:

bash
CopyEdit
sudo ip -6 addr add [Link]/64 dev eth0

4. Verify the assigned address:

bash
CopyEdit
ip -6 addr show dev eth0

5. Test network connectivity:

bash
CopyEdit
ping6 [Link]

On Windows Machine:

1. Open Command Prompt as Administrator.


2. View current IPv6 configuration:

bash
CopyEdit
ipconfig

3. Assign an IPv6 address manually:


o Via Control Panel → Network and Sharing Center → Adapter Settings →
Properties → Internet Protocol Version 6 (TCP/IPv6).
o Or using:

bash
CopyEdit
netsh interface ipv6 set address "Local Area Connection" [Link]

4. Check the configuration:

bash
CopyEdit
ipconfig

5. Test connectivity:

bash
CopyEdit
ping -6 [Link]
Result:

IPv6 addresses were successfully configured on both virtual and physical machines, and
network connectivity between them was verified using appropriate networking tools.

Conclusion:

In this experiment, IPv6 addresses were configured on network interfaces in both Linux and
Windows systems. The connectivity was tested and validated using the ping6 or ping -6
commands, demonstrating successful IPv6 communication.
Experiment No: 11

Title:

Configure a Basic Wireless Network using 802.11 Standards in Cisco Packet Tracer

Objective:

To design and configure a simple wireless network using 802.11 standards in Cisco Packet
Tracer, allowing wireless devices to communicate with each other and access wired network
resources.

Tools/Software Required:

 Cisco Packet Tracer (Version 7.x or higher)

802.11 Standard Overview:

The IEEE 802.11 standard defines the protocols for implementing wireless local area
network (WLAN) communication in various frequency bands like 2.4 GHz and 5 GHz.
Common variants include:

 802.11b/g/n (2.4 GHz)


 802.11a/n/ac (5 GHz)
 Each variant offers different speeds and ranges.

Network Components Used:

 Wireless Router
 PC (Wireless-enabled)
 Laptop (Wireless-enabled)
 Smartphone (optional)
 Switch (for wired LAN integration)
 Ethernet-enabled PC (optional for wired testing)

Network Topology Diagram:

(Create in Packet Tracer — visually show router, wireless devices, optional wired PC and
switch connections)

Procedure:

Step 1: Start Cisco Packet Tracer

 Open Cisco Packet Tracer.


 Create a new workspace.
Step 2: Add Devices

 Drag and drop:


o 1 Wireless Router (eg: Linksys or Home Router)
o 2 Wireless PCs/Laptops
o 1 Wired PC (optional)
o 1 Switch (if connecting wired devices)

Step 3: Configure Wireless Router

 Click the Wireless Router > Config Tab


 Set:
o Display Name: HomeRouter
o SSID (Network Name): MyWiFiNetwork
o Wireless Security: WPA2-PSK
o Password: cisco123
o 802.11 Mode: Select suitable (Mixed/802.11n)

Step 4: Configure Wireless PCs/Laptops

 Click each Laptop/PC


 Go to Config Tab > Wireless0
 Turn on Wireless
 Set SSID: MyWiFiNetwork
 Set Security Mode: WPA2-PSK
 Enter Key: cisco123

Step 5: Verify Connectivity

 Use Command Prompt in each PC


 Ping other devices by IP address.
 Ensure successful communication.

Step 6: (Optional) Connect Wired Devices

 Connect PC to Switch using Copper Straight-Through Cable


 Connect Switch to Router’s Ethernet Port
 Assign IP addresses and test pings.

IP Addressing Scheme:

Device Interface IP Address Subnet Mask


Wireless Router LAN [Link] [Link]
Laptop1 (Wireless) Wireless0 [Link] [Link]
Laptop2 (Wireless) Wireless0 [Link] [Link]
Wired PC (optional) FastEthernet0 [Link] [Link]
Result:

A basic wireless network was successfully configured using the 802.11 standards. Wireless
devices connected securely via Wi-Fi, communicated with each other, and optionally
integrated with wired LAN devices.

Conclusion:

This experiment demonstrated how to configure a simple wireless LAN using 802.11
standards in Cisco Packet Tracer. It also illustrated how wireless devices authenticate using
WPA2-PSK security and communicate within a network.

You might also like