🧠 OpenWrt Router – Extended Capabilities with USB Drive

🧰 System Preparation πŸ”§πŸ“¦πŸ› οΈ

1. Install Common Packages πŸ”„πŸ“₯🧱

opkg update
opkg install bash python3 php8-cli git block-mount kmod-usb-storage kmod-fs-ext4 e2fsprogs

2. Mount USB Drive πŸ“‚πŸ”ŒπŸ—ƒοΈ

mkdir -p /mnt/usb
mount /dev/sda1 /mnt/usb

Optional: Use block detect | uci import fstab and block mount for automatic mounting. πŸ§­πŸ›œβš™οΈ

πŸš€ Use Cases with the 256GB Flash Drive πŸ’½πŸš€πŸ“Š

1. ExtRoot (Expand System Storage) πŸ’‘πŸ’ΎπŸ“ˆ

  • Move root filesystem to USB drive.
  • Follow OpenWrt guide for extroot.
  • Useful if router flash is limited (e.g., < 20MB free).

2. Script Hosting πŸ“œπŸ”πŸ“‚

  • Store bash, PHP, or Python scripts under /mnt/usb/scripts
  • Execute with:
bash /mnt/usb/scripts/myscript.sh
python3 /mnt/usb/scripts/tool.py
php /mnt/usb/scripts/monitor.php

3. Git Projects πŸ”§πŸ”πŸ“

  • Store and version scripts or configurations:
cd /mnt/usb/projects
git clone https://github.com/your/repo.git
  • Install with:
opkg install git git-http ca-bundle

πŸ“ Blog Entry: How to Use Git on Your OpenWrt Router πŸ“‘πŸ§ πŸ§°

✨ Why Git on Your Router?

If you're running OpenWrt on a powerful router like the Linksys WRT3200ACM, you can do more than just route traffic β€” you can manage your own infrastructure scripts using Git! πŸ’‘βš™οΈ

This guide shows how to install Git, clone repositories, and run bash scripts from a USB drive.

🧰 Step 1: Install Git

SSH into your router and install the required packages:

opkg update
opkg install git git-http ca-bundle
  • git: Git core
  • git-http: Enables cloning over HTTPS
  • ca-bundle: Ensures SSL works with GitHub

πŸ’½ Step 2: Prepare a Workspace on USB

Assuming your USB is mounted at /mnt/usb:

mkdir -p /mnt/usb/projects
cd /mnt/usb/projects

🌐 Step 3: Clone a Repository

Public Repo:

git clone https://github.com/your-username/your-repo.git

Private Repo with Access Token:

git clone https://your-username:your-token@github.com/your-username/your-repo.git

πŸ” Be cautious: avoid storing tokens in plaintext

Optional (Advanced): Use SSH keys

Generate a key:

ssh-keygen -t ed25519 -C "router@openwrt"

Add it to GitHub: GitHub SSH Keys

Then clone:

git clone git@github.com:your-username/your-repo.git

βš™οΈ Step 4: Run Your Scripts

Navigate and run as needed:

cd /mnt/usb/projects/your-repo
bash your-script.sh

🧹 Optional: Remove Git After Cloning

To free space:

opkg remove git git-http

With Git and a USB drive, your router becomes a programmable, self-updating automation hub. πŸŽ―πŸ’»πŸ”

Let me know if you'd like to automate repo pulls on boot or cron! πŸ•’πŸ€–

4. Local Web Server 🌐πŸ–₯οΈπŸ“‘

  • Install uhttpd:
opkg install uhttpd php8-cgi
  • Point document root to /mnt/usb/www
  • Example:
echo '<?php phpinfo(); ?>' > /mnt/usb/www/index.php

5. Media Server (DLNA) πŸ“ΊπŸŽΆπŸ—ƒοΈ

  • Install and configure:
opkg install minidlna
  • Set media_dir=/mnt/usb/media in config.

6. Ad-Block DNS Server πŸš«πŸ“‘πŸ”

  • Use adblock or banIP with dnsmasq.
  • Store blocklists on USB.

7. Download Center πŸ“₯πŸ’ΎπŸ§²

  • Install and run aria2 or transmission-daemon:
opkg install aria2
aria2c --dir=/mnt/usb/downloads --input-file=/mnt/usb/urls.txt

8. Packet Capture / Network Audit πŸ“ŠπŸ“‘πŸ”Ž

  • Install tcpdump:
opkg install tcpdump
  • Use for auditing:
tcpdump -i br-lan -w /mnt/usb/lan_traffic.pcap

9. VPN/Proxy πŸ•΅οΈπŸ”πŸŒ

  • Store OpenVPN/WireGuard configs.
  • Use nginx or haproxy as local reverse proxy.

10. Cron Jobs (Automation) β°πŸ“†πŸ€–

  • Add script to /mnt/usb/scripts/backup.sh
  • Schedule via cron:
crontab -e
0 3 * * * /mnt/usb/scripts/backup.sh

πŸ” Optional Projects πŸ§ͺπŸ§±πŸ›°οΈ

  • SSH Honeypot (kippo)
  • Pi-hole alternative with DNS filtering
  • Tor proxy routing
  • Prometheus metrics exporter

πŸ“Š Is My Router Powerful Enough? πŸ€”πŸ“‘πŸ’ͺ

If you're using the Linksys WRT3200ACM, you're working with a beast of a router compared to most consumer devices! πŸ—βš‘ It packs a dual-core 1.8 GHz ARM CPU and 512 MB of RAM – more than enough for scripting, VPNs, lightweight servers, and network monitoring. πŸ§ πŸ’»πŸ›‘οΈ

But how does it compare with others?

Router Model CPU & RAM OpenWrt Support Notes
WRT3200ACM 1.8 GHz dual, 512MB βœ… Excellent Powerful, flexible, OpenWrt-ready πŸ’Ž
Netgear R7800 1.7 GHz dual, 512MB βœ… Excellent Similar strength, better wireless 🌐
TP-Link Archer C7 720 MHz, 128MB βœ… Good Budget-friendly, limited headroom πŸ’Έ
NanoPi R5S/R4S 1.6 GHz quad, 4GB+ βœ… with FriendlyWrt Mini server-class board πŸ”¬
Raspberry Pi 4 1.5 GHz quad, 2–8GB βœ… (custom) Not a router, but great for services πŸ§ƒ

The WRT3200ACM is an ideal match for OpenWrt power users who want to script, route securely, filter content, and run small services from one place. πŸŽ―πŸŒπŸ“‘

πŸ” How to Monitor Resource Usage

Want to keep an eye on performance? πŸ‘€πŸ“ˆ Try these tools:

  • top – Built-in, simple live stats
  • htop – Install via opkg install htop for colorful interactive view 🎨
  • df -h – Monitor flash & USB usage
  • luci-app-statistics – Visual charts in LuCI interface πŸ“Š
  • vnstat – Track bandwidth over time 🌐

🌐 What’s Next? Time to Think Bigger with Docker! πŸ³πŸ§±πŸ’‘

If your needs grow beyond what your router can comfortably handle, it might be time to explore Docker-based hosting. We'll look into affordable, low-resource VPS options and what it takes to deploy containers with ease. πŸ’°πŸš€βš™οΈ

πŸ‘‰ Stay tuned for: "Docker Hosting Options for Lightweight Projects" πŸ› οΈπŸŒπŸ§

βœ… Final Notes πŸ“βš οΈπŸ“Œ

  • Make sure USB is properly unmounted before removing.
  • You can use symbolic links from /etc/ to /mnt/usb/ for configuration management.
  • Consider using logrotate to avoid log overflow. πŸ”πŸ“ŠπŸ§Ή

Would you like a tutorial for any of these use cases? πŸ€”πŸ“˜πŸ“ž