உள்ளடக்கத்திற்குச் செல்
Localtonet Localtonet டாஷ்போர்டு

இந்தப் பக்கம் இன்னும் தமிழ் மொழியில் கிடைக்கவில்லை. ஆங்கிலத்தில் காட்டப்படுகிறது.

Reach an SSH server through Localtonet

இப்பக்கத்திற்கு உதவி
இந்தப் பக்கத்தில் 9 பிரிவுகள்
  1. How it works
  2. Before you start
  3. Create the tunnel
  4. Open the TCP - UDP page
  5. Fill in the form
  6. Start the tunnel and copy the address
  7. Connect from outside
  8. Save the connection in ~/.ssh/config
  9. Keep the same address
  10. Secure it
  11. Related features that are not this
  12. Common problems
  13. Related pages

Log in to a computer over SSH from anywhere, without port forwarding or a static IP: a TCP tunnel gives the SSH server on that computer a public host name and port.

How it works #

The Localtonet client runs on the computer you want to reach, or on another device in the same network. You create a TCP tunnel that points to the SSH port, usually 22. Localtonet gives the tunnel a public address made of a host name and a port. An SSH client that connects to that address reaches your SSH server. The details of TCP tunnels are on the TCP page.

Before you start #

  • A Localtonet account and the Localtonet client connected with your AuthToken. See Quick start.
  • An SSH server that is running on the device. Check that ssh <USER>@127.0.0.1 works on the device itself before you create the tunnel.
  • An SSH client on the computer you connect from.

Create the tunnel #

  1. Open the TCP - UDP page #

    Open My Tunnels › TCP - UDP and expand Create TCP - UDP Tunnel.

  2. Fill in the form #

    FieldWhat to enter
    ProtocolTCP
    Device tokenThe token the Localtonet client on the device uses.
    Server regionChoose a region close to your device for lower latency.
    Local IP address127.0.0.1 when the SSH server runs on the same device as the client. To reach another machine in the same network, enter its address, for example 192.168.1.20.
    Local port22, or the port your SSH server listens on.
    URL typeRandom subdomain. Custom subdomain lets you choose the name and needs Balance.

    Select Create tunnel.

  3. Start the tunnel and copy the address #

    The tunnel appears under Your tunnels. Select Start. The URL column now shows the public address as host:port, and the Server Port column shows the port on its own. Select either one to copy it.

Connect from outside #

Use the host name and the port from the tunnel list. Replace <USER> with a user account on the device.

Terminal
ssh -p <TUNNEL_PORT> <USER>@<TUNNEL_HOST>

scp and sftp take the port with an upper-case -P:

Terminal
scp -P <TUNNEL_PORT> ./report.pdf <USER>@<TUNNEL_HOST>:/home/<USER>/

Save the connection in ~/.ssh/config #

Add an entry to ~/.ssh/config on the computer you connect from, so you don't have to type the host and port each time:

~/.ssh/config
Host home-server
    HostName <TUNNEL_HOST>
    Port <TUNNEL_PORT>
    User <USER>
    IdentityFile ~/.ssh/id_ed25519

Then connect with the short name:

Terminal
ssh home-server

Keep the same address #

The host name stays with the tunnel. The port is assigned by the server when the tunnel starts, and the Is Reserved? switch in the tunnel's Settings decides whether it stays:

  • Is Reserved? on: the port stays the same when the tunnel or the Localtonet client restarts. Tunnels that you create while your account has Balance start with it on.
  • Is Reserved? off: the port changes when the tunnel or the client restarts. Update Port in ~/.ssh/config after each start.

Turning on Is Reserved? needs Balance and a started tunnel. With Balance you can also choose the port yourself under Server Port › Change: a number from 501 to 65535, so the public port can't be 22. See Ports.

Free plan. A TCP tunnel stops after 30 minutes on the Free plan and can be started again. The port can be different after each start. See Plans and Balance.

Secure it #

A started tunnel is reachable by anyone who has its address. Automated scanners find open SSH ports quickly, so protect both the SSH server and the tunnel.

  • Use keys, not passwords. Set PasswordAuthentication no and PermitRootLogin no in sshd_config once key login works.
  • IP Restriction. In the tunnel's Settings, select IP Restriction › Manage, choose Allow only these and add the addresses you connect from. Use my IP fills in your current address. Changes apply right away. IP Restriction needs Balance. See Access control.
  • Expiration Date. For temporary access, Expiration Date › Manage stops the tunnel on a date you set. See Limits and expiration.
  • Stop the tunnel when you don't need it. A stopped tunnel accepts no connections.

Your SSH server sees the Localtonet client as the source. Connections arrive from the client on your device, so the SSH server logs 127.0.0.1 (or the client device's local address) instead of the visitor's address. Tools that block by source address on the device, such as fail2ban, can't tell visitors apart. Filter by address with IP Restriction on the tunnel, and see who connected under Request Log › Show in the tunnel's Settings.

FeatureWhat it doesUse it when
Zero-install SSHStarts a tunnel with a plain ssh command, without installing the Localtonet client. The Show SSH Command button in a TCP tunnel's Settings gives you that command.You can't or don't want to install the client on the device.
Device TerminalOpens a shell on a device from My Devices in the dashboard.You want a terminal on your own device and don't need to give an SSH address to other tools or people.

Show SSH Command is not the login command. It starts the tunnel from the device. To log in to your SSH server, use ssh -p <TUNNEL_PORT> <USER>@<TUNNEL_HOST> as shown above.

Common problems #

Connection refused or connection timed out

Check three things in order. The tunnel is started and its Connection column shows ON, which means the Localtonet client is connected. The port you use is the current Server Port. The SSH server answers on the device itself at the Local IP address and Local port of the tunnel.

It worked yesterday and now the port is wrong

The port is not reserved, so it changed when the tunnel or the client restarted. Copy the new port from the tunnel list, or turn on Is Reserved?.

SSH asks me to confirm the host key again

SSH remembers host keys per host name and port. When the tunnel's port changes, SSH treats the address as a new host and asks again. Compare the fingerprint with the one of your server before you accept it.

The tunnel stopped by itself after half an hour

On the Free plan a TCP tunnel stops after 30 minutes. Select Start to begin another session, or add Balance to remove the session limit.

"You need to purchase balance to use this feature."

Is Reserved?, Server Port, IP Restriction and Custom subdomain need Balance. Add it under Balance.

"Start the tunnel first."

You turned on Is Reserved? while the tunnel was stopped. A port can only be reserved after the server has assigned one, so start the tunnel and try again.

இந்தப் பக்கம் குறித்து உதவி வேண்டுமா? சமூகத்திடம் கேளுங்கள் அல்லது ஆதரவு டிக்கெட்டைத் திறங்கள்.

ஆதரவு