When a device has more than one internet connection, such as a second line or a USB modem, you can send one tunnel through a specific network. Other tunnels keep using the default connection. You choose the network with two values: its name and the device's IP address on it.
Before you start #
- A device with at least two active networks, and the Localtonet client installed on it. See Install.
- A tunnel of a type that has the Arguments setting: HTTP, TCP - UDP, TLS or Proxy Server.
- On Linux, run the client as root or with passwordless
sudo. The client adds routing rules for the selected network with theipcommand; without that permission the traffic may leave through the default route.
Steps #
-
List the networks of the device #
On the device, run:
Terminallocaltonet --networkThe command needs no AuthToken. It lists every active network with its IP addresses, checks each IPv4 address for internet access, and exits:
OutputNetworkName: Ethernet 2 --net Ethernet 2 --ip 192.168.8.100 --> Internet available (public IP 203.0.113.25) -------------------------------------------------- NetworkName: Wi-Fi --net Wi-Fi --ip 192.168.1.20 --> Internet available (public IP 198.51.100.7) --net Wi-Fi --ip 2001:db8::20 --> IPv6, internet check not available --------------------------------------------------Each line that starts with
--netis a ready-made pair of network name and IP address. Note the pair of the network you want. A line that ends withNo internet accessbelongs to an address whose internet check failed. After the list, the command prints a short explanation of--netand--ip. -
Open the Arguments setting of the tunnel #
In the dashboard, open the page of the tunnel type, select Settings in the row of the tunnel, then Arguments › Manage. The Network selection dialog opens.
-
Enter the network #
Turn on Use a specific network and fill in both fields:
Field What to enter Example Network name The name exactly as localtonet --networkprints it afterNetworkName:.Ethernet 2Device IP on that network The IPv4 or IPv6 address of the device on that network, from a --netline of that network.192.168.8.100Sent to the app shows the resulting arguments, for example
--net Ethernet 2 --ip 192.168.8.100. -
Save #
Select Save. A running tunnel is restarted and from then on uses the selected network.
The arguments in text form #
Edit as text switches the dialog to one Arguments field, and Use the form switches back. The text has this form:
--net <NETWORK_NAME> --ip <IP_ADDRESS>--netand--ipmust be given together. With only one of them the tunnel has no network of its own: it uses the default network, or the network selected for the whole client.- A network name with spaces can be written as it is, or in quotes:
--net Wi-Fi 2 --ip 192.168.1.5and--net "Wi-Fi 2" --ip 192.168.1.5mean the same. - The name is matched exactly first. A name that differs only in upper and lower case is accepted when it fits exactly one network.
- The IP address must be one the device currently has on that network.
What the selected network is used for #
- The tunnel's connection from the device to the Localtonet server.
- For a proxy tunnel, the traffic that leaves the device directly towards the internet, and the DNS lookups for it. If the proxy tunnel has an Upstream Setting, the connection to the upstream proxy is not bound to the selected network.
- The connection to your local service, when that service is reached over the selected network. A service on the device itself (
127.0.0.1) or on another local network is reached the normal way.
When the network is not available #
When the selected network is missing, the tunnel does not fall back to the default connection: its connections stay closed. This matters for proxies: traffic must not leave through a different line than the one you chose.
- If the network is missing when the tunnel starts, the tunnel waits for it.
- If the network disappears later, the tunnel's connections stay closed until the pair of network name and IP address is available again. The client checks again every few seconds and when the device's networks change, and the tunnel resumes by itself.
- If the device gets a different IP address on that network, the pair no longer matches and the tunnel stays closed. Give the device a fixed address on that network, or update the setting.
Start the client with your token and --debug (localtonet --authtoken <YOUR_TOKEN> --debug) to see the reason in its error output. The line starts with a time stamp and [debug][proxy], then names the tunnel by its internal identifier, the problem and the pair it waits for:
[2026-11-14 10:15:30.123 UTC][debug][proxy] Tunnel <TUNNEL_IDENTIFIER>: Network interface 'Ethernet 2' was not found. Run 'localtonet --network' to list the interfaces. Its connections stay closed until --net Ethernet 2 --ip 192.168.8.100 is available.Other problems it can name include "'192.168.8.100' is not an address of network interface 'Ethernet 2'.", "Network interface 'Ethernet 2' is Down." and "The --ip value is not an IP address."
Select a network for the whole client #
To select one network for the client's own connection and for every tunnel without a network of its own, pass the same two options when you start it:
localtonet --authtoken <YOUR_TOKEN> --net <NETWORK_NAME> --ip <IP_ADDRESS>- Both options are required. With only one, the client prints "--net and --ip must be given together; the default network is used." and continues on the default network.
- If the network is not available at start, the client waits up to 30 seconds for it and then stops with the reason, instead of running on another network.
- A tunnel that has its own network in Arguments uses that one. The options of the client apply to the tunnels without one.
All command-line options are listed in the CLI reference.
Example: two proxies on two modems #
A computer has two USB modems. localtonet --network prints --net Modem A --ip 192.168.8.100 and --net Modem B --ip 192.168.9.100. Create two Proxy Server tunnels on the device's AuthToken. In the first, open Arguments › Manage and enter Modem A and 192.168.8.100; in the second, enter Modem B and 192.168.9.100. Each proxy now leaves through its own modem, and a proxy stops passing traffic when its modem is unplugged.
The same setting through the API #
The arguments of a tunnel can be read (GET) and set (PATCH) under /api/v2/tunnels/<TUNNEL_ID>/arguments. Send an empty value to remove them. A value set through the API is used the next time the tunnel starts. See API.
{ "arguments": "--net Ethernet 2 --ip 192.168.8.100" }Troubleshooting #
"Enter the network name." or "Enter the device’s IP address on that network."
Both fields are required while Use a specific network is on. To stop using a specific network, turn the switch off and save.
"Enter an IP address such as 192.168.8.100."
The second field takes the IP address of the device on that network, not the name of the network and not the public IP address.
"Check the device connection."
Saving restarts a running tunnel, and the Localtonet app of its device is not connected. Start the app, or stop the tunnel and save again.
The tunnel is started but passes no traffic
The selected network is probably not available. Run localtonet --network on the device and compare the name and the IP address with the setting. Correct the setting, or bring the network back up.
On Linux the traffic still leaves through the default route
The client probably could not add the routing rules. Run it as root or allow passwordless sudo for the ip command, then restart the client. The client adds no rules for a network that reports no gateway.
localtonet --network prints "No active network interface with an IP address was found."
The device has no network that is up and has an address. Connect a network and run the command again.