How to make tunnels in linux without using SSH?
I have two machines on my network with IPs of 192.168.1.2
(Server) and 192.168.1.3
(Client). In the Server, there is an HTTP server running on the lo
interface on port 8080 (127.0.0.1:8080) which only can be accessed by local users. I want to forward that port to the Client. The only way I found is by through an SSH tunnel.
ssh -L 8080:127.0.0.1:8080 [email protected] -N -vv
For this process, I needed to have the password or the private key of that user. Is there an alternative way to make such a tunnel without using the SSH utility assuming that I don't have any kind of credentials
but do have access to execute commands
on the server? My final goal is to be able to connect to the HTTP server on the at 192.168.1.2
from the client as localhost.
Solution 1:
I found a tool called chisel that let me do exactly what I wanted to do.
For this you will have to have some kind of a way to execute commands. I was able to upload the executable file to the server and work with it.
chisel server --reverse --port 9001 # Client side
This will start a reverse proxy and listen on port 9001 for any connections on the client side.
chisel client 192.168.1.3:9001 R:8080:127.0.0.1:8080 # Server side
By executing this, a connection will be made to the server at the client side and forward the traffic for the specified port(in this case 8080) to the server at the server side.