D
D
Dummy852019-10-22 03:34:20
SSH
Dummy85, 2019-10-22 03:34:20

How to forward a port through a tunnel in ssh?

1. There is external access to the Debian server via SSH [email protected] -p 2422
2. On this server, the website needed.website.ru is running locally, which is given locally on port 80.
There is a desire on the computer (MacOs) to see the website needed.website.ru from the outside Is it possible to forward
the port inside the SSH session to see the site from the outside? If so, please describe in detail how to do this by accessing the server via SSH?
Where do you need to execute forwarding commands? On the server via ssh or on an external machine (MacOs)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
planc, 2019-10-22
@Dummy85

SSH [email protected] -p 2422 -L 80:127.0.0.1:80
and of course, if needed.website.ru is not given as a standard web server, you need to add it to /etc/hosts:
-L port:machine:machineport
Specifies the given port on the local (client) machine to be redirected to the given machine and the port on the remote machine. This is implemented by assigning a domain connection to a "listening" port on the local machine's side, and whenever a connection is made to that port, it will be redirected over the secure channel and connected to the machine_port port of the remote machine. Port forwarding can also be specified in the configuration file. Only the superuser can forward privileged ports. IPv6 addresses can be specified with an alternative syntax: port/host/hostport.
-R port:machine:machineport
Specifies the given port on the remote machine (server) that will be redirected to the given machine and local port. This is implemented by assigning a domain connection to a "listening" port on the remote machine's side, and whenever a connection is made to that port, it will be redirected over the secure channel and connected to the machine_port port of the local machine. Port forwarding can also be specified in the configuration file. Only the superuser can forward privileged ports. IPv6 addresses can be specified with an alternative syntax: port/host/hostport.
https://www.opennet.ru/man.shtml?topic=ssh&categor...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question