unable to sync devices on Android without global discovery

Hello, all! Thanks for this amazing tool.

I’ve been facing an issue for some time and finally took the time to report it and ask for help.

I have a decent sized LAN network running syncthing 1.23.4 on multiple devices (debian stable on x86_64, android 12~13 on arm64).

Some months ago, I noticed that the sync speed was slow in my network and assumed this was because of the metered mobile network that I started depending on recently. Hoping to speed up the sync and save my limited data quota, I disabled the global discovery on all devices.

Since then, a strange thing happened: the android devices became unable to find each other, but they can find the debian devices.

Here are the logs for a specific device named “SM-G970F”:

logs from SM-G970F

--------- beginning of main 05-22 13:24:37.560 I/SyncthingNativeCode(13899): [E62KA] INFO: Relay listener (dynamic+https://relays.syncthing.net/endpoint) shutting down 05-22 13:24:37.560 I/SyncthingNativeCode(13899): [E62KA] INFO: QUIC listener ([::]:22000) shutting down 05-22 13:24:37.830 I/SyncthingNativeCode(13899): [E62KA] INFO: TCP listener ([::]:22000) shutting down 05-22 13:24:37.832 I/SyncthingNativeCode(13899): [E62KA] INFO: Exiting 05-22 13:24:38.684 I/SyncthingNativeCode(13899): [start] INFO: syncthing v1.23.4 “Fermium Flea” (go1.19.6 android-arm64) vagrant@bullseye 2023-04-05 13:25:55 UTC [noupgrade, stguiassets, sthashing, stnoupgrade] 05-22 13:24:38.732 I/SyncthingNativeCode(13899): [E62KA] INFO: My ID: E62KAAR-UA6ECOE-6TJIHSC-FDO2FRW-ST6OT6O-WDT6ZAH-TJPQJLQ-ZYYAWAT 05-22 13:24:39.194 I/SyncthingNativeCode(13899): [E62KA] INFO: Hashing performance is 829.83 MB/s 05-22 13:24:39.195 I/SyncthingNativeCode(13899): [E62KA] INFO: Overall send rate is unlimited, receive rate is unlimited 05-22 13:24:39.195 I/SyncthingNativeCode(13899): [E62KA] INFO: Using discovery mechanism: IPv4 local broadcast discovery on port 21027 05-22 13:24:39.196 I/SyncthingNativeCode(13899): [E62KA] INFO: Using discovery mechanism: IPv6 local multicast discovery on address [ff12::8384]:21027 05-22 13:24:39.197 I/SyncthingNativeCode(13899): [E62KA] INFO: TCP listener ([::]:22000) starting 05-22 13:24:39.197 I/SyncthingNativeCode(13899): [E62KA] INFO: Relay listener (dynamic+https://relays.syncthing.net/endpoint) starting 05-22 13:24:39.200 I/SyncthingNativeCode(13899): [E62KA] INFO: QUIC listener ([::]:22000) starting 05-22 13:24:39.200 I/SyncthingNativeCode(13899): [E62KA] INFO: Listing network interfaces: route ip+net: netlinkrib: permission denied 05-22 13:24:39.201 I/SyncthingNativeCode(13899): [E62KA] INFO: Detected 0 NAT services 05-22 13:24:39.202 I/SyncthingNativeCode(13899): [E62KA] INFO: GUI and API listening on 127.0.0.1:8384 05-22 13:24:39.202 I/SyncthingNativeCode(13899): [E62KA] INFO: Access the GUI via the following URL: https://127.0.0.1:8384/ 05-22 13:24:39.203 I/SyncthingNativeCode(13899): [E62KA] INFO: My name is “SM-G970F” 05-22 13:24:39.203 I/SyncthingNativeCode(13899): [E62KA] INFO: Device ITGFSBE-TIM5KDO-HWNXFAM-CYRX7HD-2R7FFRX-BXC76E6-YNCCNUS-J7ODIQQ is “SM-A505F” at [dynamic] 05-22 13:24:39.203 I/SyncthingNativeCode(13899): [E62KA] INFO: Device WV7M2VQ-AX6VZML-IGXWGG6-R3SYUSC-RXYBTNJ-UMFPPOW-ZIV3ZFL-R224QAO is “XT1965-2” at [dynamic] 05-22 13:24:39.203 I/SyncthingNativeCode(13899): [E62KA] INFO: Ready to synchronize “G970F” (sm-g970f_wk2r-fotos) (sendreceive) 05-22 13:24:39.240 I/SyncthingNativeCode(13899): [E62KA] INFO: Completed initial scan of sendreceive folder “G970F” (sm-g970f_wk2r-fotos) 05-22 13:24:39.695 I/SyncthingNativeCode(13899): [E62KA] INFO: quic://0.0.0.0:22000 detected NAT type: Full cone NAT 05-22 13:24:39.696 I/SyncthingNativeCode(13899): [E62KA] INFO: quic://0.0.0.0:22000 resolved external address quic://187.38.63.88:26017 (via stun.syncthing.net:3478)

This device has a single shared folder named “G970F” and is aware of 2 other devices, named “SM-A505F” and “XT1965-2”. All three of them are android devices.

Could you please guide me to solve this issue?

Funny thing… I have been searching for this issue without luck, but after opening this topic, the “suggested topics” showed me a way out: Local Discovery not working on Android 11

Apparently is a well known issue. The options to workaround that are:

  • Enable global discovery (and dealing with the undesired effect of sync through the metered internet)
  • hardcode the private IPs of the android devices
  • keep a central server on a non-android platform to act as a broker between the android devices

Right now, I am most interested in the last option, so I will try fixing it and hopefully return here to update the topic to anyone looking for this info.

1 Like

Local discovery is broken on recent Android versions (forgot the exact version, but if you search the forum/issues you will find various threads on this). This is due to OS restrictions imposed by Google. With global and local discovery offline, devices won’t find each other.

You can see that you’re affected by this from the logs:

This is your Android attempting to enable the local discovery listener and failing because it’s not allowed by the OS.

This issue doesn’t always appear, especially on PC ↔ Android sync, because if local discovery works on one side that’s usually enough for connection establishment.

In any case, disabling global discovery won’t help you in any way. Syncthing will always attempt to establish LAN connections, if possible. LAN addresses are announced to global discovery to help with this. If syncthing is unable to establish LAN connections when it should be, this indicates a networking issue not related to syncthing.

1 Like

You can always set up your own “global” discovery server (on the same LAN) as well. Point each device to query that one in addition to, or instead of, the default global discovery servers.

1 Like

I already reconfigured my network to use a mediator node in between the android devices and it worked really well. Yours seems like a nice option as well, so I will try to keep it in mind in case I face a tougher situation someday.

Thanks for the suggestion!

One way to assign fixed IPs to your androids is through the dhcp server, and not on each device. It is easier to order the network, without having to modify each one of them.

1 Like

Agreed,

Access to router login is required. I use my own router and use the DHCP server to hand out specific IP addresses via their Mac address. And every client is still configured for Dhcp it’s just that the server checks the Mac address and hands out the same IP address every time.

and the other information like subnet mask default gateway and DNS servers will be Handed out automatically by the default settings of the DHCP server.

check and see if your DHCP server can hand out ip addresses based on the Mac address that requests an IP address from the DHCP server.

I have not yet experimented with it but it is on my to do list and that is to set up a local discovery server.

2 Likes

Exact. And now having an ordered network, you can indicate the fixed ip’s of each android in the other androids/debian. The problem of using the global network without an “ordered lan” is that an android goes out to “ask” over the internet where the other android next to it is located. Generate global traffic for that. Double data consumption.

Knowing that android 10+ limits the local announcement, there are tricks in Advanced/Devices like Allowed Networks, and in settings/connections “Sync Protocol Listen Addresses”

There are countless threads about the issue of android devices using relays instead of LAN, but none of them could solve my problem except from this one. Tanks a lot! So to sum up: Go to your router settings and in dhcp configuration and assign a specific ip to your devices. Then go to your syncthing server, devices and set the address from dynamic to “tcp://(your device’s assigned IP)” And you’re done!

1 Like

Or if your router provides that feature, just use the host name without a domain or a special local domain. Some routers will happily serve DNS requests for the names assigned to devices with a fixed IP address or otherwise the host name provided during the DHCP request by the host. Example what works for me:

tcp://ac-laptop:22000
tcp://ac-laptop.fritz.box:22000
1 Like

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