0% found this document useful (0 votes)
2 views20 pages

CN Lab Practical File

The document outlines a laboratory practical file for Computer Networks for the academic year 2025-26, detailing various experiments including the study of network cables, devices, basic network commands, and IP addressing. Each experiment includes aims, required equipment, procedures, and results, emphasizing hands-on learning and practical applications. Key topics covered include cable types, network device functions, diagnostic commands, network topology configuration, and IP addressing concepts.
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)
2 views20 pages

CN Lab Practical File

The document outlines a laboratory practical file for Computer Networks for the academic year 2025-26, detailing various experiments including the study of network cables, devices, basic network commands, and IP addressing. Each experiment includes aims, required equipment, procedures, and results, emphasizing hands-on learning and practical applications. Key topics covered include cable types, network device functions, diagnostic commands, network topology configuration, and IP addressing concepts.
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

Computer Networks – Laboratory Practical File | Academic Year 2025-26

Experiment 1: Network Cables – Cross-Wired & Straight-Through

To study different types of network cables and practically


Aim implement cross-wired (crossover) cable and straight-through
cable using a clamping tool (crimping tool).

Equipment CAT5e / CAT6 UTP Cable, RJ-45 Connectors, Crimping Tool,


Required Cable Tester, Wire Stripper, Scissors

Theory
Network cables are the physical medium used to connect devices in a network. The two most common
types of Ethernet cables are:

1. Straight-Through Cable
Used to connect different types of devices such as a PC to a Switch/Hub. Both ends follow the SAME
wiring standard (both T568A or both T568B).

Straight-Through Cable Wiring Diagram

2. Cross-Wired (Crossover) Cable


Used to connect similar types of devices such as PC to PC, or Switch to Switch. End A uses T568A
and End B uses T568B.

CN Lab File Page 3


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Crossover Cable Wiring Diagram


Crossover Cable (T568A — T568B)

Procedure
Step 1: Cut a piece of UTP cable to desired length (approx. 2 m).
Step 2: Strip ~1 inch of outer insulation from both ends using a wire stripper.
Step 3: Untwist the wire pairs and arrange them according to the chosen standard.
Step 4: Trim the wires to equal length (~0.5 inch from insulation end).
Step 5: Insert wires into the RJ-45 connector in the correct sequence.
Step 6: Crimp the connector firmly using the clamping tool.
Step 7: Repeat for the other end (same standard for straight-through; different for crossover).
Step 8: Test the cable using a cable tester to verify connectivity.

Pin Configuration Table


Pin No. T568A Color T568B Color Wire Function
1 White/Green White/Orange TX+ (Transmit)
2 Green Orange TX- (Transmit)
3 White/Orange White/Green RX+ (Receive)
4 Blue Blue Unused (PoE)
5 White/Blue White/Blue Unused (PoE)
6 Orange Green RX- (Receive)
7 White/Brown White/Brown Unused
8 Brown Brown Unused

Successfully prepared and tested both straight-through and


Result
crossover cables. All pins verified using cable tester.

CN Lab File Page 4


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Experiment 2: Study of Network Devices in Detail

To study and understand various network devices including Hub,


Aim
Switch, Router, Modem, NIC, Repeater, Bridge, and Gateway.

Network Devices Overview


Network Topology Showing Device Placement
INTERNET

[MODEM]

[ROUTER]
┌──────┴──────┐
[SWITCH] [SWITCH]
┌───┴───┐ ┌───┴───┐
[PC1] [PC2] [PC3] [PC4]

Repeater ──> extends signal range in LAN segments


Bridge ──> connects two similar LAN segments
Gateway ──> protocol translator between networks

Detailed Description of Network Devices


Device OSI Layer Function Key Feature
Hub Layer 1 (Physical) Broadcasts data to all ports Half-duplex, no
intelligence
Switch Layer 2 (Data Link) Forwards frames using MAC Full-duplex, collision-
table free
Router Layer 3 (Network) Routes packets using IP Connects different
addresses networks
Bridge Layer 2 (Data Link) Connects two LAN segments Filters by MAC address
Repeater Layer 1 (Physical) Amplifies/regenerates signal Extends cable distance
Modem Layer 1-2 Modulates/demodulates Analog <-> Digital
signals conversion
NIC Layer 1-2 Network interface for a host Has unique MAC
address
Gateway Layer 4-7 Protocol conversion Connects
heterogeneous networks

Studied all major network devices, their OSI layer operation, and
Result
their roles in building computer networks.

CN Lab File Page 5


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Experiment 3: Basic Network & Configuration Commands

To study and practice basic network diagnostic commands and


Aim network configuration commands in Windows and Linux
environments.

A. Basic Network Diagnostic Commands


1. IPCONFIG / IFCONFIG
Displays network configuration information such as IP address, subnet mask, and default gateway.
Windows: C:\> ipconfig
C:\> ipconfig /all

Linux: $ ifconfig
$ ip addr show

2. PING
Tests connectivity between two hosts by sending ICMP Echo Request packets.
C:\> ping [Link]
C:\> ping [Link]

Output:
Reply from [Link]: bytes=32 time=1ms TTL=64
Ping statistics: Sent=4, Received=4, Lost=0 (0% loss)

3. TRACERT / TRACEROUTE
Displays the path (hops) that packets take to reach a destination.
Windows: C:\> tracert [Link]
Linux: $ traceroute [Link]

Output: 1 1ms [Link] (Gateway)


2 5ms [Link] (ISP Router)
3 12ms [Link] (Google)

4. NETSTAT
Displays active connections, routing table, and network statistics.
C:\> netstat -a (all active connections)
C:\> netstat -n (numeric addresses)
C:\> netstat -r (routing table)

5. NSLOOKUP
Queries DNS servers to resolve domain names to IP addresses.
C:\> nslookup [Link]
Output:
Server: [Link]

CN Lab File Page 7


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Address: [Link]
Name: [Link]
Address: [Link]

B. Network Configuration Commands


Command Platform Purpose
ipconfig /release Windows Release current DHCP IP address
ipconfig /renew Windows Renew IP address from DHCP
ipconfig /flushdns Windows Flush DNS resolver cache
arp -a Both Display ARP cache table
route print Windows Display IP routing table
ip route add Linux Add a static route
netsh interface ip set Windows Set static IP address
address
hostname Both Display current hostname

Successfully studied and executed basic network diagnostic and


Result
configuration commands on Windows and Linux systems.

CN Lab File Page 8


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Experiment 4: Configure Network Topology using Packet Tracer

To configure a basic network topology using Cisco Packet Tracer


Aim
software with proper IP addressing and connectivity verification.

Software Cisco Packet Tracer (Version 8.x or later)

Network Topology Diagram


Star-Bus Network Topology – Packet Tracer
Network: [Link]/24

PC0 Switch0 PC1


┌────┐ ┌──────────┐ ┌────┐
│ ├───Fa0─────┤ S1 ├─────Fa1───┤ │
│ │ │ │ │ │
└────┘ └────┬─────┘ └────┘
.1.10/24 │ .1.20/24
Gi0/0

┌────┴─────┐
│ Router0 │
│ │
└────┬─────┘
Gi0/1 PC2
│ ┌────┐
┌────┴─────┐ │ │
│ Switch1 ├──Fa0────┤ │
└──────────┘ └────┘
Network: [Link]/24 .2.10/24

IP Addressing Table
Device Interface IP Address Subnet Mask
PC0 Ethernet0 [Link] [Link]
PC1 Ethernet0 [Link] [Link]
PC2 Ethernet0 [Link] [Link]
Router0 GigabitEthernet0/0 [Link] [Link]
Router0 GigabitEthernet0/1 [Link] [Link]

CN Lab File Page 9


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Router Configuration Commands


Router> enable
Router# configure terminal
Router(config)# interface GigabitEthernet0/0
Router(config-if)# ip address [Link] [Link]
Router(config-if)# no shutdown
Router(config-if)# exit
Router(config)# interface GigabitEthernet0/1
Router(config-if)# ip address [Link] [Link]
Router(config-if)# no shutdown
Router(config-if)# end
Router# write memory

Steps to Configure in Packet Tracer


Step 1: Open Cisco Packet Tracer and create a new project.
Step 2: Drag 1 Router (2911), 2 Switches (2960), and 3 PCs onto the workspace.
Step 3: Connect devices using appropriate cables (copper straight-through).
Step 4: Assign IP addresses to all PCs via Desktop → IP Configuration.
Step 5: Configure router interfaces using CLI as shown above.
Step 6: Verify connectivity using ping between PCs in different subnets.

Successfully configured a routed network topology in Cisco Packet


Result Tracer. Ping between PC0 ([Link]) and PC2 ([Link])
was successful confirming inter-network routing.

CN Lab File Page 10


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Experiment 5: Study of Network IP Addressing

To study IP addressing, IP classes, public vs private IPs, and


Aim
special IP addresses used in networking.

What is an IP Address?
An IP (Internet Protocol) address is a unique 32-bit (IPv4) or 128-bit (IPv6) numerical label assigned to
each device connected to a computer network. It serves two main purposes: host identification and
location addressing.

IPv4 Address Format


IPv4 Address Structure
IPv4 Address Structure (32 bits = 4 octets)

192 . 168 . 1 . 100


───────────────────────────────
11000000.10101000.00000001.01100100
↑ ↑
MSB (Most Significant Bit) LSB

Dotted Decimal Notation: W.X.Y.Z


Each octet: 0 – 255

IP Address Classes
Class Range Default Subnet Mask Use Case
A [Link] – [Link] [Link] (/8) Large ISPs,
Governments
B [Link] – [Link] [Link] (/16) Medium organizations
C [Link] – [Link] [Link] (/24) Small LANs
D [Link] – [Link] N/A Multicasting
E [Link] – [Link] N/A Research/Reserved

Private IP Address Ranges


Class Private IP Range No. of Addresses Usage
A [Link] – [Link] 16,777,216 Large private networks
B [Link] – [Link] 1,048,576 Medium private networks
C [Link] – [Link] 65,536 Home/office networks

CN Lab File Page 11


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Special IP Addresses
IP Address Purpose
[Link] Loopback (localhost) – tests TCP/IP stack
[Link] Unspecified / Default route
[Link] Limited broadcast to all hosts
169.254.x.x (APIPA) Auto-assigned when DHCP fails

Studied IPv4 addressing structure, address classes, private IP


Result
ranges, and special-purpose addresses in detail.

CN Lab File Page 12


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Experiment 6: Simulating PING and TRACEROUTE Commands

To write a program that simulates the working of PING and


Aim
TRACEROUTE network diagnostic commands.

PING – Program (Python)


PING uses ICMP Echo Request/Reply to test reachability and measure round-trip time (RTT).
import subprocess
import sys

def ping(host, count=4):


"""Simulate PING command using subprocess"""
print(f'\nPinging {host} with 32 bytes of data:')
for i in range(count):
try:
result = [Link](
['ping', '-n', '1', host], # Windows
capture_output=True, text=True, timeout=5
)
lines = [Link]('\n')
for line in lines:
if 'Reply' in line or 'bytes' in line:
print(f' Seq {i+1}: {[Link]()}')
except [Link]:
print(f' Seq {i+1}: Request timed out.')
print('\nPing statistics: 4 packets sent.')

# Test
ping('[Link]')

TRACEROUTE – Program (Python)


TRACEROUTE discovers the route packets take by incrementing TTL (Time To Live) values from 1
upwards.
import subprocess

def traceroute(host):
"""Simulate TRACEROUTE command"""
print(f'\nTraceroute to {host}:')
print(f'{"Hop":<5} {"RTT":<10} {"IP Address":<20}')
print('-' * 40)
result = [Link](
['tracert', host], # Windows (use traceroute on Linux)
capture_output=True, text=True
)
hop = 1
for line in [Link]('\n'):
line = [Link]()
if line and line[0].isdigit():
parts = [Link]()
CN Lab File Page 13
Computer Networks – Laboratory Practical File | Academic Year 2025-26

rtt = parts[1] if len(parts) > 1 else '*'


ip = parts[-1] if len(parts) > 3 else 'Unknown'
print(f'{hop:<5} {rtt:<10} {ip:<20}')
hop += 1

traceroute('[Link]')

Sample Output
Sample Output
Pinging [Link] with 32 bytes of data:
Seq 1: Reply from [Link]: bytes=32 time=12ms TTL=118
Seq 2: Reply from [Link]: bytes=32 time=10ms TTL=118
Seq 3: Reply from [Link]: bytes=32 time=11ms TTL=118
Seq 4: Reply from [Link]: bytes=32 time=13ms TTL=118

Traceroute to [Link]:
Hop RTT IP Address
----------------------------------------
1 1ms [Link]
2 5ms [Link]
3 12ms [Link]

Successfully implemented Python programs simulating PING and


Result TRACEROUTE commands. Output matches actual command
behavior.

CN Lab File Page 14


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Experiment 7: Stop-and-Wait & Sliding Window Protocol

To implement and simulate Stop-and-Wait Protocol and Sliding


Aim
Window Protocol for reliable data transfer.

Theory
Stop-and-Wait Protocol
The sender transmits one frame and waits for an acknowledgement (ACK) before sending the next.
Simple but inefficient as the channel is idle during waiting.

Stop-and-Wait Protocol
Sender Receiver
│ │
│───── Frame 0 ──────────────────► │
│ │
│ ◄─────────── ACK 0 ─────────────│
│ │
│───── Frame 1 ──────────────────► │
│ │
│ ◄─────────── ACK 1 ─────────────│
│ │
(wait) (idle gap)

Sliding Window Protocol


Allows multiple frames to be sent before receiving an ACK, using a window of size W. Greatly improves
channel utilization.

Sliding Window Protocol (Window Size = 4)


Window Size = 4

Sender Receiver
│──── Frame 0 ─────────────────► │
│──── Frame 1 ─────────────────► │
│──── Frame 2 ─────────────────► │
│──── Frame 3 ─────────────────► │
│ ◄──────────── ACK 0 ───────────│ Window slides
│──── Frame 4 ─────────────────► │
│ ◄──────────── ACK 1 ───────────│
│──── Frame 5 ─────────────────► │

CN Lab File Page 15


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Stop-and-Wait – Python Code


import time, random

def stop_and_wait(frames, error_prob=0.2):


print('=== Stop-and-Wait Protocol ===')
for i, frame in enumerate(frames):
while True:
print(f'Sending Frame {i}: {frame}')
[Link](0.5)
if [Link]() > error_prob:
print(f'ACK {i} received.')
break
else:
print(f'Frame {i} lost! Retransmitting...')

stop_and_wait(['Hello', 'World', 'CN', 'Lab'])

Sliding Window – Python Code


import time, random

def sliding_window(frames, window_size=4, error_prob=0.1):


print('=== Sliding Window Protocol ===')
base, next_seq = 0, 0
n = len(frames)
while base < n:
while next_seq < base + window_size and next_seq < n:
print(f'Sending Frame {next_seq}: {frames[next_seq]}')
next_seq += 1
[Link](0.5)
if [Link]() > error_prob:
print(f'ACK {base} received.')
base += 1
else:
print(f'Timeout! Resending from frame {base}')
next_seq = base

sliding_window(['A','B','C','D','E','F','G','H'], window_size=3)

Comparison Table
Parameter Stop-and-Wait Sliding Window
Window Size 1 W (configurable, e.g. 7)
Throughput Low High
Complexity Simple Complex
Bandwidth Use Poor (channel idle) Efficient
Error Recovery Retransmit single frame Go-Back-N or Selective Repeat

CN Lab File Page 16


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Successfully implemented Stop-and-Wait and Sliding Window


Result protocols. Sliding Window showed significantly higher throughput
at the same error rate.

CN Lab File Page 17


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Experiment 8: Simulating ARP and RARP Protocols

To write a program simulating Address Resolution Protocol (ARP)


Aim
and Reverse ARP (RARP).

Theory
ARP – Address Resolution Protocol
ARP maps an IP address to a MAC (hardware) address on a LAN. When a device wants to
communicate, it broadcasts an ARP Request asking 'Who has IP X?' and the target replies with its
MAC address.

ARP Working Mechanism


ARP Process

Host A (Broadcast) Host B


IP: [Link] ──────────────────► IP: [Link]
MAC: AA:BB:CC:DD:EE:01 MAC:
FF:EE:DD:CC:BB:02

Step 1: A broadcasts ARP Request


'Who has [Link]? Tell [Link]'

Step 2: B sends unicast ARP Reply


'[Link] is at FF:EE:DD:CC:BB:02'

Step 3: A stores mapping in ARP Cache and sends data.

RARP – Reverse ARP


RARP works in reverse – a device knows its MAC address but not its IP address. It broadcasts its MAC
and a RARP server replies with the IP address (largely replaced by DHCP today).

ARP Simulation – Python Code


# ARP Simulation

arp_table = {
'[Link]': 'AA:BB:CC:DD:EE:01',
'[Link]': 'FF:EE:DD:CC:BB:02',
'[Link]': '11:22:33:44:55:06',
}

def arp_request(ip):
print(f'ARP Request: Who has {ip}?')

CN Lab File Page 18


Computer Networks – Laboratory Practical File | Academic Year 2025-26

mac = arp_table.get(ip)
if mac:
print(f'ARP Reply: {ip} is at {mac}')
return mac
else:
print('ARP Reply: Host unreachable (no entry found)')
return None

print('=== ARP Simulation ===')


arp_request('[Link]')
arp_request('[Link]')

RARP Simulation – Python Code


# RARP Simulation

rarp_table = {
'AA:BB:CC:DD:EE:01': '[Link]',
'FF:EE:DD:CC:BB:02': '[Link]',
'11:22:33:44:55:06': '[Link]',
}

def rarp_request(mac):
print(f'RARP Request: I am {mac}, what is my IP?')
ip = rarp_table.get(mac)
if ip:
print(f'RARP Reply: Your IP address is {ip}')
else:
print('RARP Reply: No IP assigned for this MAC')

print('\n=== RARP Simulation ===')


rarp_request('FF:EE:DD:CC:BB:02')
rarp_request('00:00:00:00:00:99')

Successfully simulated ARP and RARP protocols. ARP resolved


Result
IP-to-MAC and RARP resolved MAC-to-IP using lookup tables.

CN Lab File Page 19


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Experiment 9: Implementation of Subnetting

To understand and implement subnetting by dividing a given IP


Aim
network into multiple subnets.

Theory
Subnetting is the process of dividing a large network into smaller, more manageable sub-networks
(subnets). It uses a Subnet Mask to determine the network and host portions of an IP address.

Subnetting Diagram – [Link]/24 into /26 Subnets


Subnetting Example: [Link]/24 into 4 Subnets

Original: [Link]/24
└── Subnet 1: [Link]/26 Hosts: .1 – .62 (62 hosts)
└── Subnet 2: [Link]/26 Hosts: .65 – .126 (62 hosts)
└── Subnet 3: [Link]/26 Hosts: .129 – .190 (62 hosts)
└── Subnet 4: [Link]/26 Hosts: .193 – .254 (62 hosts)

/26 = 26 network bits, 6 host bits


Max hosts per subnet = 2^6 - 2 = 62

Subnetting Calculator – Python Code


import ipaddress

def subnet_calculator(network_cidr, num_subnets):


import math
network = ipaddress.IPv4Network(network_cidr, strict=False)
bits_needed = [Link](math.log2(num_subnets))
new_prefix = [Link] + bits_needed

print(f'Network : {network}')
print(f'Subnet Mask : {[Link]}')
print(f'New Prefix : /{new_prefix}')
print(f'Subnets :')

subnets = list([Link](prefixlen_diff=bits_needed))
for i, subnet in enumerate(subnets[:num_subnets]):
hosts = list([Link]())
print(f' Subnet {i+1}: {subnet}')
print(f' Network : {subnet.network_address}')
print(f' Broadcast : {subnet.broadcast_address}')
print(f' Host Range: {hosts[0]} – {hosts[-1]}')
print(f' Max Hosts : {len(hosts)}')

subnet_calculator('[Link]/24', 4)

CN Lab File Page 20


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Subnet Table – [Link]/24 divided into 4 subnets


Subnet Network Address Broadcast Usable Host Range Max Hosts
1 [Link] [Link] .10.1 – .10.62 62
2 [Link] [Link] .10.65 – .10.126 62
3 [Link] [Link] .10.129 – .10.190 62
4 [Link] [Link] .10.193 – .10.254 62

Successfully implemented subnetting. Divided [Link]/24


Result
into 4 equal subnets each supporting 62 hosts using /26 prefix.

CN Lab File Page 21


Computer Networks – Laboratory Practical File | Academic Year 2025-26

Experiment 10: Distance Vector Routing Protocol

To configure a network using Distance Vector Routing Protocol


Aim
(RIP – Routing Information Protocol) and verify routing tables.

Theory
Distance Vector Routing is a dynamic routing algorithm where each router maintains a routing table
with the distance (hop count) to all destinations. Routers periodically share their tables with neighbors.
RIP is the most common implementation, with a maximum hop count of 15.

Distance Vector Routing – Network Topology


Network Topology for DVR

[PC1]──────[Router A]──────────[Router B]──────[PC4]


.1.10 .1.1 .2.1 .2.2 .3.2 .3.10
│ │
[Router C]──────────────[Router D]
.4.1 .5.1 .5.2 .6.2
│ │
[PC2] [PC3]
.4.10 .6.10

Subnets: .1=192.168.1, .2=192.168.2, .3=192.168.3


.4=192.168.4, .5=192.168.5, .6=192.168.6

RIP Configuration on Cisco Router (Packet Tracer)


! On Router A:
Router> enable
Router# configure terminal
Router(config)# router rip
Router(config-router)# version 2
Router(config-router)# network [Link]
Router(config-router)# network [Link]
Router(config-router)# no auto-summary
Router(config-router)# end

! Verify routing table:


Router# show ip route
Router# show ip rip database
Router# debug ip rip

Distance Vector Algorithm – Python Simulation


import copy

CN Lab File Page 22


Computer Networks – Laboratory Practical File | Academic Year 2025-26

INF = float('inf')

# Adjacency: routers A,B,C,D = 0,1,2,3


graph = [
[0, 2, 7, INF], # A
[2, 0, 3, 1 ], # B
[7, 3, 0, 2 ], # C
[INF, 1, 2, 0 ], # D
]

def bellman_ford(graph):
n = len(graph)
dist = [Link](graph)
for _ in range(n - 1):
for u in range(n):
for v in range(n):
for w in range(n):
if dist[u][w] + dist[w][v] < dist[u][v]:
dist[u][v] = dist[u][w] + dist[w][v]
return dist

result = bellman_ford(graph)
nodes = ['A','B','C','D']
print('Shortest Path Distance Table:')
print(' ', ' '.join(nodes))
for i, row in enumerate(result):
vals = ['INF' if v==INF else str(v) for v in row]
print(f'{nodes[i]} : {" ".join(vals)}')

Routing Table after RIP Convergence


Router Destination Network Next Hop Metric (Hops)
Router A [Link]/24 [Link] (via B) 2
Router A [Link]/24 [Link] (via B) 3
Router B [Link]/24 [Link] (via A) 2
Router B [Link]/24 [Link] (via D) 2
Router C [Link]/24 [Link] (via D) 2

Successfully configured RIP (Distance Vector Routing Protocol) on


Result all routers. Routing tables converged and inter-network
communication between all PCs was verified using ping.

CN Lab File Page 23

You might also like