Local port forwarding

Command explanation

To forward port of remote host use the following command

ssh -L <LOCAL_PORT>:<TUNNEL_IP>:<DESTINATION_PORT> <user>@<server_ip>

-L stands for local adress because we are tunneling connection on local machine, TUNNEL_IP is 127.0.0.1

ssh -L <LOCAL_PORT>:127.0.0.1:<DESTINATION_PORT> <user>@<server_ip>

Real life example

ssh gnumik@69.69.69.69
ssh -L 5433:127.0.0.1:5432 gnumik@69.69.69.69

P.S. I use arch btw


Revision #2
Created 16 April 2024 19:08:54 by s4m1d
Updated 16 April 2024 19:27:13 by s4m1d