-L is a local tunnel (YOU <-- CLIENT). If a site was blocked, you can forward the traffic to a server you own and view it. For example, if imgur was blocked at work, you can do ssh -L 9000:imgur.com:80 user@example.com. Going to localhost:9000 on your machine, will load imgur traffic using your other server.

ssh -L 90:localhost:10000 USERNAME@<TARGET_IP>
ssh -L 127.0.0.1:90:localhost:10000 USERNAME@<TARGET_IP>    AYNISI
ssh -L localhost:90:localhost:10000 USERNAME@<TARGET_IP>

Karşı taraftaki 10000'de portta dinleme yapan servisin benim localhost'umda ki 90.porta bağlanmasını istiyoruz.

http://localhost:90

-L : Belirtilen lokal portun, uzaktaki hedef sunucunun belirtilen portuna yönlendirilmesini belirtir.

-R is a remote tunnel (YOU --> CLIENT). You forward your traffic to the other server for others to view. Similar to the example above, but in reverse.NAT yada Firewall arkadsından erişim sağlamak istediğimizde bunu kullanabiliriz.Default olarak ssh uzak sunucudan port forwarding almıyor bunu aktif etmek için;

nano /etc/ssh/sshd_config

GatewayPorts yes "satırı eklenecek"

 sudo service ssh restart

Bu, uzak bir sunucudaki bir bağlantıyı, SSH bağlantınız üzerinden yerel bilgisayarınızdaki bir bağlantıya yönlendirmek için kullanılır. Örneğin, uzak bir sunucudaki 22 numaralı porta yönlendirilen bir SSH bağlantısı oluşturursanız, bu bağlantı üzerinden uzak sunucuya SSH oturumu açabilirsiniz.

Örneğin uzak b ir 123.45.67.89'da çalışan bir sunucuda ki bağlantımın localimde ki 8080 portuma kendi 80.porttan erişmesini istiyorsam :

ssh -R 80:localhost:8080 user@123.45.67.89

Dynamic Port Forwarding

ssh -D localport ssh_server@hostname
ssh –D 5534 pnap@ssh.server.com
sudo nano /etc/proxychains4.conf
socks4 127.0.0.1 9050  # en alta ekle

Hedeften hedefe çalıştırmak için örneğin nmap

proxychains nmap -v -p 22,3000,21,445,139 172.16.147.128