Local sync between android/linux since 1.25

Hi! I’m experiencing issues with only being able to sync with my android device over a relay (at much slower speeds than I get between Linux devices on the local network). I’m aware that there are dozens of threads about this topic, but I couldn’t find any since the release of 1.25.0, which included a fix to Android local discovery. (The most recent thread I found was “disconnected-devices-between-pixel-and-samsung/20889”).

I reset syncthing on my laptop and phone to test and have them both connected to my wifi network, with no firewalls in place on the router and the necessary ports open on my devices. I then added the phone by manually typing its ID into my laptop.

I can see that on my laptop, 4/5 discovery methods are successful, with “global@https://discovery-v6.syncthing.net/v2” failing, and 3/5 are successful on my phone (the two IPv6 methods failing). 3/3 listeners are successful on both devices.

However, the connection type is “Relay WAN” and the addresses shown for the device connection (on both machines) is a remote IP from a Syncthing relay.

I’m running syncthing 1.26.1 on both devices (Syncthing-Fork via F-Droid on my phone). I’d appreciate any help debugging this. Thank you!

Can you ping your phone from your laptop?

Yes I can, not a network issue as far as I can tell.

How did you install syncthing on your laptop?

Using home-manager. (I’m just using the defaults, which runs syncthing -no-browser -no-restart -logflags=0 as a systemd user service.)

You can check the discovered IPs for remote devices using the CLI on your laptop:

syncthing cli show discovery

(we should really offer an option to display this in the web UI)

> syncthing cli show discovery
{
  "VZ7QBZA-EDGMBJW-LMW224N-ZMELZHG-HBHMBKQ-6DPWNQV-QSYSJ7S-54D7BQG": {
    "addresses": [
      "quic://108.5.76.12:1024",
      "quic://108.5.76.12:22000",
      "relay://172.245.94.35:22067/?id=W3LBV2D-JAJNVKT-RA3SZLG-JVXGK4O-PPRIXAD-ALBMDKP-7PR7LCV-2CAZ4QW",
      "tcp://108.5.76.12:22000"
    ]
  }
}

Unfortunately I just see the the relay and the public IP address of my phone (the same public IP as my laptop).

However, it seems my laptop is receiving the local discovery packets from syncthing on my phone: I tried sudo tcpdump 'udp and port 22000' and see output like 21:30:10.829966 IP 192.168.1.155.snapenetio > seberg.snapenetio: UDP, length 1252. (I’m pretty sure attaching this packet won’t leak anything other than my device ID?) pcap.txt (5.4 KB)

So I’m not sure why it isn’t discovering my phone’s IP.

That port is used for actual connections and global discovery. Local discovery uses 21027/UDP.

My mistake, sorry. In that case it looks like the linux PC is sending out local discovery packets but the android phone is not. When I open the app on my phone to add a new device, I can see the local IP address of my laptop under ‘discovered devices’ (right next to the relay address which was actually getting used). So it seems like local connections should be possible. But for some reason, tonight the two devices are refusing to connect whatsoever, not even over a relay. I haven’t changed any settings or anything about the local network. Don’t have much time to look into it more for now, but I’d appreciate any suggestions on where to troubleshoot.

The logs from Syncthing running on your phone might be helpful.

I have also been having these issues on android 13 and windows 10 lately. Sometimes it connects via relay, syncs the files via the internet and when its done or enough time passed it finds the other client via my network somehow but then the files are often synced.

Weirdly enough i tried troubleshooting it a bit and tried using a third device (windows 11 laptop) and suddenly it worked fine and now all three connect instantly. (to ipv6 addresses i think?) I can’t reproduce it anymore…

I’m not sure why it started working again, i did disable the power saving setting for the network card on the win10 device just as a test. I’m not sure if that’s what fixed it though…

What is the best and easiest way to debug this and share logs without sharing lots of personal info from the logs? I’m using synctrazor.

You should probably open a new topic for your issue (because this one here is about Android and Linux), but with Windows involved, one thing to always verify is that your network is set to “private” and not “public”, as with the latter, the OS will block any direct connections.

2 Likes

Maybe unless it’s actually an android issue.

But thanks for that tip, it was set to “public” and i have no idea why…

I’ll return if the issue returns.

It defaults to “public” if you don’t click “yes” on the following pop-up when connecting to a network for the first time.

The funny thing is that in Windows 10 until v1809 or so, it was impossible to change the setting using the GUI, only via the command line.

1 Like

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