NAME :- SIMARJEET SINGH
ROLL NO. :- 2022UCM2327
BRANCH:- MAC
COURSE :- COMPUTER NETWORKS
COURSE CODE :- CMCSC15
SEMESTER :- 5
LAB INSTRUCTOR :- MR. VIPIN
PAL
LIST OF PRACTICALS
S.N PRACTICAL TASK PAGE
O. NO.
1. BASIC NETWORKING
COMMANDS ON LINUX/UNIX.
2. CREATE A SIMPLE LOCAL AREA
NETWORK (LAN) ON CISCO
PACKET TRACER.
3. CAPTURE LIVE NETWORK
TRAFFIC ON THE WIRESHARK
INTERFACE.
Experiment 1 : Networking Linux
Terminal Commands
iperf
Purpose: Measures network bandwidth and performance between two hosts.
Syntax: iperf [options]
Example: iperf -s (run as server)
Options:
● -s: Run in server mode.
● -c: Run in client mode and connect to a server.
● -u: Use UDP instead of TCP.
ss
Purpose: Displays socket statistics similar to netstat but more modern and faster.
Syntax: ss [options]
Example: ss -tuln
Options:
● -t: Show TCP sockets.
● -u: Show UDP sockets.
● -l: Show listening sockets.
whois
Purpose: Queries databases to find information about domains, IP addresses, and network
entities.
Syntax: whois [domain]
Example: whois example.com
Options:
● -H: Suppress legal disclaimers.
● --verbose: Show more detailed information.
hostname
Purpose: Displays or sets the system's hostname.
Syntax: hostname [options]
Example: hostname
Options:
● -I: Display all IP addresses of the host.
● -f: Display the FQDN (Fully Qualified Domain Name).
nmap
Purpose: Scans networks to discover hosts and services.
Syntax: nmap [options] [target]
Example: nmap -sP 192.168.1.0/24
Options:
● -sP: Ping scan only.
● -sS: TCP SYN scan.
● -O: Detect operating system.
tcpdump
Purpose: Captures and analyzes network packets on the command line.
Syntax: tcpdump [options]
Example: tcpdump -i eth0
Options:
● -i: Specify the interface to listen on.
● -w: Write packets to a file.
● -n: Do not resolve hostnames.
tftp
Purpose: Transfers files between machines using the Trivial File Transfer Protocol.
Syntax: tftp [options] [host]
Example: tftp 192.168.1.1
Options:
● -m: Specify the transfer mode (binary or ASCII).
● -v: Enable verbose mode.
iftop
Purpose: Displays bandwidth usage on an interface by host.
Syntax: iftop [options]
Example: iftop -i eth0
Options:
● -i: Specify the network interface.
● -n: Show IP addresses instead of hostnames.
● -B: Display bandwidth in bytes per second.
mtr
Purpose: Combines the functionality of ping and traceroute for network diagnostics.
Syntax: mtr [options] [host]
Example: mtr google.com
Options:
● -r: Generate a report.
● -c: Specify the number of pings to perform.
● -n: Do not resolve IP addresses to hostnames.
ncdu
Purpose: Monitors disk usage and directories, helpful in network-related storage
diagnostics.
Syntax: ncdu [options] [directory]
Example: ncdu /home/user
Options:
● -x: Stay on the same file system.
● -q: Quiet mode.
● -r: Read-only mode.
smbclient
Purpose: Provides access to SMB/CIFS shares on Windows or Samba servers.
Syntax: smbclient [options] [share]
Example: smbclient //server/share
Options:
● -U: Specify username.
● -L: List available shares on a server.
● -c: Run command after connecting.
iptables
Purpose: Configures the Linux kernel firewall, managing incoming and outgoing network
traffic.
Syntax: iptables [options] [chain] [command]
Example: iptables -L
Options:
● -A: Append a rule to a chain.
● -D: Delete a rule from a chain.
● -L: List all rules in a chain.
firewalld
Purpose: Manages firewall rules dynamically without restarting the firewall.
Syntax: firewalld [options]
Example: firewall-cmd --list-all
Options:
● --add-port: Add a port to the firewall.
● --remove-service: Remove a service from the firewall.
● --reload: Reload firewall rules.
wget
Purpose: Downloads files from the web using HTTP, HTTPS, and FTP protocols.
Syntax: wget [options] [URL]
Example: wget http://example.com/file.zip
Options:
● -q: Quiet mode (no output).
● -O: Specify output file name.
● --limit-rate: Limit download speed.
traceroute6
Purpose: Prints the route packets take to a network host using IPv6.
Syntax: traceroute6 [options] [destination]
Example: traceroute6 google.com
Options:
● -m: Set maximum number of hops.
● -n: Do not resolve hostnames.
● -w: Set timeout for each probe.
ethtool
Purpose: Configures or queries network device driver and hardware settings.
Syntax: ethtool [options] [device]
Example: ethtool eth0
Options:
● -s: Change settings such as speed, duplex, autoneg.
● -p: Identify the device.
● -i: Show driver information.
iwconfig
Purpose: Configures wireless network interfaces, similar to ifconfig.
Syntax: iwconfig [interface] [options]
Example: iwconfig wlan0
Options:
● essid: Set the network name.
● mode: Set the operating mode (managed, ad-hoc, etc.).
● key: Set the WEP key.
nload
Purpose: Monitors incoming and outgoing traffic separately on a network interface.
Syntax: nload [options] [device]
Example: nload eth0
Options:
● -t: Set refresh interval.
● -i: Set maximum scale value for incoming traffic.
● -o: Set maximum scale value for outgoing traffic.
rsync
Purpose: Synchronizes files and directories between two locations over a network.
Syntax: rsync [options] source destination
Example: rsync -avz /local/dir user@remote:/remote/dir
Options:
● -a: Archive mode.
● -v: Verbose output.
● -z: Compress data during transfer.
lsof
Purpose: Lists open files and the processes that opened them, including network sockets.
Syntax: lsof [options]
Example: lsof -i
Options:
● -i: List network files.
● -u: Show files opened by a specific user.
● -c: Filter by command name.
route
Purpose: Displays and manipulates IP routing table entries.
Syntax: route [options]
Example: route -n
Options:
● -n: Show numerical addresses instead of hostnames.
● add: Add a route.
● del: Delete a route.
ipcalc
Purpose: Calculates network, broadcast addresses, and other IP addressing information.
Syntax: ipcalc [options] [address]
Example: ipcalc 192.168.1.0/24
Options:
● -b: Display the broadcast address.
● -m: Display the netmask.
● -n: Display the network address.
ipset
Purpose: Creates and manages IP sets for use with iptables.
Syntax: ipset [options] [command]
Example: ipset create test hash:ip
Options:
● add: Add an entry to a set.
● del: Delete an entry from a set.
● list: List the entries in a set.
iwlist
Purpose: Provides additional information from a wireless network interface.
Syntax: iwlist [interface] [command]
Example: iwlist wlan0 scanning
Options:
● scanning: Display available wireless networks.
● frequency: Display supported frequencies.
● channel: Display available channels.
vnstat
Purpose: Monitors network traffic and bandwidth usage.
Syntax: vnstat [options]
Example: vnstat -i eth0
Options:
● -i: Specify network interface.
● -d: Display daily traffic summary.
● -m: Display monthly traffic summary.
ssmtp
Purpose: Sends emails via SMTP, often used in scripting and automated systems.
Syntax: ssmtp [options]
Example: ssmtp
[email protected] < message.txt
Options:
● -v: Enable verbose output.
● -C: Specify an alternate configuration file.
● -f: Specify the from address.
socat
Purpose: A versatile networking tool for data transfer, handling network connections, and
port forwarding.
Syntax: socat [options]
Example: socat TCP4-LISTEN:1234,reuseaddr,fork TCP4:remotehost:1234
Options:
● -d: Enable debugging output.
● -v: Verbose mode.
● -u: Use unbuffered I/O.
arping
Purpose: Sends ARP requests to find hosts on the network.
Syntax: arping [options] [destination]
Example: arping -c 4 192.168.1.1
Options:
● -c: Specify the number of ARP requests to send.
● -f: Stop on the first reply.
● -w: Specify a timeout in seconds.
curlftpfs
Purpose: Mounts an FTP host as a local file system using FUSE and cURL.
Syntax: curlftpfs [options] [FTP_URL] [mount_point]
Example: curlftpfs ftp://user:password@host /mnt/ftp
Options:
● -o: Pass options to the FUSE subsystem.
● -v: Enable verbose output.
dnstop
Purpose: Monitors DNS traffic, displaying queries and responses in real-time.
Syntax: dnstop [options] [interface]
Example: dnstop eth0
Options:
● -l: Limit the number of lines displayed.
● -n: Disable name resolution.
● -q: Filter specific query types.
iwgetid
Purpose: Retrieves the ESSID of a wireless network.
Syntax: iwgetid [interface]
Example: iwgetid wlan0
Options:
● -r: Display the ESSID.
● -a: Display all wireless identifiers.
macchanger
Purpose: Changes the MAC address of a network interface.
Syntax: macchanger [options] [interface]
Example: macchanger -r eth0
Options:
● -r: Set a random MAC address.
● -p: Reset to the original MAC address.
ping6
Purpose: Sends ICMP ECHO_REQUEST packets to network hosts using IPv6.
Syntax: ping6 [options] destination
Example: ping6 google.com
Options:
● -c: Stop after sending the specified number of packets.
● -i: Set the interval between packets.
rdesktop
Purpose: Connects to Windows remote desktops from a Linux terminal.
Syntax: rdesktop [options] [server]
Example: rdesktop 192.168.1.2
Options:
● -u: Specify the username.
● -p: Specify the password.
● -f: Enable full-screen mode.
smbget
Purpose: Downloads files from an SMB server.
Syntax: smbget [options] [URL]
Example: smbget smb://server/share/file
Options:
● -u: Specify username.
● -p: Specify password.
telnet6
Purpose: Connects to a remote host using IPv6 via the Telnet protocol.
Syntax: telnet6 [hostname] [port]
Example: telnet6 example.com 23
Options:
● -l: Specify the username to log in with.
● -8: Allow eight-bit input/output (binary mode).
hping3
Purpose: Assembles and sends custom ICMP/UDP/TCP packets and displays replies.
Syntax: hping3 [options] [host]
Example: hping3 -S google.com -p 80
Options:
● -S: Send SYN packets.
● -p: Specify the port.
● -i: Set packet interval.
dig +short
Purpose: Queries DNS servers and shows minimal output.
Syntax: dig +short [domain]
Example: dig +short google.com
Options:
● +trace: Trace the query path.
bind-utils
Purpose: Utilities for managing and querying DNS servers.
Syntax: named-checkzone [options] [zone] [file]
Example: named-checkzone example.com /etc/named/example.zone
Options:
● -j: Print output in JSON format.
● -i: Ignore specific errors.
tracepath
Purpose: Similar to traceroute but does not require root privileges.
Syntax: tracepath [destination]
Example: tracepath google.com
Options:
● -n: Do not resolve hostnames.
Experiment 2 : Create a LAN on Cisco
Packet Tracer
Connect all the devices as shown :
Configure all the Devices :
1. CHOOSE ALL DEVICES ONE BY ONE AND GO TO DESKTOP TAB. SELECT IP
CONFIGURATION OPTION AND ALLOT DIFFERENT I.P. ADDRESSES TO THE
DEVICES (SUB-NET MASK IS AUTOMATICALLY UPDATED).
Test The Connection :
AFTER CONFIGURING I.P. ADDRESSES, GO TO THE COMMAND PROMPT OPTION IN THE
DESKTOP TAB OF ANY OF THE DEVICE. CHECK THE CONNECTIONS BETWEEN CHOSEN
DEVICE AND ANOTHER DEVICE USING PING COMMAND.
Experiment 3: Capture Live Traffic using
Wireshark
Configure the Network Interface:
GO TO CAPTURE OPTIONS AND CONFIGURE THE NETWORK INTERFACES WE WANT
TO CAPTURE NETWORK TRAFFIC FOR (INPUT TAB).
Manage the files storing packets:
NOW GO TO OUTPUT TAB AND MANAGE HOW TO HANDLE THE FILES STORING PACKETS.
Capture Live Traffic :