Newbie questions about listening ports, architecture etc.

Hello,

I am newbie in using syncthing. I feel myself like I have found a gold mine or diamond, and getting angry to myself about why I have not heart this software before…!

I have a couple of questions and any comment, directions are much appreciated.

My requirements:

I have kids, wife, all have computers/labtops/phones/tablets. We are using windows 10, and arch/manjaro linux at pc/labtops. I am running an arch/manjaro linux server for a central storage, sharing, and for all sorts of services (multimedia, backups etc.) All family share files/folders through arch server with nfs/samba/ftp etc, home folders are accessible via the same account information alongside with their pc/labtop.

I need to sync data on all these hardware to central server for each user.

Things done:

Server side

  • In server, by using arch linux’s ready to use package, which includes systemd services, is installed from arch repository.

  • pacman -S syncthing

    I am running syncthing v1.4.2 "Fermium Flea" (go1.14.1 linux-amd64) builduser@svetlemodry 2020-04-08 18:40:04 UTC

  • I created services for each user accound via

    • systemctl enable syncthing@user

    • systemctl start syncthing@user

  • For each user account, I have customized ~/.config/syncthing/config.xml with following changes.

    • I changed web gui default port to prevent collision for each user.
    <gui enabled="true" tls="false" debugging="false">
        <address>127.0.0.1:11200</address>
        <apikey>some text</apikey>
        <theme>default</theme>
    </gui>
  • I gave for example port numbers as 11200, 11201, 11203 for each account.

  • I have changed listening port as 22000,22001,22002 etc. based on the suggestion at Arch Syncthing Wiki. In the wiki, there is paragraph as follows:

Use a different listen address port for each machine, like tcp://:22010 , tcp://:22011 , tcp://:22012 and so forth. This will differentiate the nodes on the global discovery servers and avoid the “Connected to myself - should not happen” message on the other local devices whenever they leave the LAN.

  • My setting for each user account in their corresponding configuration file is follows.
    <options>
        <listenAddress>:22001</listenAddress>
        .
        .
    </options>

Client side

I have not completed all but, I have tried in two arc/manjaro linux client following configuration.

  • I have given the same gui port ids to corresponding user accounts in users hardware to make easy to remember.

  • I have also gave distinct listening address ports unique in the network such as 22010, 220011 etc. As a summary, for every user account in any machine, A distinc/unique listening port number is given.

Current situtation.

  • For example I have one pc and labtop, they are not both synching to the my account home folder successfully and I am very happy about it.
       PC <----> Server <----> Labtop
  • In syncthing settings PC, Server and Labtop, Server are all in auto-accept mode.

Problem:

  • Even the first architecture is adequate, I would like to give it a redundancy via following which I could not achieve.
        +----->Server<------+
        |                   |
        |                   |
        |                   | 
        V                   V 
      PC <-------FAILS----> Labtop   

I add the PC to labtop and to labtop the PC etc, in addition to server. They never see each other even though all connection options (local,global, nat etc) are all activated. The server, however, happily synching with two device.

Questions:

  1. Is the mesh and redundant architecture doable, as describe above?
  2. What is the truth about the directive in arch wiki: Are the distinct listening port numbers necessity. Could they be a problem for disconnection. In the second configuration, pc and labtop never see each other from the beginning. What would be methodoly multiple accounts on the server to assign the ports numbers?
  3. Based on your advices, I will mimic this solution for all devices of the users including phones/tablets.

ANY HELP MUCH APPRECIATED…

UPDATE

After changing the listening ports to default with pc/labtop/server the mesh architecture seems to work. However I do not know if this would create a problem in the long run. I still wonder what is meant in Arch Linux Wiki. Then when should we change the default listening ports?

I didn’t check whether it’s actually a problem or gets corrected internally, but you should use the tcp:// prefix as in the arch wiki citation.

  1. Sure.

  2. It’s necessary if you use port forwards instead of upnp (which I personally think is a good idea and thus do) and need to connect from outside your LAN too.

They should connect just fine with fixed listening addresses, I do that to in my LAN too. You could enable discovery and connections debug facilities to get info on what’s going on and might be failing.

Thank your the response. I appreciated very much.

Could you kindly please respond following questions.

  1. Apart from the internet connection needs, excuse me if this is a stupid or obvious question, do I need to set different unique port addresses for each user account in a server environment to sync between server and the client machines?

  2. If I use different listening address in all account/machines, do I need install local discovery service if I stop using global service?

  3. How do I set a different listening port simply? I do not want to change the default protocols, but just the port. There was a old post in the forum which :portnumber would be implemented. That seemed to work in my environment.

  4. You stated following. I just want to verify, do you advise to use different listening ports over upnp.

It’s necessary if you use port forwards instead of upnp (which I personally think is a good idea and thus do) and need to connect from outside your LAN too.

  1. I don’t understand what this means.

  2. There is no such thing as a local discovery service and I don’t see why you would disable global discovery.

  3. There’s no shortcut (there has been propositions for better handling in the UI, but that didn’t happen and anyway doesn’t affect the config itself). The default expands to tcp://:22000, quic://:22000 and dynamic+https://relays.syncthing.net/endpoint. In xml config you need to create three entries for each of those with the desired port (same in UI, just with commas).

  4. I advice to disable upnp and use different listening ports and matching port forwards. If you do not disable upnp, you don’t need different listening ports.

1 Like

Thank you again for the response, much appreciated.

  • Item 1:

    I will try to explain what I meant, please bare with me, I am not a native speaker of English. Could you please verify or correct following:

    On a machine which hosts multiple user accounts, like my server:

    Since:

    1. each user configuration is handled by configuration file under his home directory,
    2. for each user there must be distinct syncthing process to handle sync.

    Then:

    I presume, I am supposed to configure different listening ports for each user

  • Item 2. I meant installing local discovery server mentioned at Installing local discovery service at syncthing documentation

  • Item 3,4 okay, understood. Very much helpfull.

  1. Ah right, forgot that you had multiple instances running on the same device: Yes, then you should configure separate ports as described above for 3.

  2. My confusion came up because there is “local discovery”, which is broadcast/multicast based, i.e. no server involved, and “global discovery” involving servers (the one you link to). So you are asking about running a global discovery server in your local network. That’s not necessary. If you do have LAN subnets, try enabling multi-/broadcast forwarding between them to enable local discovery.

1 Like

Thank you for your patience and answers. Now everything is crystal clear.

Hello,

Based on your inputs, I have reconfigured my environment, unfortunately all connections have been lost.

I have enabled debugging as below, by following Debugging Syncthing

$ STTRACE='discorvery,connections' syncthing

  • I have given my labtop port 22020 as follows

    <listenAddress>tcp://0.0.0.0:22020,quic://0.0.0.0:22020,dynamic+https://relays.syncthing.net/endpoint</listenAddress>
    
    
  • My server has following setting

    <listenAddress>tcp://0.0.0.0:22001,quic://0.0.0.0:22001,dynamic+https://relays.syncthing.net/endpoint</listenAddress>
    
    
  • In my labtop logs, I receive too many colons, unknown stack trace errors

    [XXXX] 2020/05/04 09:13:14.199800 tcp_listen.go:49: INFO: Listen (BEP/tcp): address 0.0.0.0:22020,quic:: too many colons in address
    [XXXX] 2020/05/04 09:13:14.199814 global.go:240: DEBUG: Announcement: {"addresses":["tcp://0.0.0.0:22020,quic://0.0.0.0:22020,dynamic+https://relays.syncthing.net/endpoint"]}
    [XXXX] 2020/05/04 09:13:14.199890 service.go:138: INFO: c.S.listenerSupervisor: Failed service 'tcp://0.0.0.0:22020,quic://0.0.0.0:22020,dynamic+https://relays.syncthing.net/endpoint' (1.000000 failures of 2.000000), restarting: true, error: "{tcp://0.0.0.0:22020,quic://0.0.0.0:22020,dynamic+https://relays.syncthing.net/endpoint tcp://0.0.0.0:22020,quic://0.0.0.0:22020,dynamic+https://relays.syncthing.net/endpoint} returned unexpectedly", stacktrace: [unknown stack trace]
    
  • I also receive dialing device-id and then connection refused for both computers to each other. I have given explicit ip addresses also for each device. In both computers, there is no active enabled firewall.

Help much appreciated.

UPDATE:

As soon as I stop global discovery, NAT and relay, just letting local discorvery on the settings of both devices, they found/connected to each other. This is weird. I could see that global discovery were referencing old ports, but local ip address given were also receiving connection refused intially. Disabling NAT, global discovery and relay should nothing have to do connection refuse to local ip addresses while their ips and ports number are correct. There seems to be something wrong. I have not touched anything other than disabling those services.

Something seems to have got lost in translation (or it was just unnecessarily confusing) in

, your configuration is incorrect, as indicated by

[XXXX] 2020/05/04 09:13:14.199800 tcp_listen.go:49: INFO: Listen (BEP/tcp): address 0.0.0.0:22020,quic:: too many colons in address

Instead of

you need

<listenAddress>tcp://0.0.0.0:22020</listenAddress>
<listenAddress>quic://0.0.0.0:22020</listenAddress>
<listenAddress>dynamic+https://relays.syncthing.net/endpoint</listenAddress>
1 Like

“In xml config you need to create three entries for each of those with the desired port (same in UI, just with commas).

Based on your above comment, I inserted the address as such. I believe documentation can be enchanced with a sample entries in config.xml file. There are sample enteries for device-ip’s but not for listening addresses.

Thank you very much for your help.

The docs are somewhat community maintained, so feel free to open a pull request improving them.

If that is possible, I will do that. I am taking notes for myself about what I learned not to forget. I am keeping my docs in asciidoc. I will share or insert them to the docs if possible. I have seen not so clear parts in docs, in which I had difficulty understanding. I can update especially those parts. As a matter of fact, a part/section is needed for handling computers with multiple accounts. One has to derive that from the documentation. It is not clearly explained. There is need for when, where distinct ports numbers are needed etc.

1 Like

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