Sync when I have no internet

Hi, sorry if this is basic and I just am not techincal enough to realize it was easy.

I have two Ubuntu computers and one android phone that I use. I’m a writer. I want to be able to sync documents between the three devices. My main computer is the desktop at my home. I want to sync to my phone so I can use TTS during my commute. I have a laptop that I bring with me to write and I often find myself in locations where there is no internet access.

What I do currently is I tether my phone to my laptop so my laptop can use my phone’s internet. This lets my work sync to my phone and my computer at home but does use my phone’s data.

What I would like to do is create a wifi hotspot with my laptop, even though it doesn’t have any internet. I could then connect to the hotspot with my phone and my work would sync from the laptop to the phone. My work would only sync over the internet back to my home computer via the document on my phone once I disconnected from the laptop at the end of the work day. Then on my way home I could listen to TTS.

Currently if the phone connects to the laptop wifi hotspot nothing syncs. Is there a setting I can change to encourage them to sync? I know I can just connect the phone via USB cable and copy/paste but I’m interested in not having to wear out the connector if possible. I’m looking for a seemless workflow with minimal interruptions so I can just get on with writing.

Is Syncthing configured to do discovery on that laptop hotspot network?

No worries, it’s not complicated, but does require getting a little technical. :nerd_face:

First step is to confirm that the hotspot connection is actually working, and if the laptop and phone can see each other.

Once your phone is connected to the hotspot, if you don’t already have an Android app that can display the phone’s current IP address, use the following command on your Ubuntu laptop:

arp -a

If your laptop isn’t connected to another network at the same time, there should be only one entry, e.g.:

? (10.42.0.107) at 1a:7c:8d:20:6c:c7 [ether] on wlp1s0

You should be able to successfully ping your phone from your laptop:

ping 10.42.0.107

If all is good up to this point, the depending on the version of Android – and maybe also what the manufacturer did to it – local discovery broadcasts from the laptop to the phone might not work, so it’ll be up to Syncthing on your laptop to listen for connections from Syncthing on your phone.

Since you’re running Ubuntu, it normally doesn’t enable iptables/nftables by default – i.e. no firewall rules. But if you’re using UFW or some other firewall configuration tool, you’ll have to open up port 22000.

If the above conditions are met, it’s plug-n-play with Syncthing on your laptop and phone finding each other automatically without the need to change your Syncthing configuration.

If not, in order to help debug this, you’ll need to…

  • … post screenshots of Syncthing’s web GUI on your laptop and phone.
  • … post the output from ip address show on your laptop while the hotspot is active with the phone connected.
  • … post the output from arp -a on your laptop.

In my experience, it’s quite easy. As long as your phone has a cellular data connection, and a Wi-Fi that doesn’t give internet connectivity, then Android basically blocks the Wi-Fi completely and Syncthing cannot use it. If you switch off mobile data for some time, it will however use the Wi-Fi as-is and Syncthing connects locally to the hotspot host (your laptop).

Did just that today, in a location where I don’t have an ISP line, but a laptop that syncs regularly through my phone with a bunch of other devices. I don’t open a hotspot from my phone though, but simply connect to the same (offline) Wi-Fi. As soon as I switch off mobile data on the phone, Syncthing starts to work.