A-ads

How to setup ssh tunneling on Termux | port forwarding

 Hey guys welcome to our another useful blog post.In my previous posts I explained that how we can create tunnels using ngrok and cloudflare.In this tutorial I am going to explain an another useful method of port forwarding for Termux, using ssh and localhost.run.

What is ssh tunneling

An ssh tunnel is a method of transporting data that uses the secure shell (ssh) protocol. It can be used to create a secure connection between two hosts, or to tunnel traffic through an insecure network.

How to setup ssh tunneling on Termux | port forwarding

Send whatsapp messages with voice command

Types of ssh tunneling

There are three types of SSH tunnels: Local, Remote, and Dynamic.

A Local tunnel establishes a connection between two machines that are on the same network. This is the most common type of tunnel and is used when you want to access services on a remote machine from your local machine.

A Remote tunnel establishes a connection between two machines that are not on the same network. This type of tunnel is used when you want to access services on a remote machine from a machine that is not on the remote machine's network.

ssh dynamic tunneling is a way to create a secure connection between two computers. It is useful for connecting to a remote server, or for bypassing firewalls.
To create a ssh dynamic tunnel, you will need an ssh client and a server. The ssh client is the program that you use to connect to the server. The server is the computer that you want to connect to.

This article will explain how to create a remote ssh tunnel on Termux

Remote port forwarding on Termux with ssh , localhost.run

Remote port forwarding is a technique used to bypass firewalls and access blocked websites or services. It is also used to connect to a remote computer or server securely. When you enable remote port forwarding, you create a secure tunnel between your computer and the remote computer or server. Data passing through this tunnel is encrypted, so it cannot be read by anyone else.

Below is the steps of forwarding ports on Termux with ssh and localhost.run

Step1

Open the termux application and update and upgrade the all packages 

Step2

Install three packages php,ssh and vim on Termux. Php will be use to create a local server ,ssh for port forwarding and vim editor will help us to create an index.html file.

Step3

Now create an HTML file index.html with vim editor.Copy the whole script given below 

<html>
<body> 
<h1>
This is a demo website
</h1>

</body>

</html>

Then use the command 

  and paste the script which you had copied.Then press ESC + : +wq and hit the ENTR to save the file.

Step4

After creating the index.html file we have to start the php server.So copy paste the given command on Termux to start the php server

Step5

Now create a new session and use the given command to generate a key for ssh


After executing the above command you will get a message "Enter file in which to save the key" press the Enter button then termux will ask you to enter your password .Do it carefully then your rsa key will be generated successfully.

keep in mind that your password will not be visible while typing. So don't be fooled and type your password correctly.

How to setup Cloudflare on Termux for port forwarding

Step6

Now we are all set to create our tunnel with localhost.run , just copy paste the below command on Termux.


It will ask you to enter your password again ,do it and press Enter. Wait for a few seconds and you will get the link ends with lhrtunnel.link.Now you can send this link to anyone.

To be confirm, copy the link and paste it into your Google Chrome browser, the output will look like this 👇

How to setup ssh tunneling on Termux | port forwarding

Conclusion

Port forwarding is a process that allows you to remotely access services that are available on your local network. This article provides an overview of how port forwarding can be done on Termux with ssh .For more information on port forwarding, ethical hacking and other networking topics, follow our blog.




Post a Comment

2 Comments