Sometimes we want to run a process, or container, on another machine but access it locally.
Remote Port Forwarding, or tunneling, can help with precisely this. It allows us to start a process on another machine but bind a port on that remote to one on our computer. We could run a Fastify server and bind our local port to a remote port. We would then be able to access that server on our local port.
Unfortunately, this isn’t something super commonly taught these days.
To set this up, we need to run:
ssh -R 3000:3000 user@host
What’s happening in the previous command is:
- Connecting to a remote machine at user@host
- User being the username
- Host being the remote machines IP (local or remote network)
- -R to state Remote forwarding
- 3000:3000 is binding port 3000 on the local machine to port 3000 on the remote
With the increased bandwidth and internet speeds offered in many areas. The need to have a beast of a local machine is starting to lessen. This opens the door to building apps and sites on iPads, and other devices. Typically considered underpowered and not set up for actual development.
With this tool, you’ll be able to use another machine to run your apps, servers, and projects. Freeing up local resources for all the Chrome tabs your system can handle.