OpenWRT /bin/sh script to quickly install Outline (Shadowsocks) with xjasonlyu/tun2socks
Ultra-simple one-liner - downloads and runs automatically:
sh -c "$(wget -qO- https://raw.githubusercontent.com/Rushan4eg/openwrt-quick-outline/main/install_outline.sh)"Or download first, then run:
wget -q https://raw.githubusercontent.com/Rushan4eg/openwrt-quick-outline/main/install_outline.sh -O ./install_outline.sh && chmod +x ./install_outline.sh && echo "Ready! Run with: ./install_outline.sh"
./install_outline.sh- Any OpenWRT version (tested on 19.07, 21.02, 22.03, 23.05+)
- At least 9 MiB of free space on
/(for permanent installation) - Router with minimum 128 MB RAM recommended
- Required packages (script will check for these):
opkg update opkg install kmod-tun ip-full
Edit the script and set your Outline config at the top:
PRESET_OUTLINE_CONFIG="ss://your_base64_config@your.server.com:8080/?outline=1"When set, the script runs completely unattended.
Leave PRESET_OUTLINE_CONFIG empty and the script will prompt for:
- Outline (Shadowsocks) config in
ss://base64coded@HOST:PORT/?outline=1format - Default gateway choice - whether to route all traffic through Outline (y/n)
Note: Server IP is automatically extracted from the ss:// config - no need to enter it separately!
- Checks dependencies (kmod-tun, ip-full)
- Downloads tun2socks binary for your router architecture
- Configures network interface (
tun1with IP 172.16.10.1/30) - Sets up firewall rules (creates 'proxy' zone and forwarding)
- Creates system service (
/etc/init.d/tun2socks) with auto-start - Intelligently restarts network only when needed (fixes SSH disconnection issues)
- Starts Outline service and optionally sets as default gateway
For devices with less than 9 MB free space but 40+ MB RAM:
wget https://raw.githubusercontent.com/1andrevich/outline-install-wrt/main/install_outline_ram.sh -O install_outline_ram.sh
chmod +x install_outline_ram.sh
./install_outline_ram.sh# Start/stop service
/etc/init.d/tun2socks start
/etc/init.d/tun2socks stop
# Enable/disable auto-start
/etc/init.d/tun2socks enable
/etc/init.d/tun2socks disable
# Check status
/etc/init.d/tun2socks statusThis version fixes the SSH disconnection issue that occurred on subsequent script runs. The script now:
- Only restarts network when actual changes are made
- Adds stabilization delays
- Prevents unnecessary configuration reloads
For maximum reliability during network changes:
opkg install screen
screen -S outline
# Run installer here
# Press Ctrl+A, then D to detach if needed
# Reconnect with: screen -r outlineIf you have problems accessing raw.githubusercontent.com, try the mirror: SourceForge Project
Get your Outline config from the Outline client:
- Format:
ss://base64coded@HOST:PORT/?outline=1 - Example:
ss://Y2hhY2hhMjAtaWV0Zi1wb2x5MTMwsadfasdfsafdSDNWYW9AMTkyLjI0MS4xNTQuMTc6ODA4Mw/?outline=1
The script automatically extracts the server IP from this config, so you only need to provide the ss:// URL.