Skip to content

Instantly share code, notes, and snippets.

@jaz303
Last active April 25, 2023 08:47
Show Gist options
  • Save jaz303/87eac775130bfb62aee0393f03c8f68f to your computer and use it in GitHub Desktop.
Save jaz303/87eac775130bfb62aee0393f03c8f68f to your computer and use it in GitHub Desktop.
Openport tunnel example

Prerequisites

Instructions

NB: server and client can be the same machine.
NB: on first Openport run it's necessary to visit a URL before traffic will be forwarded

  • Server
    • Terminal 1: run a local server on port 6000 nc -k -l 6000. In reality this would be your real server process.
    • Terminal 2: use Openport to allow remote SSH connections to local port 22 (a local SSH daemon must be running - on macOS this is "Remote Login" in the Sharing system preferences pane): openport 22
  • Client
    • Terminal 1: start an ssh tunnel ssh -NL 7000:127.0.0.1:6000 openport.io -p $OPENPORT_PORT, replacing $OPENPORT_PORT with the port reported by Openport. If prompted for a password, use the server password.
    • Terminal 2: echo "Hello world" | nc localhost 7000 - output should appear on server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment