ITL401 - Network Lab Comprehensive
Practical Guide
This guide covers the complete step-by-step procedure to perform all practicals listed in the
ITL401 - Network Lab syllabus, including commands to run, code to write, how to execute
on Ubuntu, explanations, and viva questions with answers.
Step 1: Tool Installation (Ubuntu)
Open Terminal (Ctrl + Alt + T) and run the following:
Update system:
sudo apt update && sudo apt upgrade
Install Wireshark:
sudo apt install wireshark
sudo usermod -aG wireshark $USER
Install NS2:
sudo apt install ns2
Install Other Tools:
sudo apt install tcpdump traceroute net-tools dnsutils curl mtr whois wget
Note: Restart your system after adding user to the Wireshark group.
Question 1 & 2: Wireshark / Network Protocol Analyzer Usage
Steps:
1. Open Wireshark from the application menu.
2. Start capture on your active network interface (e.g., wlan0 or eth0).
3. Browse the internet for 5–10 mins.
4. Stop the capture.
5. Apply Filters:
TCP: tcp
HTTP: http
Port-specific: tcp.port == 80
Packet Analysis:
- Click any HTTP or TCP packet and check source IP, destination IP, ports, protocol, URL.
Tool Features:
- Graphical interface
- Filters, color-coding, protocol hierarchy
- Usability is intuitive
Anomalies:
- Look for unusual IPs, retransmissions, or failed DNS queries.
Question 3 & 10: NS2 Network Simulation
Create a file named `simple.tcl` and write the following Tcl script:
set ns [new Simulator]
set n1 [$ns node]
set n2 [$ns node]
$ns duplex-link $n1 $n2 1Mb 10ms DropTail
set ftp [new Application/FTP]
set tcp [new Agent/TCP]
set sink [new Agent/TCPSink]
$ns attach-agent $n1 $tcp
$ns attach-agent $n2 $sink
$ns connect $tcp $sink
$ftp attach-agent $tcp
$ns at 0.5 "$ftp start"
$ns at 4.5 "$ftp stop"
$ns at 5.0 "finish"
proc finish {} {
global ns
$ns halt
}
$ns run
Run it using:
ns simple.tcl
NS2 Script Explanation:
- Creates 2 nodes connected via a duplex link.
- FTP app runs on TCP agent from sender to receiver.
- Simulation runs between 0.5 to 4.5 seconds.
- 'finish' stops the simulator at 5.0 sec.
Question 4 & 5: Wireshark Filters
Basic Filters:
tcp
http
Advanced Filters:
ip.src == 192.168.1.10 && tcp.port == 80
http.authorization (to inspect credentials)
Use filters to analyze specific traffic or identify login-related packets.
Question 6 & 9: Common Network Commands
Command Description
ifconfig Displays interface IP and MAC.
ping google.com Tests internet connection.
traceroute google.com Traces packet path to host.
netstat -tuln Lists active listening ports.
dig google.com Performs DNS lookup.
nslookup google.com Alternative DNS lookup.
route -n Shows routing table.
hostname Displays machine name.
curl https://example.com Fetches webpage.
wget https://example.com Downloads webpage.
mtr google.com Real-time traceroute + ping.
whois google.com Domain info.
tcpdump -i any -c 20 Captures packets in terminal.
Question 7: Factorial Tcl Script
Create `factorial.tcl` and write:
proc factorial {n} {
if {$n <= 1} {
return 1
} else {
return [expr {$n * [factorial [expr {$n - 1}]]}]
}
}
puts "Enter a number: "
gets stdin num
puts "Factorial of $num is [factorial $num]"
Explanation: Recursive function that calculates factorial of a number.
Question 8: File I/O Tcl Script
Create a text file with:
echo "Hello from Network Lab" > input.txt
Now write `fileio.tcl`:
set in [open "input.txt" r]
set str [read $in]
close $in
set out [open "output.txt" w]
puts $out $str
puts $out $str
close $out
Explanation: Reads from one file and writes the string twice into another file.
Viva Questions & Answers
Question Answer
What is Wireshark? A GUI tool for analyzing network packets.
What is NS2? A network simulator used to test protocols
and traffic.
What does ping do? Sends ICMP echo request to test host
connectivity.
What is traceroute? Shows the route packets take to a host.
Difference between TCP & UDP? TCP is reliable, UDP is faster but unreliable.
What is a packet? A unit of data sent over the network.
What does ifconfig show? Network interfaces and their settings.
What are display filters in Wireshark? Used to filter specific traffic types.
What does netstat -tuln show? Lists listening ports and services.
What is dig used for? Performs DNS queries.
What is nslookup? Resolves domain names to IP addresses.
What is a Tcl script? A script written in Tool Command
Language.
What is NAM in NS2? Network Animator for visualization.
How do you capture packets in CLI? Using tcpdump.
What are anomalies in network capture? Suspicious or unusual traffic patterns.