Repository navigation
Port Forwarding Guide
Note
The Port Forwarding feature in aShellYou manages ADB socket tunnels (adb forward and adb reverse), allowing network traffic to be seamlessly relayed between your Android device, local networks, and connected remote targets over USB OTG or Wireless ADB.
Port forwarding is essential for mobile developers, web engineers, and security auditors. It allows you to access remote web servers, debuggers, API endpoints, and internal Unix domain sockets running on a secondary phone directly from your host phone's browser or local tools.
Key highlights include:
-
Comprehensive Socket Support: TCP ports (
tcp:PORT), abstract Unix domain sockets (localabstract:NAME), local filesystem sockets (localfilesystem:PATH), and Java Debug Wire Protocol (jdwp:PID). - Bidirectional Relaying: Forward connections from your host phone to the target device, or reverse forward target device traffic back to services running on your host phone.
- Persistent Background Service: Manages active socket connections via an Android foreground service with a persistent notification, ensuring uninterrupted tunneling even when the screen is locked.
-
Local Network Sharing: Optionally bind listeners to
0.0.0.0rather than127.0.0.1, allowing other laptops, tablets, or computers on your local Wi-Fi network to route through your phone to the target device. - Real-Time Traffic Telemetry: Tracks open connection handles, lifetime connection counts, and live upload/download byte counters.
The Port Forwarding screen displays active socket relays, connection scopes, and saved profiles:
-
Scope Filter Chips (
ScopeChips):- All: Displays all configured tunnels across all transports.
- Network: Displays tunnels connecting directly to remote network hosts.
- OTG / Wireless Devices: Isolates tunnels bound to specific connected hardware.
-
Tunnel Cards (
TunnelCard):- Header & Toggle: Tunnel name and an active power switch to immediately start or stop the socket relay.
-
Endpoint Summary: Visual mapping of the local listening port to the target destination (e.g.
tcp:8080 → tcp:8080). -
Live Telemetry: Real-time counters showing active open sockets and transferred bandwidth (
2 open · ↓ 2.3 MB). - Actions: Direct buttons to Open in Browser (for HTTP services), Copy URL, Edit, or Delete.
-
Floating Action Button:
- New Tunnel: Opens the tunnel configuration editor.
Configuring a new tunnel takes only a few seconds using the dedicated editor:
| Active Tunnels Overview | Tunnel Configuration Editor |
|---|---|
![]() |
![]() |
-
Tunnel Name:
- A friendly descriptive label (e.g.,
Local Web ServerorNode Debugger Session).
- A friendly descriptive label (e.g.,
-
Target Destination:
- For network hosts: The destination IP address and remote port (e.g.,
127.0.0.1:8080). - For connected devices: Choose the target ADB device and socket type (TCP port, abstract Unix socket, filesystem socket, or JDWP process ID).
- For network hosts: The destination IP address and remote port (e.g.,
-
Local Port:
- The port number aShellYou will open and listen on locally on your device.
- aShellYou automatically validates whether the port is free or already bound by another process.
-
Advanced Options:
-
Allow sharing on Wi-Fi: Binds the listening socket to the phone's Wi-Fi network IP. Other devices connected to the same Wi-Fi router can reach the service at
http://<your-phone-ip>:<local-port>. - Auto-start tunnels: Automatically activates this tunnel whenever aShellYou launches or when the associated target device reconnects.
-
Allow sharing on Wi-Fi: Binds the listening socket to the phone's Wi-Fi network IP. Other devices connected to the same Wi-Fi router can reach the service at
-
Establish ADB Connection:
- Connect the target device running your web server via OTG-ADB-Setup-Guide or Wireless-Debugging-Setup.
-
Open Port Forwarding:
- Open the navigation drawer and tap Port Forwarding.
- Tap New Tunnel (the
+floating action button).
-
Fill Configuration:
- Enter a name:
Development Web Server. - Set Target Address to the port running on the remote device (e.g.,
8080). - Set Local Port to your desired local port (e.g.,
8080). - If you want to access the site from your laptop over local Wi-Fi, toggle Allow sharing on Wi-Fi ON.
- Enter a name:
-
Activate and Test:
- Tap Save.
- Ensure the toggle switch on the tunnel card is turned ON.
- Open Chrome or any browser on your phone and navigate to
http://localhost:8080. - The web page hosted on the secondary device will load seamlessly on your phone.
Tip
- When forwarding privileged ports below 1024 (e.g., port 80 or 443), Android requires root permissions. For non-root environments, use unprivileged ports above 1024 (such as 8080 or 8443).
- You can inspect active tunnels from the command line inside aShellYou's terminal at any time by running
adb forward --list.
If you run into any issues or want to ask questions, feel free to:
- Join our Telegram Community
- Open an Issue on GitHub
- Local ADB Guide
- TCP/IP Setup Guide
- Wireless Debugging Setup
- OTG ADB Setup Guide
- Fastboot over OTG Guide
- USB Debugging Setup
