Basically tunneling is process which allows data sharing or communication between two different networks privately. Tunneling is normally perform through encapsulating the private network data and protocol information inside the public network broadcast units so that the private network protocol information visible to the public network as data.
SSH Tunnel: Tunneling is the concept to encapsulate the network protocol to another protocol here we put into SSH, so all network communication are encrypted. Because tunneling involves repackaging the traffic data into a different form, perhaps with encryption as standard, a third use is to hide the nature of the traffic that is run through the tunnels.
Types of SSH Tunneling:
- Dynamic SSH tunneling
- Local SSH tunneling
- Remote ssh tunneling
Objective: To establish SSH connection between remote PC and local system of different network.
Here I have set my own lab which consist three systems in following network:
- SSH server (two Ethernet interface)
- IP 192.168.1.22 connected to remote system 192.168.1.21
- IP 192.168.10.2 connected to local network system 192.168.10.2
- SSH client (local network) holds IP 192.168.10.2
- Remote system (outside network) holds IP 192.168.1.21
In following image we are trying to explain SSH tunneling process where a remote PC of IP 192.168.1.21 is trying to connect to 192.168.10.2 which is on INTRANET of another network. To establish connection with SSH client, remote PC will create SSH tunnel which will connect with the local system via SSH server.
NOTE: Service SSH must be activated on server as well as client machine.
Given image below is describing the network configuration for SSH server where it is showing two IP 192.168.1.22 and another 192.168.0.1 as explain above.
Another image given below is describing network configuration for SSH client which is showing IP 192.168.10.2
Remote Pc (192.168.1.21) is trying to connect to SSH server (192.168.1.22) via port 22 and get successful login inside server.
Similarly now Remote PC (192.168.1.21) trying to connect with Client PC (192.168.10.2) via port 22, since they belongs to different network therefore he receive network error.
Step for SSH Dynamic tunneling
- Use putty to connect SSH server (192.168.1.22) via port 22 and choose option SSH >Tunnel given in the left column of category.
- Give new port forwarded as 7000 and connection type as Dynamic and click on ADD at last.
- Click on open when all things are set.
This will establish connection between remote pc and SSH server.
Now login into putty again give IP of client system as Host Name 192.168.10.2 and Port 22 for SSH then click on open.
Open previous running window of putty choose Proxy option from category and follow given below step:
- Select proxy type as SOCKS 5
- Give proxy hostname as 127.0.0.1 and port 7000
- Click on open to establish connection.
Awesome!! We have successfully access SSH client via port 7000
Author: AArti Singh is a Researcher and Technical Writer at Hacking Articles an Information Security Consultant Social Media Lover and Gadgets. Contact here