Thursday, June 27, 2013

SSH Port Forwarding

Hi Friends,

Let’s understand SSH Port forwarding concept with below examples.
I have two machine station-y (172.24.40.110) and station-z(172.24.40.120)

Example 1)

[root@station-z ~]# ssh -L 8080:yahoo.com:80 -N root@172.24.40.110
(I, SSH Client will listen for traffic on my host's port 8080 and send it to you, SSHD on 172.24.40.110. 

You will decrypt it and forward that traffic to port 80 on yahoo.com)
So after executing above command on station-z, when station-z tries to access http://localhost it will redirect to yahoo.com

Example 2)
[root@station-z ~]# ssh -R 8080:127.0.0.1:25 -N 172.24.40.110

(You the SSHD on 172.24.40.110 will listen for the traffic on your port 8080 and send it to me. I, ssh client will decrypt it and forward that traffic to port 25 on me as if it came from me.)


So after executing above command on station-z, when station-y tries to access their local port 8080 ([root@station-y ~]# telnet 0 8080)  it will redirect to port 25 of station-z 

No comments:

Post a Comment

Renew k8s certificates

Check If certificate expires: amikum@~:03:06:54(⎈ |local-cluster:default):sudo kubeadm certs check-expiration CERTIFICATE                EXP...