🧑🏽🏫 CS-344 • “Distributed File Systems in the Wild”
Week 6 Mini-Lab: Your First Legit BitTorrent Download on Ubuntu (inside a VM, behind a VPN)
“BitTorrent is like a digital potluck. Everyone brings a piece of the dish, and you walk away with the whole meal.”
0. Admin & Ground Rules (a.k.a. Syllabus Insert)
- Legality & Ethics
- BitTorrent is neutral tech. What you download determines legality.
- In today’s lab we’ll grab Ubuntu 24.04 ISO, a totally free, open-source OS.
- Same steps apply elsewhere, but you’re responsible for copyright compliance.
- Prereqs
- You’re already inside an Ubuntu VM and have a VPN running. Kudos!
- Assumed basic terminal comfort (
apt, systemctl, etc.).
If all that’s cool, 🍿 let’s roll.
1. Concept Crash-Course (10 min)
| Term | Elevator Pitch |
|---|
| Torrent File | A tiny “map” (.torrent) telling your client where the pieces live. |
| Magnet Link | Same idea but embedded in a URL; no file download needed. |
| Tracker | A server that coordinates peers. (Think Slack #channel list.) |
| Peer/Leecher | Somebody currently downloading. |
| Seeder | Peer holding 100 % of the data and uploading it. |
| Swarm | All peers + seeders for a given content hash. |
| Hash Pieces | Each chunk has a cryptographic checksum → corruption detection. |
Encryption & privacy:
- BitTorrent protocol has optional encryption (PE).
- A VPN hides your real IP from peers and ISPs. It’s not magic; leaks still exist!
2. Lab Setup (15 min)
2.1 Verify VPN Tunnel
curl ifconfig.me # expect your VPN exit IP, not your home IP
If that checks out, enable a kill-switch (prevents traffic leak if VPN dies):
nmcli connection modify <VPN_NAME> vpn.persistent true
# or use your provider’s GUI toggle
2.2 Install an Open-Source Client
We’ll use qBittorrent (GPL-licensed, solid UI, no ads). Pick your fighter:
sudo apt update
sudo apt install qbittorrent
Alternatives: transmission-gtk, deluge, aria2 (CLI).
2.3 First Launch & Minimal Preferences
-
Open qBittorrent (Activities → qBittorrent) – or run qbittorrent in terminal.
-
Initial prompt: enable “Torrenting on startup”? Uncheck for now—keep control.
-
Go to Tools → Options:
- Connection
• Port: random is fine behind VPN.
• “Use UPnP / NAT-PMP to forward port” → Off (NAT inside VM rarely cooperates).
- BitTorrent
• Encryption mode → Require encryption (stricter, smaller swarm but safer).
• DHT, PeX, LSD → Optional. If privacy > speed, disable.
- Speed
• Set upload to 80-90 % of your true outbound bandwidth → keeps latency sane.
-
Click OK.
3. Hands-On: Downloading Ubuntu ISO (20 min)
3.1 Grab Magnet Link
Head to Ubuntu’s official torrents page:
https://torrent.ubuntu.com
Copy the magnet link for ubuntu-24.04-desktop-amd64.iso.
3.2 Add to Client
In qBittorrent: File → Add Torrent Link... → paste → Download.
You should now see:
- Status: Downloading
- Seeds / Peers: e.g.
1200/1800
- ETA, down-speed, up-speed.
3.3 Verify File Integrity
- On completion,
Right-click → Set Location if you need to move it.
- Check SHA256 provided by Ubuntu:
cd ~/Downloads
sha256sum ubuntu-24.04-desktop-amd64.iso
# Compare to hash on ubuntu.com
Matching hash = ✅ authenticity + integrity.
3.4 Seed (Give Back!)
Good netizen etiquette = seed at least a 1.0 ratio (upload as much as you downloaded).
qBittorrent → right panel shows Ratio. When ≥ 1, feel free to stop.
4. Optional Advanced Tweaks
-
Bind qBittorrent to VPN Interface Only
Find interface name:
ip route | grep default
# e.g. default via 10.7.0.1 dev tun0
In qBittorrent Tools → Options → Advanced → Network Interface → pick tun0.
Now if VPN drops, torrents stall instead of leaking.
-
CLI Automation
sudo apt install qbittorrent-nox
qbittorrent-nox --webui-port=8080
# Web UI at http://127.0.0.1:8080
-
RSS Auto-Download (for libre content—e.g., Linux distro nightlies).
-
IP Filtering: import level1 list (peer blocklist) via View → Log → IP Filter.
Marginal gains, but some people prefer it.
5. Troubleshooting Cheat-Sheet
| Symptom | Likely Cause | Fix |
|---|
| 0 KB/s down, 0 seeds | Port blocked, VPN dead, or firewall in VM | Verify VPN, disable ufw temporarily, pick different torrent |
| 0 KB/s up | Upload capped to 0 KB/s | Options → Speed → set a small but non-zero number |
| Files stall at 99 % | Rare pieces; not enough complete seeders | Patience or choose a healthier torrent |
| High CPU in VM | Too many connections | Limit global peers (e.g., 200) |
6. Recap & Homework
✔ You installed an open-source BitTorrent client, used a VPN safely, downloaded + verified Ubuntu, and contributed back to the swarm.
Homework (pick one):
A) Seed to a 2.0 ratio overnight.
B) Install transmission-cli and script a headless download of another FOSS ISO.
C) Write a 1-paragraph reflection: “Is BitTorrent inherently illegal? Why/why not?”
7. Exit Ticket
Before you ghost the Zoom room, tell me in chat:
1️⃣ One new thing you learned today.
2️⃣ One question still on your mind.
See you next lab, where we’ll peek at trackerless torrents and WebTorrent in the browser. ✌️