Bind applications to specific network interfaces with ease
Features β’ Installation β’ Usage β’ Architecture β’ Contributing
InterMux is a powerful Linux utility that enables you to bind applications to specific network interfaces. Whether you need to route your browser through Wi-Fi while keeping your development server on Ethernet, or isolate applications for security testing, InterMux makes it simple.
- Multi-WAN Management: Route different applications through different internet connections β boost speed, balance load, or bypass network-specific restrictions
- Network Testing: Test applications on specific network interfaces
- Security Isolation: Isolate applications in separate network namespaces
- Bandwidth Management: Control which apps use which network connections
- Development: Test network-dependent applications across different interfaces
I was downloading a large file via torrent, and while waiting, I opened YouTube to pass the time. But the videos were stuck on low quality, buffering like crazy β even though my connection showed 300 Mbps.
Turns out, the torrent was consuming all the bandwidth, and YouTube was left starving. Thatβs when I had the idea: βWhat if I could assign different apps to different networks?β
After some research, I found that while Linux supports advanced networking, there wasnβt a simple tool to do what I needed β especially one that was GUI-friendly and straightforward.
So I built InterMux: A utility that lets me bind any app to a specific interface with ease β no messy configs, no guesswork, just full control.
|
|
# Required system packages
sudo apt update
sudo apt install -y python3 python3-pip python3-tk iproute2 iptables
# Python Virtual environment
python -m venv venv
source venv/bin/activate
# Python dependencies in the venv
pip3 install -r requirements.txt
- Note for Ubuntu 24.04+ users: Some Python modules (like brotli) may require system-level installation.
# If pip fails
sudo apt install python3-brotli
# Clone the repository
git clone https://github.com/yourusername/intermux.git
cd intermux
# Python Virtual environment
python -m venv venv
source venv/bin/activate
# Install Python dependencies
pip3 install -r requirements.txt
# Make scripts executable (optional)
chmod +x core/router.py
- You can explicitly install these packeges, if all the above given installation steps fails.
Brotli==1.1.0
click==8.2.1
markdown2==2.5.3
MarkupSafe==3.0.2
minijinja==2.11.0
page==0.3
PyYAML==6.0.2
tk==0.1.0
Launch the modern graphical interface:
# The GUI will request root privileges via pkexec
python3 gui/app.py
GUI Features
- Interface Selection: Dropdown menu with all active interfaces
- Application Binding: Easy path entry and interface assignment
- Visual Management: See all created bindings at a glance
- One-Click Actions: Assign, refresh, and clear operations
The CLI provides full functionality for managing network interface bindings from the command line:
sudo python3 cli.py list
Output example:
--- Active Network Interfaces ---
Interface: wlan0
Status: UP
Type: Wi-Fi
IP Addresses: 192.168.1.100/24, fe80::1234:5678:9abc:def0/64
Gateways: 192.168.1.1
Interface: enp7s0f4u1
Status: UP
Type: Ethernet
IP Addresses: 10.252.21.95/24
Gateways: 10.252.21.177
sudo python3 cli.py assign --app /usr/lib/firefox/firefox --iface wlan0
This command:
- Creates a network namespace for the interface
- Sets up virtual ethernet pairs (veth0/veth1)
- Configures routing within the namespace
- Launches the application in the isolated environment
sudo python3 cli.py clear
Removes all custom routing tables and clears assigned paths.
sudo python3 cli.py reset
Completely resets the system by:
- Removing all veth interfaces
- Deleting network namespaces
- Clearing custom routing tables
- Restoring system to defaults
python3 cli.py --help
python3 cli.py <command> --help # For command-specific help
intermux/
βββ core/ # Core functionality
β βββ interface.py # Network interface detection
β βββ router.py # Routing table management
βββ gui/ # GUI components
β βββ app.py # Main GUI application
β βββ gui.py # Legacy GUI interface
βββ requirements.txt # Python dependencies
βββ README.md # This file
- Interface Detection: Scans system for all network interfaces using
ip
commands - Routing Tables: Creates custom routing tables in
/etc/iproute2/rt_tables
- Network Namespaces: Isolates applications using Linux network namespaces
- Virtual Interfaces: Uses veth pairs to connect namespaces to physical interfaces
- IP Forwarding: Configures NAT/masquerading for namespace connectivity
Edit core/router.py
to modify:
BASE_TABLE_ID = 100 # Starting table ID
BASE_PRIORITY = 1000 # Starting priority
GUI doesn't launch
# Ensure X11 forwarding is enabled
xhost +SI:localuser:root
# Check DISPLAY variable
echo $DISPLAY
Permission denied errors
InterMux requires root privileges for network operations. The GUI uses pkexec
for privilege escalation.
# Manual run with sudo
sudo python3 gui/app.py
Interface not detected
# Check interface status
ip link show
# Bring interface up
sudo ip link set <interface> up
Enable verbose logging by modifying core/interface.py
:
logging.basicConfig(level=logging.DEBUG, format='%(levelname)s: %(message)s')
- β
Firefox: Fully supported (
/usr/lib/firefox/firefox
) - β Chromium: Currently not supported due to sandboxing conflicts
- β Other Applications: Most GUI and CLI applications work correctly
- Root privileges required for network namespace operations
- Linux kernel with network namespace support
- iproute2 package for network management
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- Follow PEP 8 guidelines
- Add docstrings to all functions
- Include type hints where applicable
- Write unit tests for new features
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Python and Tkinter
- Uses Linux networking stack (iproute2)
- Inspired by the need for better network interface management
- π Report bugs
- π‘ Request features