مواد پر جائیں
Localtonet Localtonet ڈیش بورڈ

یہ صفحہ ابھی اردو میں دستیاب نہیں ہے۔ اسے انگریزی میں دکھایا جا رہا ہے۔

Start a tunnel with your SSH client

Free plan HTTP and TCP tunnels

اس صفحے پر مدد
اس صفحے پر 11 سیکشنز
  1. When to use it
  2. Before you start
  3. Steps
  4. Create an HTTP or TCP tunnel
  5. Open the SSH command
  6. Choose whether it should reconnect
  7. Run the command
  8. Keep the window open
  9. From the Tunnel Setup Wizard
  10. The command explained
  11. Automatic reconnect
  12. How long a command stays valid
  13. Limits
  14. What you see in the dashboard
  15. Troubleshooting
  16. Messages in the dashboard
  17. Messages in the terminal
  18. Related pages

Put a local service online without installing Localtonet. The dashboard gives you a ready-made ssh command; while that command runs, your HTTP or TCP tunnel is live.

When to use it #

Use zero-install SSH on a machine where you cannot or do not want to install the Localtonet client, for example a server you only reach for a moment, a locked-down work machine or a quick demo. The ssh client that comes with Windows, macOS and Linux is all you need.

The SSH command replaces the Localtonet client for one tunnel. Everything else stays in the dashboard: the tunnel's address, its settings, its logs and its bandwidth.

Tunnel typeSSH command
HTTP / HTTPSAvailable
TCPAvailable
UDP, UDP / TCP Mixed, TLS, File Server, Proxy Server and the other typesNot available. These need the Localtonet client.

This page is not about reaching an SSH server. To publish your own SSH server through a tunnel, see Using Localtonet with SSH. To open a shell on one of your devices from the dashboard, see Device Terminal.

Before you start #

  • A Localtonet account and a service that is already running, for example a web app on port 3000.
  • An ssh client on the machine that can reach the service. Check with ssh -V.
  • Outgoing TCP connections to port 223 must be allowed on that machine's network.
  • An AuthToken that no running Localtonet client uses. A tunnel always belongs to a token, but with SSH no client signs in with it. If a client is connected with the tunnel's token, the dashboard refuses to issue the command.

Steps #

  1. Create an HTTP or TCP tunnel #

    Open My Tunnels › HTTP or My Tunnels › TCP - UDP (protocol TCP) and create the tunnel as usual. Local IP address and Local port are where the SSH client will send the traffic: 127.0.0.1 and the port of your service when you run the command on the same machine as the service. Leave the tunnel stopped.

  2. Open the SSH command #

    In the tunnel list, select Settings for the tunnel, then Show SSH Command. The SSH command dialog opens with the command for this tunnel. A notice tells you how many seconds you have to run it; an unused command expires, and you then request a new one the same way.

  3. Choose whether it should reconnect #

    Leave Reconnect automatically off to get the plain ssh command. Turn it on to wrap the command in a loop that starts it again when the connection drops, then choose under Where you’ll run it which shell the loop is written for: PowerShell, Command Prompt or macOS or Linux.

  4. Run the command #

    Copy the text under Command. Open a terminal on the computer that runs your service, paste the command and press Enter. No password is asked. When the connection is up, the terminal shows the tunnel's endpoints:

    Terminal
    +--------------------------------------------------------------+
    | Welcome to Localtonet!                                       |
    +--------------------------------------------------------------+
    | Localtonet Tunnel Endpoints                                  |
    +--------------------------------------------------------------+
    | HTTP => http://<YOUR_ADDRESS> => 127.0.0.1:3000               |
    | HTTPS => https://<YOUR_ADDRESS> => 127.0.0.1:3000             |
    +--------------------------------------------------------------+
    | Server Time: ...                                             |
    +--------------------------------------------------------------+
    
    You can view your requests and configure your tunnel settings from the Localtonet Dashboard.

    A TCP tunnel shows one line instead: TCP => <YOUR_ADDRESS>:<PORT> => 127.0.0.1:<LOCAL_PORT>.

  5. Keep the window open #

    The tunnel starts by itself when the command connects; you do not select Start. It is online for as long as the command runs. Closing the window ends the connection, and the public address stops answering. To end the command yourself, type exit and press Enter, or press Ctrl + C.

    Ending the command does not stop the tunnel in the dashboard. The tunnel stays started with its connection shown as off, so that the same command can connect again. When you are done with the tunnel, select Stop for it in the dashboard. The dashboard issues a new SSH command only for a stopped tunnel.

From the Tunnel Setup Wizard #

The Tunnel Setup Wizard on the Dashboard offers the same command. In its last step, where you choose your platform, select SSH and then Get SSH command. The SSH choice only appears for HTTP and TCP tunnels. The wizard shows Waiting for SSH until your command connects and Connected via SSH afterwards. Auto reconnect adds the same reconnect loop, and Get a new command replaces a command that has expired.

The command explained #

The command always has this shape. The dashboard fills in the values for your tunnel:

Bash
ssh -o ExitOnForwardFailure=yes -o ServerAliveInterval=15 -o ServerAliveCountMax=3 -o ConnectTimeout=15 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR -p 223 -l <COMMAND_KEY> <TUNNEL_ADDRESS> -R<SERVER_PORT>:<LOCAL_IP>:<LOCAL_PORT>
PartWhat it does
-p 223Connects to port 223, where Localtonet accepts these SSH connections.
-l <COMMAND_KEY>The login name. It is a key that the dashboard generates for this tunnel, not your AuthToken and not your account password. It tells Localtonet which tunnel to start, which is why no password is asked.
<TUNNEL_ADDRESS>The address of your tunnel. The SSH connection goes to the server that hosts it.
-R<SERVER_PORT>:<LOCAL_IP>:<LOCAL_PORT>The remote forward: connections that arrive for the tunnel on the server are sent through the SSH connection to <LOCAL_IP>:<LOCAL_PORT>. The last two values are the tunnel's Local IP address and Local port. The server port is assigned by Localtonet and must not be changed.
-o ExitOnForwardFailure=yesMakes ssh exit if the forward cannot be set up, instead of staying connected without a working tunnel.
-o ServerAliveInterval=15 -o ServerAliveCountMax=3Sends a keep-alive every 15 seconds and ends the connection after three unanswered ones, so a dead connection is noticed within about 45 seconds.
-o ConnectTimeout=15Gives up after 15 seconds if the server cannot be reached.
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/nullSkips the host key question and does not write the server to your known_hosts file.
-o LogLevel=ERRORHides informational messages of ssh. Errors are still shown.

Because <LOCAL_IP> is resolved on the machine where you run ssh, the service does not have to be on that machine. With a local address such as 192.168.1.20 the command forwards to another device in the same network.

Do not share the command. Whoever runs it while it is valid answers the traffic of your tunnel.

Automatic reconnect #

With Reconnect automatically on, the dashboard wraps the same ssh command in a small script for the shell you chose. For Command Prompt the script is delivered as a single powershell -NoProfile -EncodedCommand … line. The script behaves the same in every shell:

  • When ssh ends, it waits and starts it again. The wait starts at about 10 seconds and doubles after each failed attempt, up to about 2 minutes.
  • A connection that lasted at least 60 seconds counts as a success and resets the waiting time.
  • After 8 attempts in a row that each ended in under 60 seconds, it stops and prints SSH reconnect stopped. If a session or bandwidth limit was reached, get a new SSH command from the panel.

Reconnecting reuses the same command. That works after a network interruption, but not after the tunnel was stopped in the dashboard or reached a limit; in that case the script gives up and you need a new command.

How long a command stays valid #

  • Before first use: the command must be run within the time the dashboard shows when it issues it. After that the port offer expires.
  • While in use: one SSH session per tunnel. A second copy of the command is refused while the first is connected.
  • After the connection ended: the same command can connect again, as long as the tunnel has not been stopped in the dashboard and no limit was reached.
  • After a stop: when the tunnel was stopped in the dashboard or by a limit, the command is finished. Open Show SSH Command again for a new one.

The dashboard only issues a command while the tunnel is stopped. A new command can come with a different server port; on the Free plan every new command gets a new one. For a TCP tunnel that port is part of the public address, so check the address in the terminal output or in the tunnel list after you request a new command. The tunnel's activity log records the change as Server port changed to "…" for SSH.

Limits #

  • Session limit on the Free plan. A tunnel started over SSH follows the same rule as one started with the client: on the Free plan, TCP tunnels stop after 30 minutes and can be started again, and HTTP tunnels have no time limit. The 30 minutes count from the first time a command connects; reconnecting with the same command does not restart them. When a TCP session reaches the limit, the server closes the SSH connection with the message Session time limit reached. Get a new SSH command from the panel. See Plans and Balance.
  • Bandwidth. Traffic counts towards your bandwidth like any other tunnel traffic. Without remaining bandwidth, no command is issued, and the server closes a running session with the message Bandwidth limit reached. Get a new command after bandwidth is available.
  • Reverse forwarding only. The SSH endpoint accepts the one forward from the command. It gives you no shell on a Localtonet server and no other kind of forwarding.
  • One tunnel per command. To run several tunnels, request a command for each and run each in its own terminal.

What you see in the dashboard #

While the command is connected, the tunnel is shown as started, and requests appear in its logs as usual. The Activity Log of the tunnel records Tunnel started over SSH. when a command connects. See Logs and inspection.

Troubleshooting #

Messages in the dashboard #

MessageWhat to do
Stop the tunnel before requesting an SSH command.The tunnel is running with the Localtonet client. Stop it, then select Show SSH Command again.
Stop the current SSH tunnel before requesting a new command.The tunnel is still started over SSH, or an SSH session of it was active a moment ago. End the running ssh command, select Stop for the tunnel, then try again.
A client is connected to this tunnel with the AuthToken you created. Create a new AuthToken.A Localtonet client is signed in with the tunnel's token. Stop that client, or create another token in My Tokens and use it for this tunnel.
You do not have enough remaining bandwidth to start the tunnel.Your bandwidth is used up. See Plans and Balance.
This feature is not available for this protocol type.The tunnel is not an HTTP or TCP tunnel.
This feature is not available on this server. Move your tunnel to another server.The server of this tunnel does not offer SSH commands. Create the tunnel on another server.
A tunnel operation is in progress. Please try again shortly.Wait a few seconds and try again.
A new server port could not be assigned.Try again. If it keeps failing, create the tunnel on another server.
The SSH port could not be saved. Please try again.Try again.

Messages in the terminal #

When the server closes a session, it sends one of the messages below as the reason. How the reason is shown depends on your ssh client.

Message or symptomCause and fix
ssh ends right away with an authentication error, typically Permission deniedLocaltonet did not accept the command. It was not run in time, the tunnel was stopped or reached a limit since it was issued, another session of the same command is already connected, or the text was changed while copying. Get a new command from the dashboard and paste it unchanged.
Port mismatch. Get a new SSH command from the panel.The server port after -R is not the one Localtonet assigned. Use the command exactly as issued.
Session time limit reached. Get a new SSH command from the panel.The 30-minute session of a TCP tunnel on the Free plan ended. Request a new command to start again.
Bandwidth limit reached. Get a new command after bandwidth is available.Your bandwidth is used up.
Session stopped. Get a new SSH command from the panel.The tunnel was stopped, for example from the dashboard.
A connection timeout, or Connection refusedThe machine cannot reach the server on port 223. Allow outgoing TCP connections to port 223 in the firewall or try from another network.
The tunnel is live but visitors get an errorssh is connected but cannot reach your service. Check that the service runs and that the tunnel's Local IP address and Local port are right. After changing them, request a new command, because the old one still contains the old values.
سپورٹ