listening on random port

Can someone tell me what I should do about those random ports syncthing insists on listening on? First its 46113/udp and 34583/udp, then its 55338/udp and 58281/udp.

# ss -tulpen|grep syncthing

udp    UNCONN  0    0    0.0.0.0:46113
udp    UNCONN  0    0    0.0.0.0:21027
udp    UNCONN  0    0    [::]:34583
udp    UNCONN  0    0    [::]:21027
tcp    LISTEN  0    128  *:8384
tcp    LISTEN  0    128  *:22000

# systemctl restart syncthing@syncthing.service

# ss -tulpen|grep syncthing

udp    UNCONN  0    0    0.0.0.0:21027
udp    UNCONN  0    0    0.0.0.0:55338
udp    UNCONN  0    0    [::]:21027
udp    UNCONN  0    0    [::]:58281
tcp    LISTEN  0    128  *:8384
tcp    LISTEN  0    128  *:22000

Each restart those two are different. I’ve read https://docs.syncthing.net/users/firewall.html?highlight=firewall, it only mentions 21027/udp and 22000/tcp.

Thanks.

There is no such thing as “listening” on udp. You simply reserve (bind) a port which belongs to your application, and wether you listen or send packets from it is your business.

In this case I suspect it’s NAT discovery that sends packets out of those connections, which is random outbound port the kernel picks.

1 Like

Also local discovery, iirc. And yeah, you don’t do anything about this, it just is.

1 Like

Sorry, my bad. I assumed it was the same as with TCP, listening for incoming connections. No need to open up iptables for incoming connections then.

Thanks for the quick reply!

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