Overview
m87 port forwarding allows you to securely access services running on remote devices or devices on remote networks as if they were running locally. All traffic is encrypted through the m87 secure tunnel.
Forward Command
Forward ports from remote devices or remote network devices to your local machine.
Syntax
m87 < devic e > forward < TARGET S > ...
Each target follows the format: [local_port:]remote_target[/protocol]
Where:
remote_target is [host:]port
protocol is tcp (default) or udp
Format Description Example portForward remote port to same local port 8080local:remoteForward remote port to different local port 3000:8080host:portForward from device on remote network 192.168.1.50:554local:host:remoteMap remote network device to local port 8554:192.168.1.50:554port/protocolSpecify protocol (tcp or udp) 8080/udp
Basic Examples
Same Port Forwarding
Different Port Mapping
Explicit TCP
UDP Forwarding
# Forward remote port 8080 to local port 8080
m87 rpi forward 8080
# Access at http://localhost:8080
Network Device Forwarding
Access devices on the remote device’s network, not just services running on the device itself.
Use Cases
Access IP cameras on remote LANs
Connect to routers and switches through a jump host
Reach internal network services
Access IoT devices without public IPs
Examples
IP Camera Access
Router Admin Panel
Internal Database
# Forward port 554 from IP camera at 192.168.1.50
m87 rpi forward 192.168.1.50:554
# Or expose locally on different port
m87 rpi forward 8554:192.168.1.50:554
# View RTSP stream locally
ffplay rtsp://localhost:8554/stream
vlc rtsp://localhost:8554/stream
Multiple Port Forwarding
Forward multiple ports with a single command.
Examples
Same Ports
Mixed Port Mapping
Full Stack Application
# Forward multiple ports (same local and remote)
m87 device forward 8080 9090 3000
Port Ranges
Forward ranges of ports efficiently.
Syntax
start-end Forward port range (same local/remote)
start-end:start-end Map local range to different remote range
start-end:host:start-end Range with specific remote host
Examples
# Forward ports 8080-8090 (same local and remote)
m87 device forward 8080-8090
# Map local range to different remote range
m87 device forward 8080-8090:9080-9090
# Forward range from network device
m87 device forward 8080-8090:192.168.1.50:9080-9090/tcp
Port ranges are particularly useful for applications that use multiple consecutive ports, such as media servers or game servers.
Real-World Examples
Web Development
Development Server
Web UI and API
# Remote Node.js app on port 3000
m87 dev-server forward 3000
# Access at http://localhost:3000
curl http://localhost:3000
Database Access
# Forward PostgreSQL port
m87 db-server forward 5432
# Connect with psql
psql -h localhost -p 5432 -U myuser mydb
IoT and Smart Home
Home Assistant
MQTT Broker
# Access Home Assistant on remote Raspberry Pi
m87 rpi forward 8123
# Open http://localhost:8123 in browser
# Forward RTSP stream from camera
m87 rpi forward 8554:192.168.1.50:554
# Stream with VLC
vlc rtsp://localhost:8554/stream
# Stream with ffmpeg
ffplay rtsp://localhost:8554/stream
SSH Tunneling
# Forward SSH from another device on remote network
m87 gateway forward 2222:10.0.1.100:22
# SSH to internal device through tunnel
ssh -p 2222 user@localhost
Serial Command
Connect to serial devices (USB, UART) on remote machines.
Syntax
m87 < devic e > serial < PAT H > [BAUD]
Parameters
Parameter Required Default Description PATHYes - Path to serial device (e.g., /dev/ttyUSB0) BAUDNo 115200 Baud rate for serial connection
Examples
Default Baud Rate
Custom Baud Rate
# Connect to USB serial device (115200 baud)
m87 rpi serial /dev/ttyUSB0
Common Serial Devices
Device Path Description /dev/ttyUSB0USB-to-serial adapter /dev/ttyACM0Arduino, USB CDC devices /dev/ttyAMA0Raspberry Pi UART (GPIO pins) /dev/ttyS0Built-in serial port
Use Cases
Arduino development - Flash and debug Arduino boards
Router/switch configuration - Access console ports
Embedded systems - Debug embedded Linux devices
Industrial equipment - Monitor and control serial devices
IoT devices - Configure ESP32, ESP8266, and similar devices
Serial Examples
Arduino Debugging
Network Switch Configuration
ESP32 Development
# Connect to Arduino on remote Pi
m87 rpi serial /dev/ttyACM0
# You can now use Arduino Serial Monitor output
Use m87 <device> exec -- ls /dev/tty* to list available serial devices on the remote machine.
Security Features
All forwarding is secure by default:
All traffic is encrypted through the m87 secure tunnel
No need to expose ports publicly or configure firewalls
Authentication handled automatically by m87
End-to-end encryption for all forwarded connections
Connection Behavior
Forwarding runs in the foreground
Press Ctrl+C to stop forwarding
Connection automatically reconnects if network drops
Local ports are released when forwarding stops