Skip to content

Rishi-Bhati/intermux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

36 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌐 InterMux

Advanced Network Interface Management for Linux

Python Version License Platform Linux Platform Windows Privilege Model

Bind applications to specific network interfaces with ease

Features β€’ Installation β€’ Usage β€’ Architecture β€’ Contributing


πŸ“‹ Overview

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.

Privacy Note: InterMux sets up network namespaces as root, but launches all applications as your regular user β€” your bookmarks, cookies, and app settings are always preserved.

🎯 Use Cases

  • Multi-WAN Management: Route different applications through different internet connections
  • 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

πŸ’‘ Why I Made It

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.

✨ Features

πŸ–₯️ Core Features

  • πŸ” Auto-detection of all network interfaces
  • πŸ›£οΈ Custom routing tables per interface
  • πŸ”’ Network namespace isolation
  • πŸ“Š Real-time interface monitoring
  • πŸŽ›οΈ Both CLI and GUI interfaces
  • πŸ‘€ User-preserving β€” apps keep your profile & data

🌟 Interface Support

  • πŸ“Ά Wi-Fi (wlan*, wl*)
  • πŸ”Œ Ethernet (eth*, en*)
  • πŸ“± USB Tethering
  • πŸ”΅ Bluetooth Tethering
  • 🌐 Virtual Interfaces

πŸš€ Installation

Prerequisites

Ubuntu / Debian / Mint
sudo apt update
sudo apt install -y python3 python3-pip iproute2 iptables policykit-1 x11-xserver-utils
Arch / EndeavourOS / Manjaro
sudo pacman -S python python-pip iproute2 iptables polkit xorg-xhost
Fedora / RHEL / Rocky
sudo dnf install -y python3 python3-pip iproute iptables polkit xorg-x11-server-utils
openSUSE
sudo zypper install python3 python3-pip iproute2 iptables polkit xorg-x11-xhost
  • 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 and Setup

# Clone the repository
git clone https://github.com/Rishi-Bhati/intermux.git
cd intermux

# Python Virtual environment
python3 -m venv venv
source venv/bin/activate

# Install Python dependencies
pip3 install -r requirements.txt

Verify Dependencies

python3 cli.py check

🧩 Packeges Required (If everything above fails)

  • 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

πŸ“– Usage

🎨 GUI Mode (Recommended)

python3 gui/app.py

The GUI requests root via pkexec (falls back to sudo). Apps always launch as your regular user β€” your profile data is preserved.

GUI Features
  • Interface Selection: Dropdown with all active physical interfaces (virtual adapters like veth/docker are auto-hidden)
  • Application Binding: Enter app path and assign to an interface
  • Running App Detection: Prompts to close & reopen (default profile) or open new instance
  • Session Awareness: Auto-detects X11 or Wayland
  • Dependency Banner: Warns about missing system tools

πŸ’» CLI Mode

1. List Active Interfaces

sudo python3 cli.py list

2. Assign Application to Interface

sudo python3 cli.py assign --app /usr/lib/firefox/firefox --iface wlan0

If Firefox is already open, you'll be prompted:

[!] 'firefox' is already running (PID(s): [12345]).
    Options:
    1) Close current instance and reopen on the selected network (uses your default profile)
    2) Open a new instance with a separate profile
    3) Cancel
    Enter choice [1/2/3]:

3. Check Dependencies

python3 cli.py check

4. Clear All Paths

sudo python3 cli.py clear

5. Reset Everything

sudo python3 cli.py reset

πŸŽ₯ Tutorial Video

πŸŽ₯ Tutorial Video

Screencast_20250710_223520_gfnqkq

πŸ—οΈ Architecture

intermux/
β”œβ”€β”€ core/                   # Core functionality
β”‚   β”œβ”€β”€ interface.py        # Network interface detection (cross-distro)
β”‚   β”œβ”€β”€ router.py           # Routing table management
β”‚   └── platform_utils.py   # β˜… Distro detection, display/DNS/user helpers
β”œβ”€β”€ gui/                    # GUI components
β”‚   β”œβ”€β”€ app.py              # Main GUI application
β”‚   └── gui.py              # Legacy GUI interface
β”œβ”€β”€ cli.py                  # CLI entrypoint
β”œβ”€β”€ requirements.txt        # Python dependencies
└── README.md               # This file

πŸ”§ How It Works

  1. Interface Detection: Scans system for all network interfaces using ip commands
  2. Routing Tables: Creates custom routing tables in /etc/iproute2/rt_tables
  3. Network Namespaces: Isolates network traffic using Linux network namespaces
  4. Virtual Interfaces: Uses veth pairs to connect namespaces to physical interfaces
  5. IP Forwarding: Configures NAT/masquerading for namespace connectivity
  6. Privilege Separation: Namespace setup runs as root; apps launch as your user via sudo -u
  7. DNS Resolution: Writes real upstream DNS servers to namespace (handles systemd-resolved stubs)

πŸ” Privilege Model

Operation Runs As
Create network namespace root
Configure veth / routing / NAT root
Write namespace resolv.conf root
Launch your application your regular user

πŸ› οΈ Advanced Configuration

Custom Routing Table IDs

Edit core/router.py:

BASE_TABLE_ID = 100  # Starting table ID
BASE_PRIORITY = 1000 # Starting priority

πŸ› Troubleshooting

GUI doesn't launch on Wayland

InterMux auto-detects Wayland. If issues occur, ensure xwayland is installed:

# Arch
sudo pacman -S xorg-xwayland
# Ubuntu/Debian
sudo apt install xwayland
Permission denied errors
sudo python3 cli.py assign --app /usr/lib/firefox/firefox --iface wlan0
Interface not detected
ip link show
sudo ip link set <interface> up
No internet in namespace / DNS failures
python3 cli.py check
sudo sysctl -w net.ipv4.ip_forward=1

πŸ“ Logs and Debugging

InterMux automatically logs all activity, commands, and errors to a persistent log file:

~/.local/share/intermux/intermux.log

This log includes detailed debug information and full stack traces, which is highly recommended to include when reporting issues.

⚠️ Known Limitations

Browser Compatibility

  • βœ… Firefox: Fully supported β€” uses your existing profile, prompts if already running
  • ❌ Chromium: Not supported due to sandboxing conflicts with network namespaces
  • βœ… Most other apps: GUI and CLI applications work correctly

Platform Support

  • βœ… Linux (all major distros): Arch, Ubuntu, Debian, Fedora, openSUSE, Manjaro, EndeavourOS, etc.
  • βœ… X11 and Wayland: Both session types supported
  • βœ… Windows 10 / 11: Phase 1 supported via SOCKS5 proxy binding β€” see windows/README.md

System Requirements

  • Root privileges for network namespace operations
  • Linux kernel with CONFIG_NET_NS
  • iproute2 for network management

🀝 Contributing

Contributions are welcome! Please submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes
  4. Push and open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Built with Python and Tkinter
  • Uses Linux networking stack (iproute2)
  • Inspired by the need for better network interface management

πŸ“ž Support


πŸͺŸ Windows Support

InterMux now supports Windows 10 and 11 via a SOCKS5 proxy engine. See windows/README.md for full installation and usage instructions.

windows/
β”œβ”€β”€ gui/app.py          ← GUI (same dark theme)
β”œβ”€β”€ cli.py              ← CLI (same commands)
β”œβ”€β”€ core/               ← Windows-specific engine
└── intermux_windows.spec  ← PyInstaller β†’ .exe

Made with ❀️ for the Linux and Windows communities

About

Bind apps to specific network interfaces using Linux namespaces and routing.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages