LAB MANUAL
COMPUTER NETWORK
Study of Basic Network Devices (IP, Switch, Router) in a LAN and
Verification using Ping and Traceroute
Objective
To identify and understand the function of basic network devices such as
IP addresses, switches, and routers.
To configure a Local Area Network (LAN) using switches and routers.
To verify network connectivity using the ping and traceroute commands.
Apparatus/Software Required
S. No. Equipment / Software Specification
1 Computers (Minimum 3) Windows/Linux OS
2 Switch Layer-2 switch (e.g., Cisco 2960)
3 Router Layer-3 router (e.g., Cisco 1841)
4 Ethernet Cables CAT-5/CAT-6
5 Network Simulator (optional) Cisco Packet Tracer or GNS3
6 Command Line Interface Windows CMD / Linux Terminal
Theory
Switch: A network device that connects devices within a LAN using MAC
addresses for communication.
Router: A network device that connects different networks and routes
packets based on IP addresses.
IP Address: A unique identifier assigned to each device on a network.
Ping: A network utility to test the reachability of a host on an IP network.
Traceroute: A command-line tool used to trace the path packets take
from source to destination.
Procedure
1. Physical Setup (Real or Simulated):
o Connect two or more PCs to a switch using Ethernet cables.
o Connect the switch to a router.
o Configure IP addresses on each PC using IPv4.
2. Assign IP Addresses:
o PC1: [Link]/24
o PC2: [Link]/24
o Router (LAN side): [Link]/24
3. Configure Default Gateway:
o On each PC, set the default gateway as the router IP ([Link]).
4. Verify IP Configuration:
o Run ipconfig (Windows) or ifconfig (Linux) on each PC.
5. Check Network Connectivity Using ping:
o From PC1, run ping [Link] to check communication with PC2.
o From any PC, run ping [Link] to verify router connectivity.
6. Use traceroute or tracert:
o From PC1, run tracert <destination> (Windows) or traceroute
<destination> (Linux) to observe the path to the router or external
IP.
Sample Commands
ping [Link]
tracert [Link]
Expected Output
Successful ping replies indicate proper configuration.
Traceroute shows each hop taken to the destination.
Result
IP addressing, switch and router configuration were successfully
performed.
Ping and Traceroute verified proper LAN communication and routing path.
Implementing PC Connection in a Local Area Network (LAN) for File and Printer
Sharing
Objective
To connect multiple PCs in a LAN.
To configure file sharing and printer sharing among the connected PCs
Apparatus/Software Required
S. No. Equipment / Software Specification
1 Computers (Minimum 2) Windows/Linux OS
2 Switch or Wireless Router Layer-2 switch / LAN-enabled router
3 Ethernet Cables CAT-5/CAT-6
S. No. Equipment / Software Specification
4 Shared Printer Network-enabled or USB printer
5 Printer Driver Software Compatible with OS used
6 Windows File Sharing Utility Built-in or Samba (for Linux)
Theory
A Local Area Network (LAN) connects multiple computers within a
limited area (e.g., lab, office).
File Sharing allows users to access files on other systems over a
network.
Printer Sharing enables multiple users to access a common printer via
the network.
Requires proper IP addressing and permission settings.
Network Topology Diagram
PC1 -----\
\ _______
\-------| Switch |----- Shared Printer
/ ‾‾‾‾‾‾‾‾
PC2 -----/
Procedure
🔹 Step 1: Establish Physical LAN
Connect PCs to the switch using Ethernet cables.
Connect the shared printer to one of the PCs or directly to the switch if it’s
a network printer.
🔹 Step 2: Configure IP Addresses
Assign static IPs to each PC (e.g., [Link], [Link]) under the
same subnet.
🔹 Step 3: Enable File Sharing
On Windows:
1. Right-click a folder → Properties → Sharing tab → Share.
2. Set sharing permissions (Read/Write).
3. Enable "Network Discovery" and "File and Printer Sharing" in the
Control Panel.
Step 4: Access Shared Folder
On another PC, open File Explorer → \\<IP-of-shared-PC>\
SharedFolderName
Map the folder as a network drive if needed.
🔹 Step 5: Configure Printer Sharing
If using a printer connected to one PC:
o Go to Control Panel → Devices and Printers → Right-click on
printer → Printer Properties → Sharing tab → Share this
printer.
o On other PCs, add the printer via Add Printer Wizard using the
network path.
If using a network printer:
o Install the printer driver on each PC and connect using the printer’s
IP address.
Sample IP Settings
Device IP Address Subnet Mask
PC1 [Link] [Link]
PC2 [Link] [Link]
Printer (optional) [Link] [Link]
Expected Output
Files from one PC are accessible on another.
Printer jobs can be sent from any connected PC.
Result
Successfully implemented file and printer sharing over LAN between
multiple PCs.
Design and Implementation of Star and Bus Topologies using Cisco Packet Tracer
Objective
To design and simulate Star and Bus network topologies using Cisco
Packet Tracer.
To analyze the data communication process and verify network
connectivity.
Apparatus/Software Required
S. Equipment /
Specification
No. Software
1 Cisco Packet Tracer Version 8.0 or above
S. Equipment /
Specification
No. Software
Computers (logical
2 PCs or Laptops in simulation
nodes)
3 Switch / Hub Available in Packet Tracer
Straight-through
4 For PC to switch connections
cables
Use copper straight-through to
5 Coaxial cables (Bus)
simulate
6 IP Addressing Scheme Static or DHCP
Theory
Star Topology: All devices are connected to a central switch/hub.
If one cable fails, the rest of the network remains functional.
Bus Topology: All devices are connected to a single backbone
(common communication line). A failure in the main cable can
disable the whole network.
Packet Tracer: A network simulation tool by Cisco used to design
and test network topologies and configurations.
Topology Diagrams
Star Topology
PC1 PC2 PC3 PC4
| | | |
-------------------------
Switch
Bus Topology (Simulated)
PC1 —— PC2 —— PC3 —— PC4
(Common wire simulated using linear connection)
Procedure
Part A: Star Topology
1. Open Cisco Packet Tracer.
2. Place 4 PCs and 1 switch on the workspace.
3. Connect each PC to the switch using copper straight-through cables.
4. Assign static IP addresses to each PC:
o PC1: [Link]/24
o PC2: [Link]/24
o PC3: [Link]/24
o PC4: [Link]/24
5. Verify connectivity using the ping command from one PC to the others.
Part B: Bus Topology (Simulated Approach)
Note: Cisco Packet Tracer does not support actual coaxial backbone. Simulate
using linear PC-to-PC connections.
1. Place 4 PCs on the workspace in a line.
2. Connect them sequentially using copper crossover cables (PC ↔ PC).
3. Assign IP addresses on the same subnet as above.
4. Enable packet forwarding by configuring one of the PCs as a router (or
simulate with static routing).
5. Use ping from PC1 to PC4 to check end-to-end communication.
Expected Output
In star topology, all devices should successfully communicate via the
switch.
In bus topology, linear connection should simulate packet flow between
devices.
Result
Successfully designed and simulated both Star and Bus topologies using
Packet Tracer.
Verified device connectivity using ping.
Constitution and Configuration of Web Server, DHCP Server, and DNS Server
using Cisco Packet Tracer
Objective
To configure a Web Server, DHCP Server, and DNS Server in a
simulated network environment.
To understand how these servers support dynamic IP addressing, domain
resolution, and website hosting.
Apparatus/Software Required
S. Equipment /
Specification
No. Software
1 Cisco Packet Tracer Version 8.0 or above
2 PCs Used as Clients
Used as Web, DHCP, and DNS
3 Server Devices
servers
4 Switch or Router For LAN connectivity
Static (for servers), Dynamic
5 IP Address Plan
(clients)
Theory
DHCP (Dynamic Host Configuration Protocol): Automatically assigns
IP addresses to devices on a network.
DNS (Domain Name System): Resolves domain names to IP addresses.
Web Server: Hosts websites and delivers web content over HTTP/HTTPS.
In a LAN environment, these servers work together to provide core network
services.
Topology Diagram
[Client PC1] [Client PC2]
| |
------------- -------------
| | | |
[Switch]------[Server (Web + DNS + DHCP)]
IP Address Scheme (Example)
Device IP Address Role
Web, DNS,
Server [Link]
DHCP
DHCP
PC1 Client
assigned
DHCP
PC2 Client
assigned
Default [Link] Router
Gateway 4 (Optional)
Procedure
🔸 Step 1: Create Network
1. Open Cisco Packet Tracer and place:
o 1 Server
o 2 PCs
o 1 Switch
2. Connect all devices using copper straight-through cables.
🔸 Step 2: Configure DHCP Server
1. On the Server:
o Go to Config > DHCP.
o Add Pool Name: LAN_POOL
o Default Gateway: [Link]
o Subnet Mask: [Link]
o Start IP: [Link]
o Max Users: 20
o Click On to enable DHCP service.
2. On PCs:
o Go to Desktop > IP Configuration.
o Select DHCP.
o Observe IP address assignment.
🔸 Step 3: Configure DNS Server
1. On the same Server:
o Go to Config > DNS.
o Add a domain entry:
Name: [Link]
Address: [Link] (Server IP)
o Enable DNS service.
2. On the PCs:
o Ensure the DNS IP is set to [Link] (via DHCP or manually).
🔸 Step 4: Configure Web Server
1. On the Server:
o Go to Services > HTTP.
o Default web page will be present. Modify or customize as needed.
o Ensure HTTP service is On.
2. On the PCs:
o Open Web Browser.
o Enter: [Link]
o Web page should load from the server.
Expected Output
PCs receive dynamic IPs from the DHCP Server.
DNS resolves [Link] to server IP.
Web page loads correctly from the Web Server on the browser.
Result
Successfully configured a DHCP Server, DNS Server, and Web Server
using Cisco Packet Tracer.
Verified domain name resolution and web page delivery.
Viva Questions
1. What is the function of a DHCP server in a network?
2. How does DNS help in accessing websites?
3. What is the difference between a static and dynamic IP?
4. Can one server act as DHCP, DNS, and Web server simultaneously?
5. Why must DNS and DHCP configurations match in client settings?
Implementation of Hamming Code for Error Detection and Correction
Objective:
To implement Hamming Code for detecting and correcting errors in a binary data
stream.
Apparatus/Software Required:
[Link] Apparatus/
Specification
. Software
1 Software MATLAB R2021b or
[Link] Apparatus/
Specification
. Software
higher
3. Theory:
Hamming code is an error-detecting and correcting binary code. It can detect up
to two-bit errors and correct one-bit errors without requiring retransmission.
Parity bits are placed at positions that are powers of 2 (1, 2, 4, 8, ...). The error
location is calculated by checking the parity of received bits
oding
clc;
clear;
% Input data bits
data = input('Enter the data bits in array form [1 0 1 1]: ');
% Calculate number of parity bits required
m = length(data);
for r = 1:10
if 2^r >= m + r + 1
break;
end
end
n = m + r;
hamming = zeros(1, n);
j = 1;
% Place data bits and initialize parity bits at powers of 2
for i = 1:n
if log2(i) ~= floor(log2(i))
hamming(i) = data(j);
j = j + 1;
end
end
% Calculate parity bits
for i = 1:r
idx = 2^(i-1);
parity = 0;
for k = idx:n
if bitand(k, idx) ~= 0
parity = bitxor(parity, hamming(k));
end
end
hamming(idx) = parity;
end
fprintf('Hamming Encoded Data: ');
disp(hamming);
% Simulate error
error_pos = input('Enter bit position to simulate error (0 for no error): ');
if error_pos > 0 && error_pos <= n
hamming(error_pos) = ~hamming(error_pos);
fprintf('Data after simulating error at position %d: ', error_pos);
disp(hamming);
end
% Error detection
syndrome = zeros(1, r);
for i = 1:r
idx = 2^(i-1);
parity = 0;
for k = idx:n
if bitand(k, idx) ~= 0
parity = bitxor(parity, hamming(k));
end
end
syndrome(i) = parity;
end
% Calculate error position from syndrome
error_detected = bi2de(fliplr(syndrome));
if error_detected == 0
disp('No error detected.');
else
fprintf('Error detected at position: %d\n', error_detected);
hamming(error_detected) = ~hamming(error_detected);
fprintf('Corrected Data: ');
disp(hamming);
end
Sample Input/Output:
Input Data Bits: [1 0 1 1]
Hamming Code: [0 1 1 0 0 1 1]
Simulated Error at Position: 3
Error Detected at Position: 3
Corrected Code: [0 1 0 0 0 1 1]
Result:
The Hamming Code was successfully implemented, and error was detected and
corrected using MATLAB