Relay servers
How TxHub keeps devices connected when a direct connection is not possible, and how relay servers are chosen for your TxNet.
TxHub always tries to connect your devices directly to each other. Sometimes that isn't possible, for example when both devices sit behind strict firewalls or carrier networks. Then traffic goes through a relay server instead, so the devices stay connected. Most TxNets never need to change anything here.
How it works
- Each device measures how quickly it can reach each relay region and picks the fastest one as its home relay.
- When two devices start talking, the first packets may go through a relay while TxHub looks for a direct path. As soon as a direct path works, traffic switches to it.
- If no direct path can be found, traffic keeps going through the relay. The connection still works, but it is usually slower and has more delay, since every packet makes a detour.
Relays use HTTPS (TCP port 443), so they work on most networks that allow web browsing. Direct connections need outgoing UDP. If a network blocks UDP, devices on it are always relayed.
Your relay servers
New TxNets start with TxHub's relay region in Iceland, named Iceland - TXHub (code ice), with two relay servers. Admins and owners can see and change the list under Settings → Relay servers.
The list is made of regions. A region is a group of relay servers in one place, and devices choose between regions by speed. Each region has a Region ID (a number), a short Code and a Name. Each relay server in a region (shown as a node) has these fields:
| Field | What it is |
|---|---|
| Name | A label for the server, for example ice1. |
| Hostname | The server’s DNS name. Required: devices connect to it by name. |
| IPv4 | The server’s public IPv4 address. Optional. |
| IPv6 | The server’s public IPv6 address. Optional. |
| STUN Port | UDP port devices use to discover their public address. Default 3478. |
| Relay port | HTTPS port for relayed traffic. Default 443. |
| STUN only | Tick if the server only helps with address discovery and doesn’t relay traffic. |
Add a region
- Go to Settings → Relay servers.
- Under Add Region, enter a Region ID, a Code and a Name, then click +. Use a Region ID that isn't already in the list.
- In the new region, click Add node and fill in at least the Hostname. Add more nodes for redundancy.
- Click Save at the top of the page. Connected devices get the new list within seconds.
To remove a region or a node, click its delete icon and then Save. A region can't be saved without at least one node, and every node needs a hostname.
See which relay a device uses
In the dashboard, open a machine from Machines. Under Client Connectivity, Preferred relay server shows the Region ID of the device's home relay.
On the device itself, run:
txhub netcheck
The report shows, among other things:
UDP: whether the device can send UDP. If it saysfalse, direct connections aren't possible from this network and all traffic is relayed.IPv4andIPv6: the public addresses the device was seen from.MappingVariesByDestIP:truemeans the network uses a strict type of NAT that makes direct connections harder.- The nearest relay region, and how long it takes to reach each relay region.
Check if a connection is direct or relayed
Run this on one of the two devices:
txhub status
Look at the last column for the other device:
100.64.0.7 desktop alice@ linux active; direct 203.0.113.25:41641, tx 52344 rx 81232100.64.0.9 laptop alice@ windows active; relay "ice", tx 4120 rx 3880
| Status shows | Meaning |
|---|---|
direct <address> | Traffic goes straight between the devices. |
relay "ice" | Traffic goes through the relay region with that code. |
idle | No recent traffic, so there is nothing to show yet. |
The connection type only shows while the devices are talking. If you see idle or -, send some traffic first, for example with txhub ping laptop, and run txhub status again. A new connection often starts relayed and switches to direct after a few seconds.
Troubleshooting
A connection stays relayed
Relayed connections work, so this is only a problem if they feel slow. To give direct connections a chance:
- Allow outgoing UDP on the firewall of at least one of the two networks.
- Run
txhub netcheckon both devices. If one showsUDP: false, that network is the cause. - Corporate, hotel and mobile networks often block direct connections. Try the same devices from another network to compare.
Devices can't reach each other at all
- Check that both devices are connected with
txhub status. - Check that your access policy allows the traffic. A relay doesn't bypass the access policy.
- If you changed Settings → Relay servers, check that each relay hostname resolves and that port 443 is reachable from the devices.
See also Troubleshooting.