Skip to content
Localtonet Localtonet Dashboard

Load balancing with tunnel targets

Desktop v8.1+ Mobile v10.5+

On this page 9 sections
  1. Before you start
  2. Where to find it
  3. Set up targets
  4. Open the Load balancing page
  5. Choose the traffic distribution
  6. Add the targets
  7. Save
  8. Enable load balancing
  9. Distribution modes
  10. Target fields
  11. Additional settings
  12. When a target is offline
  13. Go back to the original target
  14. Troubleshooting
  15. Related pages

Load balancing lets one tunnel send traffic to more than one device. Each device is a target: you can distribute traffic across the targets, or keep one as a backup for when another is unavailable.

Before you start #

  • A tunnel that already works with one device.
  • The Localtonet client on every device you want to use as a target, each connected with its own AuthToken. See AuthTokens.
  • An up-to-date client on all of them. To use load balancing, update Localtonet to Mobile v10.5 or higher, or Desktop v8.1 or higher.
  • The same service on every target. Localtonet sends traffic to the targets; it does not copy your application, its files or its sessions between devices.

Where to find it #

Load balancing is part of a tunnel's settings. Open the list page of the tunnel, select the tunnel's Settings icon and, under Load Balance, select Manage targets. The Load balancing page of that tunnel opens. Back to tunnels returns to the list.

The Load Balance section is in the settings of these tunnel types:

Tunnel typeWhat a target isHow traffic is spread
HTTPA device and the local address of the service on it.HTTP requests are distributed. WebSockets and streaming connections stay on the selected device.
TCP, TLSA device and the local address of the service on it.Each new connection selects a target and stays there until it closes.
UDPA device and the local address of the service on it.Each UDP flow stays on one target; its packets are not split across devices.
UDP / TCP MixedA device and the local address of the service on it.TCP connections and UDP associations stay on their selected devices.
File Server, MCP GatewayA device only. It uses the tunnel's own service settings, and its data must be available there.Like HTTP. An SFTP file server works per connection.
Proxy ServerA device only. Traffic exits through this device; a local application port is not required.Per connection. For SOCKS5 and Shadowsocks, TCP connections and UDP associations stay on their selected devices.

The Rotating Proxy page does not have this section; a rotating proxy takes its devices from token groups.

Set up targets #

  1. Open the Load balancing page #

    Open the tunnel's Settings and select Manage targets. The first time, the list already holds one target: the tunnel's own token and local address.

  2. Choose the traffic distribution #

    Under Traffic distribution, select Single target, Round robin or Failover. The modes are described below.

  3. Add the targets #

    Select Add target, choose the Auth token of the device and, for tunnels that forward to a local service, enter the Local IP / hostname and Port of the service on that device. Select Add target in the window. Repeat for each device.

  4. Save #

    Select Save changes. Saving settings does not switch traffic: the tunnel keeps using its original target until you apply the settings.

  5. Enable load balancing #

    Under Traffic routing, select Enable load balancing, read the confirmation and select Apply to this tunnel. Traffic switches after the targets are ready. Existing connections are not retried on another device.

When you change the targets later, select Save changes and then Apply saved changes under Traffic routing. Reset discards changes you have not saved.

Distribution modes #

ModeWhat it doesRules
Single targetSends traffic to one device.Requires exactly one enabled target. To use several, choose Round robin or Failover.
Round robinShares traffic across devices. Each new request, connection or flow goes to the next ready target in turn.Needs at least one enabled target.
FailoverUses a backup if the first fails. New traffic goes to the ready target with the lowest Failover priority number.Set a priority on each target. Lower numbers are used first.

Target fields #

FieldWhat it doesValues
Auth tokenThe token of the device that runs your service. Search by token name to find a device; the list shows the first 50 matches.Required
Local IP / hostnameThe address of the service on the selected device. Targets may have different IPs or ports. Shown only for tunnels that forward to a local service.An IP address or hostname, without a scheme or path. 127.0.0.1 for the device itself.
PortThe port of the service on the selected device.1 to 65535
Display nameOptional name shown in the target list. Without one, the token name is used.Up to 80 characters
Failover priorityThe order in Failover mode. Lower numbers are used first. Under Advanced settings, shown only in Failover mode.0 to 9999
Connection limitThe most connections this target takes at one time. A target at its limit gets no new traffic until a connection ends. Under Advanced settings.0 to 1000000. 0 uses the tunnel's limit.
EnabledClear it to keep the target in the list without using it.On or off
Stop new trafficThe target takes no new traffic; the list shows it as Draining. Use it before you take a device out of service.On or off

The same token and local address cannot be added twice. To change a target select Edit; to remove one select the bin icon, and Undo brings it back until you save.

Target limit. A tunnel can have 32 targets. At that point the page shows "This tunnel has 32 targets. Remove a target before adding another."

Additional settings #

  • UDP flow idle timeout, for tunnels that carry UDP: a UDP flow stays on the same device until it expires. From 10 to 3600 seconds; the default is 60.
  • Service data and permissions are available on every target, for File Server and MCP Gateway tunnels: tick it to confirm before you save more than one target. Localtonet does not replicate files or application sessions, so every target must hold the same folder or gateway data.

When a target is offline #

After you enable load balancing, Traffic routing shows how many targets are ready, for example "2 of 3 targets ready", and Target status lists each one:

StatusMeaning
ReadyThe device and its local service are ready. The target gets new traffic.
Not readyThe device reported that the target is not ready. It gets no new traffic.
WaitingNo recent status has arrived from the device. It gets no new traffic.
DisabledEnabled is cleared for this target.
DrainingStop new traffic is ticked for this target.
  • New traffic only goes to ready targets. Round robin skips a target that is not ready. Failover moves to the ready target with the next priority.
  • When a target is ready again, it takes new connections. Connections that are already open stay where they are.
  • A connection that was open on a target when it went offline is lost. Existing connections are not retried on another device.
  • If no target is ready, the badge shows No ready targets: new traffic has no target to go to until one is ready.
  • Paused means new traffic is paused until the tunnel and its targets are available. Traffic is paused by the tunnel, account or device settings.

Go back to the original target #

Select Use original target under Traffic routing and confirm. New connections then use the tunnel's original token and local address, so make sure that application and service are running. Your target settings stay saved, and you can enable them again later.

Restore the original target before you move the tunnel to another server.

Troubleshooting #

"Single target requires one enabled target. Choose Round robin or Failover to use multiple targets."

You have more than one enabled target in Single target mode. Change the mode, or disable the extra targets.

"Add or enable at least one target that accepts new traffic."

Every target is disabled or set to Stop new traffic. Enable one.

"Confirm that service data and permissions are available on every target."

For a File Server or MCP Gateway tunnel with several targets, tick the confirmation under Additional settings.

"Connect an updated application for target …" or "The targets did not become ready."

A selected device is offline, runs an older Localtonet version, or its local service is not running. Start or update the Localtonet app on that device, check the service, then apply again.

"Start the tunnel and check its account, expiry and bandwidth limits before activation."

Load balancing can only be enabled on a tunnel that can run. Start the tunnel and check its expiration date and bandwidth limit.

"The live tunnel has changed since this draft was saved." or "This draft changed in another session."

The tunnel or its targets were changed somewhere else. Reload the page, review the targets and save again.

"Too many saves. Wait a minute, then try again."

Saving is rate limited. Wait a minute before the next save.

"You do not have permission to change these settings."

In a team, changing targets needs the permission to update tunnels. Without it the page is read-only. See Team Management.

Support