search

How to do port forwarding with SSH

Table of contents

Simple Port Forwarding

Assuming the web server has a web service running on port 54242, the following command forwards traffic from the remote server's port 54242 to the local port 55000.

sh -L 55000:localhost:54242 user@42.124.12.21

While more complex setups involving firewalls or VPNs are available, for straightforward scenarios like exposing a service accessible only at home to the university, this method should suffice.

Related Content
Author
I’m a passionate full-stack software engineer, architect and Debian lover.