LAN and WAN Private Relay Setup Attempts - "use of closed network connection"

Hello, Syncthing has been running great for me, and I would like to set up a private relay.

To show that I have put forth some effort before posting, I have attempted to get this going over four weekends and many nights after work to no avail. During that time I have read 20-30+ articles and forum posts and made 100’s of AI chatbot searches for help.

Since I just want to get anything working, I tried to keep the setup as simple as possible.

Setups attempted:

  1. (LAN) Proxmox - Alpine Container - Latest Github version: v1.22.1
  2. (LAN) Proxmox - Debian Container - Latest Debian syncthing-relaysrv version: v1.19.2 (does not work since tokens were not implemented in this version)
  3. (LAN) Proxmox - Alpine Container - Latest Docker syncthing/relaysrv version: v1.27.7
  4. (WAN) DreamHost DreamCompute - Alpine Instance - Latest Github version: v1.22.1
  5. (WAN) DreamHost DreamCompute - Alpine Instance - Latest Docker syncthing/relaysrv version: v1.27.7
  6. (WAN) DreamHost DreamCompute - Debian Instance - Latest Docker syncthing/relaysrv version: v1.27.7
  7. (LAN) Raspberry Pi 5 - Raspberry Pi OS - Latest Github ARM64 version: v1.22.1

For (LAN) setups, I will use the following IDs and IP addresses:

  • Relay: 192.168.1.1 - RELAY-RELAY-RELAY-RELAY-RELAY-RELAY-RELAY-RELAY
  • Computer: 192.168.1.2 - COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP
  • Phone: 192.168.1.3 - PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE

For the Github or Debian package setups, I run strelaysrv using the following command:

strelaysrv -status-srv="" -pools="" -debug

For the Docker setups, run these commands:

apk add docker
apk add docker-compose
docker pull syncthing/relasrv

I use this docker-compose.yml file:

version: '1.27'
services:
  syncthing:
    image: syncthing/relaysrv
    container_name: syncthing-relay
    hostname: syncthing-relay
    environment:
      - PUID=1000
      - PGID=1000
    network_mode: host
    
    restart: unless-stopped
    entrypoint: ["/bin/entrypoint.sh", "/bin/strelaysrv", "status-srv", "\"\"" , "-pools", "\"\"", "-debug"]

And run it with:

sudo docker-compose up

For all setups, I use UFW to open port 22067 with the following commands:

sudo ufw allow 22067/tcp
sudo ufw enable
sudo reboot

On my phone and computer, I use the following address in the web interface under:

Remote Deivces
	Edit Device
		Advanced
			Addresses
				relay://192.168.1.1:22067/

For all setups, the relay seems to start up fine. My phone and computer IP addresses show up in the relay logs started on the (LAN). I don’t think I have made a connection to my phone and computer to my (WAN) DreamHost setups yet, although I can always ping my DreamHost instance.

For the (LAN) setups, the closest I have got to making a connection are with setups (1.) and (7.). Both relays show similar logs. The Relay log says “use of closed network connection” many times, which I am not sure how to interpret.

Questions:

  • Can anyone point out obvious mistakes in my setup?
  • Does “use of closed network connection” mean that my setup is incorrect?
  • What can I do to get a simple LAN relay working? Anything is fine. Once I have an example working, I can figure it out from there.
  • Why is the Github version (v1.22.1) behind the Docker version (v1.27.7)? Is there somewhere I can download the non-Docker v1.27.7 version?

Thank you for any advice! Syncthing is awesome.

Relay log for setup (7.), though setup (1.) is virtually the same:

./strelaysrv -status-srv="" -pools="" -debug
2024/05/18 11:52:02 main.go:141: strelaysrv v1.22.1 "Fermium Flea" (go1.19.2 linux-arm64) teamcity@build.syncthing.net 2022-11-02 06:27:53 UTC
2024/05/18 11:52:02 main.go:147: Connection limit 838860
2024/05/18 11:52:02 main.go:186: ID: RELAY-RELAY-RELAY-RELAY-RELAY-RELAY-RELAY-RELAY
2024/05/18 11:52:02 main.go:259: URI: relay://0.0.0.0:22067/?id=RELAY-RELAY-RELAY-RELAY-RELAY-RELAY-RELAY-RELAY&networkTimeout=2m0s&pingInterval=1m0s
2024/05/18 11:52:11 listener.go:48: Listener accepted connection from 192.168.1.3:42996 tls true
2024/05/18 11:52:11 listener.go:117: Message protocol.ConnectRequest from PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE
2024/05/18 11:52:11 listener.go:175: PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE is looking for COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP which does not exist
2024/05/18 11:52:11 listener.go:232: Closing connection PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE: read tcp 192.168.1.1:22067->192.168.1.3:42996: use of closed network connection
2024/05/18 11:52:26 listener.go:48: Listener accepted connection from 192.168.1.3:43610 tls true
2024/05/18 11:52:26 listener.go:117: Message protocol.ConnectRequest from PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE
2024/05/18 11:52:26 listener.go:175: PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE is looking for COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP which does not exist
2024/05/18 11:52:26 listener.go:232: Closing connection PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE: read tcp 192.168.1.1:22067->192.168.1.3:43610: use of closed network connection
2024/05/18 11:52:31 listener.go:48: Listener accepted connection from 192.168.1.3:43830 tls true
2024/05/18 11:52:31 listener.go:117: Message protocol.ConnectRequest from PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE
2024/05/18 11:52:31 listener.go:175: PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE is looking for COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP which does not exist
2024/05/18 11:52:31 listener.go:232: Closing connection PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE: read tcp 192.168.1.1:22067->192.168.1.3:43830: use of closed network connection
2024/05/18 11:52:36 listener.go:48: Listener accepted connection from 192.168.1.3:44036 tls true
2024/05/18 11:52:36 listener.go:117: Message protocol.ConnectRequest from PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE
2024/05/18 11:52:36 listener.go:175: PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE is looking for COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP which does not exist
2024/05/18 11:52:36 listener.go:232: Closing connection PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE: read tcp 192.168.1.1:22067->192.168.1.3:44036: use of closed network connection
2024/05/18 11:52:44 listener.go:48: Listener accepted connection from 192.168.1.3:44380 tls true
2024/05/18 11:52:44 listener.go:117: Message protocol.ConnectRequest from PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE
2024/05/18 11:52:44 listener.go:175: PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE is looking for COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP which does not exist
2024/05/18 11:52:44 listener.go:232: Closing connection PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE: read tcp 192.168.1.1:22067->192.168.1.3:44380: use of closed network connection
2024/05/18 11:52:47 listener.go:48: Listener accepted connection from 192.168.1.2:25362 tls true
2024/05/18 11:52:47 listener.go:117: Message protocol.ConnectRequest from COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP
2024/05/18 11:52:47 listener.go:175: COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP is looking for PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE which does not exist
2024/05/18 11:52:47 listener.go:232: Closing connection COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP: read tcp 192.168.1.1:22067->192.168.1.2:25362: use of closed network connection
2024/05/18 11:52:55 listener.go:48: Listener accepted connection from 192.168.1.2:25414 tls true
2024/05/18 11:52:55 listener.go:117: Message protocol.ConnectRequest from COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP
2024/05/18 11:52:55 listener.go:175: COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP is looking for PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE which does not exist
2024/05/18 11:52:55 listener.go:232: Closing connection COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP: read tcp 192.168.1.1:22067->192.168.1.2:25414: use of closed network connection
2024/05/18 11:53:00 listener.go:48: Listener accepted connection from 192.168.1.3:44994 tls true
2024/05/18 11:53:00 listener.go:117: Message protocol.ConnectRequest from PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE
2024/05/18 11:53:00 listener.go:175: PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE is looking for COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP which does not exist
2024/05/18 11:53:00 listener.go:232: Closing connection PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE: read tcp 192.168.1.1:22067->192.168.1.3:44994: use of closed network connection
2024/05/18 11:53:00 listener.go:48: Listener accepted connection from 192.168.1.2:25448 tls true
2024/05/18 11:53:00 listener.go:117: Message protocol.ConnectRequest from COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP
2024/05/18 11:53:00 listener.go:175: COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP is looking for PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE which does not exist
2024/05/18 11:53:00 listener.go:232: Closing connection COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP: EOF
2024/05/18 11:53:05 listener.go:48: Listener accepted connection from 192.168.1.2:25490 tls true
2024/05/18 11:53:05 listener.go:117: Message protocol.ConnectRequest from COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP
2024/05/18 11:53:05 listener.go:175: COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP is looking for PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE which does not exist
2024/05/18 11:53:05 listener.go:232: Closing connection COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP: read tcp 192.168.1.1:22067->192.168.1.2:25490: use of closed network connection
2024/05/18 11:53:13 listener.go:48: Listener accepted connection from 192.168.1.2:25545 tls true
2024/05/18 11:53:13 listener.go:117: Message protocol.ConnectRequest from COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP
2024/05/18 11:53:13 listener.go:175: COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP is looking for PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE which does not exist
2024/05/18 11:53:13 listener.go:232: Closing connection COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP: read tcp 192.168.1.1:22067->192.168.1.2:25545: use of closed network connection
2024/05/18 11:53:29 listener.go:48: Listener accepted connection from 192.168.1.2:25648 tls true
2024/05/18 11:53:29 listener.go:117: Message protocol.ConnectRequest from COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP
2024/05/18 11:53:29 listener.go:175: COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP is looking for PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE-PHONE which does not exist
2024/05/18 11:53:29 listener.go:232: Closing connection COMP-COMP-COMP-COMP-COMP-COMP-COMP-COMP: read tcp 192.168.1.1:22067->192.168.1.2:25648: use of closed network connection

You don’t mention changing the device listen address. Using a relay is two-part.

  • Device A must “listen” on the relay – for a private relay, add it as a comma separated address under “sync protocol listen addresses”
  • Device B must know to connect to A via the relay, which it looks like you configured

The address to the relay should be set as relay://192.168.1.1:22067/?id=RELAY-RELAY-etc.

Why is the Github version (v1.22.1) behind the Docker version (v1.27.7)?

The Docker image is updated automatically. The GitHub release of the relay stuff only happens when required (i.e., something relay related changed in the code).

1 Like

Thanks so much calmh! Adding the relay to “sync protocol listen addresses” fixed it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.