OpenWrt Guide: English | δΈζ
A high-performance Go rewrite of the original shell-based cake-autortt tool. This service automatically adjusts CAKE qdisc RTT parameters based on real-time network measurements, providing optimal bufferbloat control for dynamic network conditions.
- High Performance: Go implementation with concurrent TCP-based RTT measurements
- Smart Host Discovery: Automatically extracts active hosts from conntrack
- Interface Auto-Detection: Automatically detects CAKE-enabled interfaces during installation
- Real-time Web Interface: Dark-themed web UI for monitoring system status and logs
- WebSocket Support: Live updates without manual page refresh
- Configurable Thresholds: Flexible min/max host limits and RTT margins
- Multiple Deployment Options: Native binary, Docker, or OpenWrt package
- Real-time Monitoring: Debug mode with detailed logging
- Production Ready: Comprehensive error handling and graceful shutdown
- Zero-Touch Installation: Fully automated setup with service management
- Linux system with CAKE qdisc support
tc(traffic control) utility/proc/net/nf_conntrack(netfilter connection tracking)- Root privileges for network interface management
- OpenWrt 24.10.1+ (primary target)
- Ubuntu 20.04+
- Debian 11+
- Alpine Linux
- Any Linux distribution with CAKE support
The preferred installation method is to compile and install the project locally on your device. This avoids potential issues with CI-built binaries (for example, Go embed differences across environments) and ensures the binary is built for the target system.
- Clone the repository:
git clone https://github.com/galpt/go-cake-autortt.git- Change into the repository directory:
cd go-cake-autortt- Make the install scripts executable:
chmod +x install.sh install-compile.sh uninstall.sh- Run the compile-and-install script (run as root):
# On most Linux systems
sudo ./install-compile.sh
# On OpenWrt (run as root)
./install-compile.shThe install-compile.sh script will attempt to ensure Go is installed, compile the local source tree, and install the resulting binary as a system service (OpenWrt init.d or systemd), creating a default YAML configuration file.
The installation script provides a zero-touch experience - it automatically:
- Downloads and installs the binary
- Creates optimized YAML configuration with auto-detected interfaces
- Sets up system service (OpenWrt init.d or systemd)
- Enables automatic startup on boot
- Starts the service immediately
For most Linux distributions:
# One-command installation with full automation
curl -fsSL https://raw.githubusercontent.com/galpt/go-cake-autortt/main/install.sh | sudo bashFor OpenWrt (run as root, no sudo needed):
# One-command installation for OpenWrt
curl -fsSL https://raw.githubusercontent.com/galpt/go-cake-autortt/main/install.sh | ashWhat happens during installation:
- β
Checks system dependencies (
tc,wget/curl) - β Downloads the correct binary for your architecture
- β
Installs binary to
/usr/bin/cake-autortt - β
Creates
/etc/cake-autortt.yamlwith auto-detected CAKE interfaces - β Installs appropriate service (init.d for OpenWrt, systemd for others)
- β Enables service for automatic startup
- β Starts the service immediately
- β Displays service management commands and web interface URL
After installation, access the web interface at: http://your-router-ip:11111
If you prefer manual installation:
-
Download the latest release:
wget https://github.com/galpt/go-cake-autortt/releases/latest/download/cake-autortt-linux-amd64.tar.gz tar -xzf cake-autortt-linux-amd64.tar.gz sudo install -m 755 cake-autortt-linux-amd64 /usr/bin/cake-autortt
-
Create configuration file:
sudo tee /etc/cake-autortt.yaml > /dev/null << EOF # RTT measurement settings rtt_update_interval: 5 min_hosts: 3 max_hosts: 100 rtt_margin_percent: 10 default_rtt_ms: 100 tcp_connect_timeout: 3 max_concurrent_probes: 50 # Network interfaces (configure your CAKE interfaces) dl_interface: "" # e.g., "ifb-wan" for download ul_interface: "" # e.g., "wan" for upload # Web interface web_enabled: true web_port: 11111 # Logging debug: false EOF
-
Configure interfaces:
# Edit the config to set your CAKE interfaces sudo nano /etc/cake-autortt.yaml -
Run manually or set up service:
# Test run sudo cake-autortt --config /etc/cake-autortt.yaml
# Pull the image
docker pull arasseo/go-cake-autortt:latest
# Create config file
mkdir -p ./config
wget https://raw.githubusercontent.com/galpt/go-cake-autortt/main/etc/cake-autortt.yaml -O ./config/cake-autortt.yaml
# Run with host networking (required for interface access)
docker run -d --name cake-autortt \
--network host \
--privileged \
-v $(pwd)/config/cake-autortt.yaml:/etc/cake-autortt.yaml:ro \
-v /proc/net/nf_conntrack:/proc/net/nf_conntrack:ro \
arasseo/go-cake-autortt:latestThe application uses YAML configuration only (simplified from previous UCI+YAML approach).
# RTT measurement settings
rtt_update_interval: 5 # seconds between qdisc RTT updates
min_hosts: 3 # minimum number of hosts needed for RTT calculation
max_hosts: 100 # maximum number of hosts to probe simultaneously
rtt_margin_percent: 10 # percentage margin added to measured RTT
default_rtt_ms: 100 # default RTT in case no hosts are available
tcp_connect_timeout: 3 # TCP connection timeout for RTT measurement
max_concurrent_probes: 50 # maximum concurrent TCP probes
# Network interfaces (auto-detected during installation)
dl_interface: "ifb-wan" # download interface with CAKE qdisc
ul_interface: "wan" # upload interface with CAKE qdisc
# Logging
debug: false # enable debug logging
# Web interface
web_enabled: true # enable web server
web_port: 11111 # web server portAuto-detection (Default): The installation script automatically detects interfaces with CAKE qdisc and configures them.
Manual Configuration:
dl_interface: Usuallyifb-wanor similar IFB interface for download shapingul_interface: Usuallywan,eth1, or your WAN interface for upload shaping
To find your CAKE interfaces:
# List all interfaces with CAKE qdisc
tc qdisc show | grep cake# Run with default config
sudo cake-autortt
# Run with custom config file
sudo cake-autortt --config /path/to/config.yaml
# Override config options
sudo cake-autortt --web-port 8080 --debug
# Show version
cake-autortt --version
# Show help
cake-autortt --helpThe automated installation sets up the service for you. Here are the management commands:
OpenWrt:
# Service management
/etc/init.d/cake-autortt start
/etc/init.d/cake-autortt stop
/etc/init.d/cake-autortt restart
/etc/init.d/cake-autortt status
# View logs
logread | grep cake-autorttSystemd (Ubuntu, Debian, etc.):
# Service management
sudo systemctl start cake-autortt
sudo systemctl stop cake-autortt
sudo systemctl restart cake-autortt
sudo systemctl status cake-autortt
# View logs
sudo journalctl -u cake-autortt -fAfter modifying /etc/cake-autortt.yaml, restart the service:
# OpenWrt
/etc/init.d/cake-autortt restart
# Systemd
sudo systemctl restart cake-autorttThe easiest way to monitor cake-autortt:
- Navigate to
http://your-router-ip:11111 - View real-time system status, RTT measurements, and logs
- Monitor CAKE qdisc statistics with live updates
- No need to SSH into the router for basic monitoring
Enable debug mode for detailed operation logs:
# Edit config file
sudo nano /etc/cake-autortt.yaml
# Set: debug: true
# Restart service
sudo systemctl restart cake-autortt # or /etc/init.d/cake-autortt restartExample debug output:
2024/01/15 10:30:15 [INFO] Starting cake-autortt v2.1.0
2024/01/15 10:30:15 [INFO] Auto-detected interfaces: dl=ifb-wan, ul=wan
2024/01/15 10:30:15 [INFO] Extracted 45 hosts from conntrack
2024/01/15 10:30:18 [INFO] Measured RTT: avg=25ms, worst=45ms (from 12 responsive hosts)
2024/01/15 10:30:18 [INFO] Adjusted CAKE RTT to 50ms (45ms + 10% margin)
1. Service not starting after installation:
# Check service status
systemctl status cake-autortt # or /etc/init.d/cake-autortt status
# Check configuration
sudo cake-autortt --config /etc/cake-autortt.yaml --debug2. No CAKE interfaces detected:
# Check if CAKE qdisc is configured
sudo tc qdisc show | grep cake
# Configure CAKE on interface (example)
sudo tc qdisc add dev wan root cake bandwidth 100mbit3. Web interface not accessible:
# Check if service is running
sudo systemctl status cake-autortt
# Check firewall (if applicable)
sudo ufw allow 11111 # Ubuntu/Debian4. Permission denied:
# Ensure binary has correct permissions
sudo chmod 755 /usr/bin/cake-autortt
# Check config file permissions
sudo chmod 644 /etc/cake-autortt.yaml# Test configuration
sudo cake-autortt --config /etc/cake-autortt.yaml --debug
# Check current CAKE settings
sudo tc qdisc show | grep cake
# Check active connections
sudo cat /proc/net/nf_conntrack | head -10
# Verify interfaces
ip link showIf the service fails to start automatically after installation, you can run the program manually in the background:
For OpenWrt:
# 1. Clone the repository
git clone https://github.com/galpt/go-cake-autortt.git
cd go-cake-autortt
# 2. Make scripts executable
chmod +x install.sh uninstall.sh
# 3. Run the installation script
./install.sh
# 4. If service doesn't start automatically, run manually in background
/usr/bin/cake-autortt &
# 5. To stop the background process
killall cake-autortt
# 6. To uninstall completely
./uninstall.shFor other Linux distributions:
# 1. Clone the repository
git clone https://github.com/galpt/go-cake-autortt.git
cd go-cake-autortt
# 2. Make scripts executable
chmod +x install.sh uninstall.sh
# 3. Run the installation script
sudo ./install.sh
# 4. If service doesn't start automatically, run manually in background
sudo /usr/bin/cake-autortt &
# 5. To stop the background process
sudo killall cake-autortt
# 6. To uninstall completely
sudo ./uninstall.shIf you encounter issues, you can safely reinstall:
# The script will backup existing config and reinstall
curl -fsSL https://raw.githubusercontent.com/galpt/go-cake-autortt/main/install.sh | sudo bash- Go 1.21 or later
- Git
# Clone repository
git clone https://github.com/galpt/go-cake-autortt.git
cd go-cake-autortt
# Download dependencies
go mod download
# Build for current platform
go build -o cake-autortt .
# Build for specific platform
GOOS=linux GOARCH=mips go build -o cake-autortt-mips .
# Build all platforms (requires make)
make build-alllinux/amd64- x86_64 Linuxlinux/arm64- ARM64 Linuxlinux/armv7- ARMv7 Linuxlinux/armv6- ARMv6 Linuxlinux/mips- MIPS Linux (OpenWrt)linux/mipsle- MIPS Little Endianlinux/mips64- MIPS64linux/mips64le- MIPS64 Little Endian
Contributions are welcome! Please read our Contributing Guide for details.
# Clone and setup
git clone https://github.com/galpt/go-cake-autortt.git
cd go-cake-autortt
go mod download
# Run tests
go test ./...
# Run linter
golangci-lint run
# Format code
go fmt ./...This project is licensed under the GNU General Public License v2.0 - see the LICENSE file for details.
- OpenWrt community for CAKE qdisc development
- Go community for excellent networking libraries
- Issues: GitHub Issues
- Documentation: OpenWrt Installation Guide
- cake-autortt (Shell Script) - Original shell script version
- cake-autorate - Automatic CAKE bandwidth adjustment
- OpenWrt - Linux distribution for embedded devices
- CAKE qdisc - Comprehensive queue management
Star β this repository if you find it useful!
