A modern, graphical interface for managing Linux network traffic control (tc) with network namespace support. Built with Rust, featuring a split-architecture design for security and performance.
- 🏛️ Simple Traffic Control: One-click feature toggles for
tc netem- no complex workflows - ⚡ Instant Application: Check a feature checkbox and it applies immediately - no "Apply" buttons
- 🎯 Complete TC Features: Loss, Delay, Duplicate, Reorder, Corrupt, and Rate Limiting with full parameter control
- 📊 Network Namespace Support: Monitor and control interfaces across multiple network namespaces
- 🎯 Comprehensive Interface Types: Supports Physical, Virtual, Veth, Bridge, TUN, TAP, and Loopback interfaces
- 📋 Scenario Templates: Built-in templates for common network testing patterns
- 🚀 Fast Network Degradation: 30-second rapid testing scenario with 10 progressive steps
- 📱 Mobile Device Simulation: Progressive signal degradation as device moves away from base station
- 🌐 Network Congestion: Daily usage patterns with varying congestion levels
- 🔌 Intermittent Connectivity: Connection drops and recovery patterns
- 🎯 Interface Selection: Interactive dialog to choose target namespace and interface
- 🔄 Real-time Execution: Live step progression with visual feedback in UI
- ⏯️ Execution Control: Pause, resume, and stop running scenarios
- 🔄 Auto-refresh: Scenarios automatically reload when switching to Scenarios tab
- ⚡ Real-time Monitoring: Live bandwidth monitoring with automatic unit formatting (B/s, KB/s, MB/s, GB/s)
- 🌐 Modern UI: Built with Iced for responsive, native performance with tabbed interface
- 📈 Rate Calculations: Real-time bandwidth rate monitoring with counter wraparound handling
- 🎮 Active Executions: Live monitoring of running scenarios with progress tracking
- 📊 Step Progression: Real-time step counter showing current progress ("Step 3/10")
- 🔒 Security-First Architecture: Privilege separation with frontend/backend split
- 🌐 Multi-Backend Support: Named backend instances for distributed deployments
- 📡 Modern Communication: Zenoh pub/sub + query/reply patterns for scalable messaging
- 🛡️ Permission Handling: Graceful handling of namespace access restrictions
- 🔧 Fixed TC Synchronization: Scenario execution properly updates frontend UI in real-time
TC GUI uses a modern split-binary architecture with separate pub/sub and query/reply communication patterns:
┌───────────────────────┐ Zenoh Topics ┌──────────────────────┐
│ Frontend (GUI) │ ◄─────────────────── │ Backend (Root) │
│ │ │ │
│ • Tabbed Interface │ Pub/Sub Topics: │ • Network Operations │
│ • Scenario Manager │ • Interface Lists │ • TC Command Exec │
│ • Interface Dialog │ • Bandwidth Stats │ • Scenario Engine │
│ • Real-time Stats │ • Execution Updates │ • Template System │
│ • Progress Monitor │ • Health Status │ • Multi-NS Support │
│ • No Privileges │ • Interface Events │ • Bandwidth Monitor │
│ │ │ │
│ │ Query/Reply: │ │
│ │ • TC Operations ──► │ │
│ │ • Scenario Ops ──► │ │
│ │ • Interface Ctrl ──►│ │
└───────────────────────┘ └──────────────────────┘
- Frontend (
tcgui-frontend): Unprivileged GUI application for user interaction - Backend (
tcgui-backend): Privileged service handling network operations - Shared (
tcgui-shared): Common message types and communication protocol
Pub/Sub Topics (Backend → Frontend):
tcgui/{backend}/interfaces/list- Interface discovery updatestcgui/{backend}/bandwidth/{namespace}/{interface}- Real-time bandwidth statisticstcgui/{backend}/interfaces/events- Interface state changestcgui/{backend}/health- Backend health status
Query/Reply Services (Frontend → Backend):
tcgui/{backend}/query/tc- Traffic control operationstcgui/{backend}/query/interface- Interface enable/disable operations
- Linux System (tested on Fedora Linux)
- Rust 1.70+ with edition 2024 support
justcommand runner (install with:sudo dnf install just)- Linux capabilities support (CAP_NET_ADMIN)
- Network namespaces support (optional, for advanced features)
-
Install prerequisites and clone:
# Install just command runner # Fedora/RHEL: sudo dnf install just # Ubuntu/Debian: # sudo apt install just # Arch: # sudo pacman -S just # Or install from source: # cargo install just # Clone and setup git clone https://github.com/your-username/tcgui.git cd tcgui just setup
-
Run the application:
just run
That's it! The frontend automatically spawns and manages the backend process.
If you prefer manual control:
-
Build and set capabilities:
just build-backend just set-caps
-
Run backend manually:
just run-backend # OR directly: ./target/release/tcgui-backend --exclude-loopback --verbose --name trefze3 -
Run frontend (separate terminal):
./target/debug/tcgui-frontend --verbose # OR with automatic backend spawning: ./target/debug/tcgui-frontend --backend trefze3 --verbose
# Quick Development Workflows
just dev # Complete development cycle (format, check, lint, test)
just dev-fast # Ultra-fast cycle (format, fast-lint, test) - 60% faster
just dev-minimal # Minimal cycle (format, test only) - ~2 seconds
just dev-backend # Backend-only development cycle
just dev-frontend # Frontend-only development cycle
# Build Commands
just build # Build all components
just build-backend # Build backend only
just build-frontend # Build frontend only
just build-release # Build all components (release mode)
# Quality Assurance
just quality # Full quality verification pipeline
just pre-commit # Pre-commit quality gate
just test # Full test suite
just test-fast # Fast test suite (lib targets only)
just clippy # Lint analysis (strict mode)
just clippy-fast # Fast lint analysis (lib targets only)
just coverage # Code coverage analysis
just security # Security vulnerability audit
# Package Generation
just package # Generate all packages (DEB + RPM)
just package-deb # Generate DEB packages only
just package-rpm # Generate RPM packages only
just list-packages # List generated packages
just validate-packages # Validate package structure
just test-packages # Test package installation (requires sudo)
# Local CI Testing
just local-ci # Docker-free CI simulation
just local-check # Fast local quality checks
just validate-workflows # Validate GitHub Actions workflows
# Run Commands
just run # Run frontend with auto backend
just run-backend # Run backend manually
# Setup and Maintenance
just setup-tools # Install all quality tools
just setup-packaging-tools # Install DEB/RPM packaging tools
just setup # Complete setup (build + capabilities)
just clean # Clean build artifacts
just help # Show detailed help-
Launch the application:
just run # Automatic backend + frontend -
Choose your workflow:
- Manual Traffic Control: Direct interface configuration
- Network Scenarios: Automated network condition sequences
-
Navigate to Scenarios tab (scenarios auto-load)
-
Choose a scenario template:
- Fast Network Degradation: 30-second demo with 10 progressive steps
- Mobile Device Simulation: Signal degradation over 2 minutes
- Network Congestion: 5-minute congestion patterns
- Intermittent Connectivity: Connection drop patterns
- Quality Degradation: Gradual service quality decline
-
Execute a scenario:
- Click "
▶️ Execute" on any scenario - Select interface: Choose namespace and target interface from dialog
- Click "Execute Scenario" to start
- Click "
-
Monitor execution:
- Watch "Active Executions" section for progress
- Observe step progression: "Step 3/10 (45.2%)"
- See real-time UI updates: checkboxes and sliders reflect current TC state
- Use execution controls: ⏸️ Pause,
▶️ Resume, ⏹️ Stop
- Navigate to Interfaces tab
- Select a network interface from the namespace-grouped list
- Configure traffic control features:
- Loss (LSS): Check to enable packet loss, adjust percentage (0-100%) and correlation
- Delay (DLY): Check to enable packet delay, set base delay, jitter, and correlation
- Duplicate (DUP): Check to enable packet duplication with percentage and correlation
- Reorder (RO): Check to enable packet reordering with percentage, correlation, and gap
- Corrupt (CR): Check to enable packet corruption with percentage and correlation
- Rate Limit (RL): Check to enable bandwidth limiting in kbps
- Features apply immediately when checked - no separate "Apply" button needed
- Monitor results in the status messages and interface icons
- Remove features by unchecking their checkboxes
The GUI automatically discovers and displays interfaces grouped by network namespace:
- Default namespace: Standard system interfaces
- Named namespaces: Custom network namespaces (if any exist)
- Real-time updates: Interface changes are reflected automatically
- Live statistics: Real-time RX/TX bandwidth rates calculated from
/proc/net/dev - Comprehensive metrics: Bytes, packets, errors, and drops tracking
- Automatic formatting: Units automatically scaled (B/s, KB/s, MB/s, GB/s)
- Namespace isolation: Statistics tracked per namespace+interface key
- Rate calculations: Proper handling of counter wraparounds and time deltas
- 2-second intervals: Regular updates without overwhelming the system
tcgui/
├── Cargo.toml # Workspace configuration
├── tcgui-shared/ # Shared library
│ ├── Cargo.toml
│ └── src/
│ ├── lib.rs # Message protocol & types
│ └── errors.rs # Error handling
├── tcgui-backend/ # Privileged backend
│ ├── Cargo.toml
│ └── src/
│ ├── main.rs # Backend service
│ ├── network.rs # Interface monitoring
│ ├── tc_commands.rs # TC command execution
│ └── bandwidth.rs # Bandwidth monitoring
└── tcgui-frontend/ # GUI frontend
├── Cargo.toml
└── src/
├── main.rs # Application entry
├── app.rs # Main application logic
├── interface.rs # Interface component
├── messages.rs # Message types
└── zenoh_manager.rs # Communication layer
# Check all crates
cargo check --workspace
# Build all crates
cargo build --workspace
# Run tests
cargo test --workspace
# Lint with clippy
cargo clippy --workspace
# Format code
cargo fmt --all
# Build documentation
cargo doc --workspace --open- Rust: Systems programming language
- Iced: Native GUI framework
- Zenoh: High-performance pub-sub messaging
- rtnetlink: Linux netlink interface
- tokio: Async runtime
- Frontend: Runs as regular user, no elevated permissions
- Backend: Uses Linux capabilities (
CAP_NET_ADMIN) instead of root - Communication: Secure pub-sub messaging via Zenoh
- Read-Only Frontend: Cannot create/modify network namespaces
- Automatic Cleanup: Frontend manages backend lifecycle when using
--backend
Instead of running the backend as root, TC GUI uses Linux capabilities for enhanced security:
# Set capabilities (done automatically by 'just set-caps')
sudo setcap cap_net_admin+ep target/release/tcgui-backend
# Verify capabilities
getcap target/release/tcgui-backend
# Output: target/release/tcgui-backend cap_net_admin=epBenefits of capabilities over root:
- ✅ Principle of least privilege: Only network admin capabilities
- ✅ Enhanced security: Cannot access files, processes, or other system resources
- ✅ User-friendly: Regular users can run the backend without sudo
- ✅ Audit trail: Capability usage is logged by the kernel
The backend handles all privileged operations:
- Interface discovery via rtnetlink
- TC command execution (no sudo required with capabilities)
- Network namespace monitoring
- Bandwidth statistics collection
- ✅ Discover existing namespaces automatically
- ✅ Monitor interfaces across all namespaces
- ✅ Apply TC netem to interfaces in any namespace
- ✅ Real-time interface updates per namespace
- ❌ Create/delete namespaces (read-only design)
- ❌ Create virtual interfaces (read-only design)
- Physical: eth0, wlan0, etc.
- Virtual: veth pairs, bridges
- Loopback: lo interface
- TUN/TAP: Virtual network devices
- Interface Status: UP/DOWN state monitoring
- Bandwidth Tracking: RX/TX bytes and packets per second
- TC Configuration: Detection of active netem rules
- Namespace Changes: Dynamic interface discovery
- Low Latency: Sub-second update intervals
- Efficient Updates: Only changed data transmitted
- Scalable: Supports many interfaces across namespaces
-
Backend won't start:
- Check capabilities are set:
just check-caps - Set capabilities if missing:
just set-caps - Check Zenoh port availability (default ports)
- Check capabilities are set:
-
Permission denied errors:
- Verify capabilities:
getcap target/release/tcgui-backend - Re-set capabilities:
just set-caps - For debug builds:
just set-caps-debug
- Verify capabilities:
-
Frontend can't connect:
- Verify backend is running:
ps aux | grep tcgui-backend - Check firewall settings
- Enable verbose logging:
just run(includes verbose output)
- Verify backend is running:
-
TC commands failing:
- Ensure
tcutility is installed:which tc - Check capabilities instead of sudo permissions
- Verify interface exists:
ip link show
- Ensure
-
No interfaces visible:
- Confirm backend has capabilities:
just check-caps - Check rtnetlink permissions
- Verify network interfaces exist:
ip link show
- Confirm backend has capabilities:
Enable detailed logging for troubleshooting:
# Easy debugging with just
just run # Frontend with auto-backend (verbose)
just run-backend # Backend only (verbose)
# Manual debugging
RUST_LOG=debug ./target/release/tcgui-backend --verbose --name trefze3
RUST_LOG=debug ./target/debug/tcgui-frontend --backend trefze3 --verbose# Check current capabilities
just check-caps
# Remove and re-set capabilities
just remove-caps
just set-caps
# Verify tc command works without sudo
./target/release/tcgui-backend --helpTC GUI provides native packages for major Linux distributions:
# Install both backend and frontend packages
sudo rpm -i tcgui-backend-*.rpm tcgui-frontend-*.rpm
# Enable and start the backend service
sudo systemctl enable --now tcgui-backend
# Launch the GUI application
tcgui-frontend# Install both packages
sudo dpkg -i tcgui-backend_*.deb tcgui-frontend_*.deb
sudo apt-get install -f # Fix any missing dependencies
# Enable and start the backend service
sudo systemctl enable --now tcgui-backend
# Launch the GUI application
tcgui-frontend- 🔒 Secure System Integration: Systemd service with security hardening
- 🔧 Automatic Setup: Sudoers configuration for network operations
- 🖥️ Desktop Integration: Menu entry and application icon
- 📋 Complete Documentation: Comprehensive man pages and README files
- ⚡ Easy Installation: Single-command installation with dependency resolution
Developers can build packages locally:
# Install packaging tools
just setup-packaging-tools
# Generate all packages (DEB + RPM)
just package
# Generate specific formats
just package-deb # Debian/Ubuntu packages
just package-rpm # Fedora/RHEL packages
# List generated packages
just list-packages
# Test package installation (requires sudo)
just test-packagesTC GUI implements a rigorous quality assurance system with:
- 🚫 Zero Tolerance: Zero compiler warnings, zero clippy issues, zero dead code
- ⚡ Fast Feedback: Ultra-fast development workflows (2-30 seconds)
- 🔐 Security First: Automated security vulnerability scanning
- 📊 Full Coverage: Code coverage analysis and testing
- 🚀 Local CI: Docker-free local testing that mimics GitHub Actions
# Ultra-fast iteration (2 seconds)
just dev-minimal # Format + tests only
# Balanced development (30 seconds)
just dev-fast # Format + fast-lint + tests
# Complete validation (80 seconds)
just dev # Format + check + lint + tests
# Component-specific
just dev-backend # Backend development only
just dev-frontend # Frontend development only- Code Formatting:
cargo fmtwith consistent style - Compilation: Zero warnings policy with
cargo check - Linting: Strict
cargo clippyanalysis - Testing: Comprehensive test suite with
cargo test - Coverage: Code coverage with
cargo-tarpaulin
- Security Audit:
cargo auditfor vulnerability scanning - Dependency Analysis:
cargo denyfor license and security - Unused Dependencies:
cargo udepsfor cleanup - Dead Code Analysis:
cargo machetefor elimination - Outdated Dependencies:
cargo outdatedfor updates
- Memory Safety: Miri verification for unsafe code
- Documentation: Complete API docs with
cargo doc - Performance: Benchmarking and optimization analysis
Test your changes locally without Docker:
# Complete CI simulation
just local-ci
# Fast quality checks
just local-check
# Validate GitHub Actions workflows
just validate-workflows
# Component-specific testing
./scripts/local-ci.sh backend # Backend only
./scripts/local-ci.sh frontend # Frontend only
./scripts/local-ci.sh security # Security analysis# Pre-commit quality gate
just pre-commit # Essential checks before commit
# Pre-push verification
just pre-push # Comprehensive checks before push
# Complete quality pipeline
just quality # Full verification (matches CI)- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Run tests:
cargo test --workspace - Check formatting:
cargo fmt --all - Run clippy:
cargo clippy --workspace - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
The project has been completely refactored from a simple pub-sub architecture to a modern, scalable communication system:
Previous Architecture:
- Single pub-sub topic for all communication
- Mixed message types on shared topics
- Limited scalability for multiple backends
New Architecture:
- Pub/Sub Topics: High-frequency data (bandwidth, interface updates, health)
- Query/Reply Services: Command operations (TC config, interface control)
- Multi-Backend Support: Named backend instances with topic isolation
- Type Safety: Strongly-typed messages for each communication pattern
- Scalability: Independent scaling of pub/sub vs command operations
- ⭐ Better Performance: Optimized communication patterns for different data types
- ⭐ Multi-Backend Ready: Support for distributed deployments
- ⭐ Type Safety: Compile-time message validation
- ⭐ Maintainability: Clear separation of concerns
- ⭐ Future-Proof: Extensible architecture for new features
TC GUI features a streamlined, direct-manipulation interface:
- ✅ Direct Feature Control: Each traffic control feature (Loss, Delay, etc.) has its own checkbox
- ✅ Immediate Application: Checking a feature applies it instantly - no separate "Apply" button
- ✅ Visual Status: Interface icons show TC status (🔧 = TC active, 📡 = normal)
- ✅ Parameter Sliders: Expandable parameter controls appear when features are enabled
- ✅ Auto-Cleanup: Backend intelligently removes TC qdisc when no features are active
- Automatic Defaults: Features use sensible defaults when enabled (1% loss, 10ms delay, etc.)
- Real-time Updates: Parameter changes apply immediately while features are enabled
- Complete Removal: Unchecking features properly removes parameters from TC qdisc
- Conflict Resolution: Backend uses delete+add strategy to ensure clean parameter removal
- Linux TC Team for the powerful traffic control subsystem
- Iced Team for the excellent GUI framework
- Zenoh Team for high-performance messaging
- Rust Community for the amazing ecosystem