Skip to content

About

An Android LSPosed module for per-app network routing.

Topics

Resources

Stars

26 stars

Watchers

0 watching

Forks

Repository files navigation

MultiRoute

English | 简体中文
Architecture · Building · Changelog

Download installation packages from GitHub Releases or install via the LSPosed Module Repository.

build Release License: GPL v3 Android LSPosed LibXposed API

MultiRoute is an Android LSPosed module for per-app network routing (including secondary SIM channel controls and SIM-based assignments), secondary Wi-Fi management, personal hotspot upstream selection, per-channel traffic monitoring, and wireless debugging controls. Device and ROM behavior varies by function.

Prerequisites: Requires Root (KernelSU / Magisk / APatch) and LSPosed (LibXposed API 101+), scoped to System Framework (system) and the NetworkStack Tethering packages.


Features

  • Per-app policy routing: Assign individual apps to Primary Wi-Fi, Secondary Wi-Fi, Cellular (including secondary SIM selection on dual-SIM devices), Ethernet, or System Default via Linux kernel policy routing without a userspace VPN. Connected LAN subnets stay routed on their own interfaces so local devices (NAS, printers, casting) remain reachable.
  • Cloned apps & scenario plans: Cloned spaces (e.g., Xiaomi XSpace (999)) and work profiles are listed as separate targets. Save named Scenario Plans with conditions (Wi-Fi SSID, Dual Wi-Fi active, Cellular only, Always, or Manual). Matching plans stack in priority order and re-evaluate on network changes even when the app UI is closed.
  • Dual Wi-Fi management (STA + STA): Connect and switch a secondary Wi-Fi network alongside primary Wi-Fi, distinguish access points sharing an SSID by BSSID and band, and show band compatibility indicators.
  • Personal hotspot upstream selection: Choose the personal hotspot upstream directly in Channels (System Default, active physical links such as Primary/Secondary Wi-Fi, Ethernet, or specific SIM Cellular, plus Default mobile data on demand—for example, sharing cellular data over hotspot while staying connected to an intranet Wi-Fi).
  • Channel monitoring, topology & egress probes: Switch between list and interactive topology views to inspect per-interface rates, 30-second traffic graphs, cumulative usage, and Wi-Fi link rates; switch VPN/Hotspot upstreams directly and run multi-channel public egress checks.
  • Wireless debugging helper: Manage Android 11+ Native TLS wireless debugging and Legacy TCP mode (configurable port 1024..65535), inspect active ADB connections and peer IPs, copy adb connect commands, and configure boot/unlock recovery, automatic switching on trusted Wi-Fi networks, or system auto-start takeover.

Requirements & Compatibility

Requirement Details
Root KernelSU / Magisk / APatch (policy routing and root shell queries require root)
Xposed Framework LSPosed or another framework implementing LibXposed API 101+
Module Scope System Framework (system / system_server) and NetworkStack (com.android.networkstack.tethering, etc.)
Android Version Android 11 (minSdk 30) or later
Verified Environments Status
Android 17 / HyperOS (Phone) Verified Dual Wi-Fi, secondary SIM controls and SIM-based routing, app and clone routing, IPv4/IPv6 routing, and rule recovery
Android 16 / HyperOS (Tablet) Verified Dual Wi-Fi, app and clone routing, IPv4/IPv6 routing, DNS redirection, and rule recovery (no cellular hardware)
Android 16 / AOSP Verified connecting, disconnecting, and IPv4 Internet access via saved secondary Wi-Fi networks; other features not broadly verified
Android 11 – 15 ⚠️ Not verified
Android 7 – 10 ❌ Not supported (required framework interfaces were added in Android 11)

Hardware, firmware, and ROM behavior vary. Dual Wi-Fi radio combinations, concurrent dual-SIM data, and hotspot upstream policies cannot be determined by Android version alone.


Installation & Getting Started

  1. Install the APK: Download MultiRoute-<VersionCode>-<VersionName>.apk from Releases, or install from LSPosed Manager's module repository (io.github.linoleic.multiroute). Both methods support update checks via xposed_update.json.
  2. Enable in LSPosed: Open LSPosed Manager → Modules → MultiRoute, enable the module, and check its scope (system and NetworkStack Tethering packages). Supported managers pre-select this list from the embedded scope.list metadata.
  3. Reboot: Reboot the device, or restart the system server (su -c 'setprop ctl.restart zygote').
  4. Verify status: Open MultiRoute, grant Root permission, and tap the module status icon on the toolbar. It should report Activated (hooks ready).
    • To route apps over Cellular while Wi-Fi is connected, enable Mobile data always on in Developer Options (or your ROM's equivalent setting).
Upgrading from 1.1.x (Package ID change)

From v1.2 onward, the package ID changed from com.multiroute to io.github.linoleic.multiroute to match the Xposed Module Repository ownership namespace:

  1. Uninstall 1.1.x first (assignments do not migrate automatically).
  2. Install the current APK, enable the new entry in LSPosed Manager, configure its scope, and remove the old uninstalled entry.
Uninstalling / Cleaning Up
  1. Inside the app: set Hotspot Upstream back to System Default, disconnect any managed Secondary Wi-Fi, and run App routing → menu → Clear all app routing rules.
  2. If Dual Wi-Fi was used, revert any device/overlay changes that were applied before using MultiRoute and remove /data/adb/service.d/01-multiroute-dualwifi.sh if present.
  3. Disable MultiRoute in LSPosed Manager, uninstall the APK, and reboot.

Usage

MultiRoute provides four main destinations (App routing, Channels, Tools, and Settings), using bottom navigation on narrow screens and a navigation rail with list-detail panes on wide screens:

1. App Routing

  • Single-app assignment: Tap an app (or its (999) clone / work profile entry) and select a target channel.
  • Batch assignment: Long-press an item to enter multi-select mode and assign or reset multiple apps together.
  • Scenario plans: Save assignments as named plans with trigger conditions (Wi-Fi network, Dual Wi-Fi online, Cellular only, Always, or Manual). Matching plans override mentioned apps in priority order and re-evaluate when links change, even while MultiRoute is not in the foreground.
  • Rule actions: Use the toolbar menu to reapply rules or clear all app routing rules.

2. Channels

  • Channel list & traffic meter: View active links (Primary Wi-Fi, Secondary Wi-Fi, Cellular, VPN, Hotspot downlinks, Ethernet) along with current RX/TX rates, a 30-second rate history graph, window peak speeds, and cumulative traffic since boot.
  • Network topology view: Switch between List and Topology to inspect a 3-layer directed graph of traffic sources (system default, active scenario overrides, routed apps, proxy egress drafts, hotspot downlinks), relays (VPN / transparent proxy gateway), and physical egresses with live traffic highlights; tap any node to spotlight its connected path and open quick actions.
  • Channel details: Tap a channel card to inspect interface name, IP addresses, gateway, DNS servers, MTU, metered status, System-estimated throughput, and (for WLAN links) Wi-Fi link rate (negotiated RX/TX Mbps) plus band and channel.
  • Egress check: Both list and topology views share the top-bar egress check sheet to probe reachability, public IP/location, and response latency via built-in HTTPS presets (including ip.sb) or custom URLs; when a domestic preset is active, VPN channels automatically use overseas endpoints.
  • VPN & Personal Hotspot upstream: Change VPN and Personal Hotspot upstreams directly from channel cards, channel details, or the topology view (supporting active physical links and pre-configuring hotspot upstream before enabling it, including on-demand default mobile data; forwarding, NAT, IPv6, and offload remain managed by Android Tethering, and Tethering hook status is shown in Module Diagnostics).
  • Secondary SIM & inactive links: Inactive or establishing links (such as the non-default data SIM on supported dual-SIM devices, Secondary Wi-Fi, or disabled Personal Hotspot) expose quick management actions directly in the Channels tab.

3. Tools

  • Dual Wi-Fi Manager:
    • Choose a connection scheme (Auto is the default; Xiaomi/HyperOS devices use SlaveWifiService coordination and keepalive hooks, while Android 13+ AOSP/other ROMs provide Overlay and Root options).
    • System Multi-Internet schemes only connect to networks already saved in Android Wi-Fi settings; MultiRoute does not store or send Wi-Fi passwords in those requests. Access points with the same SSID are listed separately by BSSID and band, and dual-5G (HBS) capability is probed to flag 5 GHz + 5 GHz conflicts on devices that require 2.4 GHz + 5 GHz.
  • Transparent proxy upstream (Experimental): Configure a local Clash-compatible controller for live upstream switching, or set up, validate, and export sing-box / Mihomo per-app gateway rules and binding snippets (see FAQ below).
  • Wireless Debugging Helper: Switch between Native TLS (Android 11+ dynamic port and pairing) and Legacy TCP (1024..65535, default 5555), inspect active connections and peer IPs, copy the adb connect command, and configure a trusted Wi-Fi list for boot/unlock recovery, automatic enablement/switching on Wi-Fi connect (via system_server callbacks), or system auto-start takeover.
  • Runtime logs & module status: Open the toolbar status icon to verify hook readiness and build parity, or open Tools → Runtime logs to check per-UID rule status, boot logs, wireless ADB automation logs, and exportable diagnostic snapshots.

4. Settings & Backup

  • Configure Auto-Failover (fall back to the default network when an assigned link drops, with optional HTTP 204 connectivity checks), Per-App DNS Redirection, failover hold-off timers, Theme / Material You, and App Language (Follow system / 简体中文 / English).
  • Backup & Restore (v3 JSON): Preview and restore selected categories (app routing, SIM targets, scenario plans, network policies, hotspot preference, non-secret Dual Wi-Fi settings, appearance, and probe servers). Compatible with v1/v2 backups; Wi-Fi passwords, UID caches, logs, and wireless ADB automation settings are excluded.

FAQ & Troubleshooting

Module shows "Not activated" or "Loaded older build"
  • Not activated: Confirm MultiRoute is enabled in LSPosed Manager with System Framework (system) and NetworkStack Tethering scopes selected, then reboot.
  • Loaded older build: Android's system_server cannot hot-reload framework code after an app update. Reboot, or run su -c 'setprop ctl.restart zygote', then check the status icon again.
An assignment has no effect
  1. Open Tools → Runtime logs and check the Rule effectiveness section to see whether the UID shows in effect or was skipped (for example, if the target interface currently lacks a default route).
  2. When routing apps over Cellular while Wi-Fi is connected, enable Mobile data always on in Developer Options.
  3. If a VPN is active, the LSPosed module automatically excludes apps explicitly routed to physical channels from non-lockdown VPN ranges when active; if the module is inactive or VPN lockdown is enabled, VPN routing policy can still override or capture traffic (see the DNS & VPN notes below).
Rules disappear after reboot

Check section 3 (/data/adb/multiroute/last_boot_sync.log) in Tools → Runtime logs, and confirm your root manager executes /data/adb/service.d/ scripts on this ROM. Boot recovery restores routing rules when interfaces become available; it does not connect Secondary Wi-Fi.

Secondary Wi-Fi is missing or fails to connect
  1. Check detected hardware capability in Tools → Dual Wi-Fi Manager and keep Connection Scheme set to Auto unless testing a specific method (the AOSP overlay option requires Android 13+). Root access cannot add dual-STA concurrency if hardware or firmware lacks support.
  2. Save the target Wi-Fi network in system Wi-Fi settings before selecting it as Secondary Wi-Fi.
  3. If two access points share the same band on a hardware configuration that rejects same-band pairing, try an access point on a complementary band (e.g., 2.4 GHz + 5 GHz).
DNS behavior or VPN interaction differs from expectations

MultiRoute redirects IPv4 UDP/TCP port 53 to the selected channel's DNS server. IPv6 DNS, Private DNS (DoT, port 853), and DoH are not rewritten. With an active VPN (tun0), when the LSPosed module is active, apps explicitly assigned to a physical channel are automatically excluded from non-lockdown VpnService UID ranges to prevent VPN DNS/Fake-IP interception (with UI fallback hints when the module is inactive or VPN lockdown is enabled). App assignment pickers also restrict VPN owner UIDs and recognized VPN clients from selecting VPN channels to reduce routing loops.

Using an eBPF transparent proxy

Assigning a physical channel tells the kernel which network interface to prefer for an app. If a transparent proxy intercepts traffic only on other interfaces, the app may still connect directly. Open diagnostics from the top bar to inspect interface interception and cgroup attachments, then test with a new connection from the target app.

For live switching with a Clash-compatible controller, open Tools → Transparent proxy upstream and expand Switch proxy upstream. Enter the local controller port and secret, choose the manual selector that handles the traffic, and map the channels to its outbounds. Use Network Channels → Transparent proxy upstream to switch the selector's outbound. The secret defaults to session-only and can be saved encrypted on this device.

To configure an app, open its channel picker under App Routing and choose a channel under Proxy egress rule. Enter the outbound name in the picker the first time you use that channel. Each outbound must already exist in the proxy and be bound to the target interface. You can also manage mappings under Tools → Transparent proxy upstream → Multi-channel gateway.

If the app already has a physical route, the proxy egress is saved as a draft and the current route stays active. To export that draft, set the app to follow system routing and check that a scenario does not override it.

After saving a proxy egress, select View export preview in the app's channel picker to check that app first. In the gateway tool, choose sing-box JSON or Mihomo YAML, then select Preview export. Review which apps, channels, and outbounds will be exported and why other entries were skipped. Save the file and merge route.rules or rules into the proxy configuration. Preserve the priority of DNS, direct, and blocking rules, and place UID rules before the general fallback. Apply the configuration and test a new connection from the target app. Setup and export work without a Clash controller. Export again after changing app routes, UIDs, interfaces, or outbound mappings.

NetProxy's local socket_assign mode follows the default interface. An app assigned directly to another interface may bypass interception. For those physical assignments, try NetProxy's local cgroup mode. Shared-network settings are independent. NetProxy transparent proxy guide

Choosing per-app Wi-Fi egress in an Android VPN

Client requirements. The client must support binding proxy outbounds to Android networks and declare io.github.linoleic.multiroute.vpn_gateway_version=1 in its app manifest. Testing used a locally patched FlClash 0.9.4 development build (2026110401). The test APK is unpublished. Official FlClash APKs and other clients have yet to be verified. Upstream FlClash source revision

Verified scope. Two apps made IPv4 HTTPS connections over separate Wi-Fi networks on Android 16 (HyperOS 3). This export format supports Wi-Fi egress. IPv6, UDP, other OS versions, and other device configurations have yet to be verified.

Connect a compatible Mihomo VPN client to enable the Mihomo (Android VPN) gateway format. Include the target apps in the VPN client, then select a Proxy egress rule for each app in MultiRoute. Leave the app on system routing or select that VPN as its channel.

The preview includes apps whose UIDs are in the active VPN's coverage and have no conflicting physical route. Use a distinct existing outbound for each Wi-Fi network. Follow the exported comments to set interface-name: android-vpn:<interface> on each outbound, then merge the UID rules into the client configuration.

Wi-Fi band is not shown, or Public-IP probe times out
  • Band not shown: Neither Android's platform API nor the dumpsys fallback reported frequency data for that interface.
  • Probe timeout: The channel may lack Internet reachability or access to the selected endpoint; switch presets or configure another reachable URL in Settings.
Known limitations
  • Routing rules install both IPv4 and IPv6 kernel tables without a userspace VPN, while DNS redirection applies to IPv4 port 53 only.
  • Cloned-app lookup uses root package listing, displays numeric space IDs (e.g., (999)), and covers ROMs where clones run as real Android users.
  • Secondary cellular controls require two active SIMs, manage only the non-default data SIM without changing the default data SIM or auto-starting at boot, and depend on device/carrier dual-data support plus ROM handling of mobile_data_preferred_uids.
  • Outside supported Xiaomi hooks, secondary Wi-Fi screen-off recovery relies on a foreground service monitor and cannot override hardware or firmware Doze behavior.

Related Documentation

Disclaimer

This is a root networking module that modifies kernel routing rules and injects into the system framework. Use it at your own risk. Sending traffic over cellular or sharing mobile data over hotspot may incur carrier charges and may conflict with carrier terms. Keep a way to recover (recovery boot or disabling the module) before experimenting.

Privacy

  • No telemetry: MultiRoute has no analytics, crash-reporting, telemetry, or advertising backend and does not require an account.
  • Local storage & app list: Configuration is stored in app-private storage (backups exclude Wi-Fi passwords, logs, and wireless ADB automation settings, while wireless ADB status and rolling logs stay in app noBackupFilesDir); QUERY_ALL_PACKAGES is used only to list installed apps and clone spaces locally.
  • User-controlled outbound requests: Channels public-IP probes run only when initiated manually. Optional connectivity validation under Auto-Failover sends a single HTTP 204 request only when a channel connects or recovers (with no continuous background polling and no device IDs, app lists, or rules) and makes no requests when turned off.
  • Root usage: su is used for routing/DNS rules, boot scripts, Dual Wi-Fi / Hotspot / ADB operations, interface traffic counters, and diagnostic snapshots (see Architecture for details).

License & Acknowledgements

Licensed under GNU General Public License v3.0. Built with LibXposed API, LSPosed, Jetpack Compose, and Material 3.

About

An Android LSPosed module for per-app network routing.

Topics

Resources

Stars

26 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages