Reverse Tunneling
Subject: Computer and Technology noun /rɪˈvɜːrs ˈtʌn.əl.ɪŋ/ 1 definition
- computer-networking
- network-security
- network-protocols
- remote-access
-
Definition (noun)
Entry #327 · UpdatedReverse Tunneling is a networking technique in which a host behind a firewall or Network Address Translation (NAT) gateway initiates an outbound connection to a reachable external server so that inbound traffic can be routed back to the internal host through that channel. By leveraging security policies that permit outbound sessions while blocking unsolicited incoming packets, an internal client establishes a persistent, multiplexed transport—commonly over SSH, TLS, HTTP/2, or WebSockets—and instructs the external relay to bind a listening endpoint and forward arriving connections backward to a local port or private target. Unlike forward tunneling, where a client connects outward to reach remote resources behind a gateway, or standard reverse proxies that assume direct reachability to backend hosts, reverse tunneling inverts connection initiation so private endpoints remain reachable without opening inbound firewall ports or configuring static port forwarding. While essential for remote administration, local webhook development, and hybrid-cloud connectivity across restricted perimeters, it introduces reliance on an intermediary relay and requires strict authentication and egress filtering to prevent unauthorized pivoting into internal networks.
Common Forms
SSH Remote Port Forwarding: Uses the Secure Shell protocol (via
ssh -R) to bind a TCP port or Unix domain socket on a public SSH server and forward incoming connections back through the encrypted outbound session to an internal host or local port.Application-Layer Edge Tunnels: Maintain persistent outbound HTTP/2, WebSocket, or QUIC streams from a local connector daemon to a cloud edge relay (such as Cloudflare Tunnel or ngrok), exposing internal HTTP, gRPC, or TCP services under managed TLS endpoints without public IP addresses.
Reverse SOCKS Proxy Tunnels: Pair an outbound callback channel (such as OpenSSH remote dynamic forwarding or Chisel) with a SOCKS4 or SOCKS5 listener on the external host, allowing remote clients to route connections dynamically to arbitrary hosts and ports inside the private network.
Zero-Trust and Device Management Connectors: Embed lightweight outbound-only agents inside private VPCs, edge routers, or IoT appliances to maintain authenticated control-plane tunnels to a central broker for remote diagnostics and policy-enforced access without inbound firewall rules.
Example
A developer testing a Stripe webhook on a laptop behind a corporate NAT runs
ssh -N -R 8443:127.0.0.1:3000 tunnel@bastion.example.comto open a persistent outbound SSH connection to a public bastion host. When Stripe delivers an HTTPSPOST /webhooksrequest to the bastion's reverse proxy on port443, the proxy forwards the connection to127.0.0.1:8443on the bastion, which the SSH server relays back through the existing outbound tunnel to the local server listening on port3000.