System Networking – Linux Teaching Plan

This 2‑hour module introduces Linux networking fundamentals. Students will learn how to inspect, test, troubleshoot and configure network interfaces, routes, DNS, firewalls and basic client‑server utilities.

Learning Objectives

Schedule & Topics

  1. Intro & terminology (5 min)
  2. Interfaces – ip (10 min)
  3. Routing – ip route (5 min)
  4. Socket view – ss (10 min)
  5. Connectivity – ping, traceroute (10 min)
  6. HTTP & HTTPS – curl, python -m http.server (10 min)
  7. DNS – nslookup/ dig (10 min)
  8. Packet capture – tcpdump (10 min)
  9. SSH/SCP – ssh, scp (10 min)
  10. Firewall – iptables (or nft) (10 min)
  11. Service monitoring – systemctl (10 min)
  12. Mini‑project: “Set up a secure web service & firewall” (15 min)
  13. Q&A & wrap‑up (5 min)

Command Topics & Hands‑On Exercises

1. ip – View & Configure Interfaces

Inspect current interfaces and assign an IP address.

ip link show
ip addr show eth0
sudo ip addr add 192.168.200.10/24 dev eth0
sudo ip link set eth0 up

2. ip route – Routing Table

Show and add routes.

ip route show
sudo ip route add 10.20.0.0/16 via 192.168.200.1 dev eth0

3. ss – Socket Statistics

Inspect listening and established sockets.

ss -tuln
ss -a | grep LISTEN

4. netstat – Traditional Socket Viewer

Often installed by default.

netstat -tulpen

5. ping – Basic Connectivity Test

Send ICMP echo requests.

ping -c 4 google.com
ping -I eth0 8.8.8.8

6. traceroute – Path Discovery

Shows each hop along a route.

traceroute google.com
traceroute -I google.com   

7. nslookup / dig – DNS Resolution

Query DNS servers for records.

nslookup google.com
dig google.com +short
dig @8.8.8.8 example.com MX

8. curl – HTTP/HTTPS Client

Retrieve web content and test TLS.

curl -I https://www.example.com
curl --version
curl -v http://localhost:8080

9. tcpdump – Packet Capture

Sniff traffic on a specific interface.

sudo tcpdump -i eth0 -c 10
sudo tcpdump -i eth0 port 80 -w http.pcap
sudo tcpdump -r http.pcap -nn

10. ssh – Secure Remote Shell

Connect to a remote host securely.

ssh -p 2222 user@remote-host
ssh -i ~/.ssh/id_rsa user@remote-host

11. scp – Secure Copy

Transfer files between hosts.

scp file.txt user@remote-host:/home/user/
scp -P 2222 file.txt user@remote-host:/tmp/

12. iptables (or nft) – Basic Firewall

Block or allow traffic on the system.

sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
sudo iptables -A INPUT -j DROP
sudo iptables -L -n -v

13. systemctl status networking – Service Status

Check the systemd networking unit.

systemctl status systemd-networkd
sudo systemctl restart systemd-networkd

14. iptables-save / nft flush – Persisting Rules

Save or clear rules.

sudo iptables-save > /etc/iptables/rules.v4
sudo nft flush chain inet filter INPUT

15. curl – FTP & File Upload

Use curl to upload or download files via FTP.

curl -u user:pass ftp://localhost/file.txt
curl -T localfile.txt ftp://user:pass@localhost/remote/

Mini‑Project: “Secure Web Service & Firewall”

Students will perform the following steps on a fresh VM (or a student’s own server):

  1. **Configure a network interface** – assign a static IP (e.g., 192.168.10.10/24) and add a default gateway.
  2. **Verify connectivity** – ping the gateway and a public site (e.g., 8.8.8.8, `ping -c 4 google.com`).
  3. **Start a simple HTTP server** – `python3 -m http.server 8000 &` (or install & start Apache). Log its PID.
  4. **Create firewall rules** – allow inbound TCP 8000 and SSH (22) only from a specific IP, drop everything else.
  5. **Test the firewall** – from another machine in the same subnet, try to access the web page; attempt to connect on a blocked port (e.g., 22 from a non‑whitelisted IP).
  6. **Capture traffic** – use `tcpdump -i eth0 port 8000 -w webtraffic.pcap` while accessing the page; then analyze the capture with Wireshark or `tcpdump -r`.
  7. **Transfer a file** – copy a test file via `scp` to the server; verify permissions and timestamps.
  8. **Automate** – write a shell script that restarts the HTTP server if it crashes, logs the restart time, and updates a firewall rule if the IP changes.

Students will present the steps they took, the commands they used, and the results of their packet capture.

Assessment

  1. Quiz (5 min) – 5 multiple‑choice questions covering ping, traceroute, DNS and firewall basics.
  2. Hands‑on exercise (10 min) – each student brings up a network interface, sets a route, and confirms connectivity with ping.
  3. Project demo (10 min) – students walk through the mini‑project steps and answer questions from peers.

Resources

Feel free to adjust the timeline or swap iptables for nftables depending on the distribution students are using. The goal is to give them a practical, step‑by‑step understanding of how Linux interacts with the network stack and how to diagnose real‑world problems.