π§ 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
andblock 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 coregit-http
: Enables cloning over HTTPSca-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
orbanIP
withdnsmasq
. - Store blocklists on USB.
7. Download Center π₯πΎπ§²
- Install and run
aria2
ortransmission-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
orhaproxy
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 statshtop
β Install viaopkg install htop
for colorful interactive view π¨df -h
β Monitor flash & USB usageluci-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? π€ππ