I thought that the point of UPnP was to get around that (or, more specifically, to ensure that the port forwarding existed by setting it up automatically)?
I’m intrigued as to why UPnP doesn’t seem to be working and how I can investigate further. Also, I have established that btsync also doesn’t succeed in setting up UPnP (so it’s likely a network issue not a syncthing one), but btsync works without any other forwarding; what is it doing differently?
Depending on your router, it might not be using UPnP as there are other alternatives for requesting port forwarding (which syncthing does not currently support, as we are probably move to UDP in the long term which will make port forwarding point redundant).
Also, I am not familiar with how BTSync works, but it might use UDP and UDP punch through which solves the issue.
Perhaps it supports using relay server?
As for wireshark, I suggest you download a simple UPnP test utility to see if it finds anything.
Thanks, downloaded and running on my Windows box. But I’m not sure what I should be looking for?
Under .All I only see some local stuff (Samsung Kies, Windows media player), but under Internet gateway Devices I seem my Draytek router (“Draytek Internect Connection Sharing”). But I don’t know what I’m looking at (or looking for).
There should be a list of services the device provides via UPnP, that’s what we are interested in.
I am talking from memory, I already forgot what the UI looks like.
The list of services (assuming I’m looking at the right thing) is:
WanDevice
WANConnectionDevice
WANDSLLinkConfig
WANPPPConnection - in Properties for this it lists PortMapping and includes several maps for BitTorrent Sync and uTorrent across my Windows and Linux desktop PCs (nothing for syncthing)
WANCommonInterfaceConfig
OSInfo
I’m a new user so although I can export what UPnP Tester tells me I can’t upload it here
Then I guess you might need to dwell down into wireshark to debug it, as if others are able to get the mappings, it means we’re doing something wrong (or not giving enough time).
I cannot remember the exact filters you need, I know it was quite complicated as the request was done on a random port and the response arrived on the same random port.
You can upload to imgur or pastebin or whatever, and just provide a link here.
You can also use the tool @Rewt0r suggests, as it seems to have a more simple UI.
I’m a bit confused by @Rewt0r - the link is to the same tool I’m using which doesn’t match the screenshot (which I agree looks simpler).
I’d welcome suggestions for Wireshark filters. The best I’ve found so far is:
((udp contains “HTTP/1.1”) and ((udp contains 0a:53:54:3a) or (udp contains 0a:59:54:3a)))
… which throws up quite a lot of traffic for btsync but nothing at all for syncthing. But from what has been said in this thread you currently use TCP not UDP. (s/udp/tcp in the above doesn’t get me anything either).
On the tool I linked to once opened it should present you with visible UPnP devices:
I’m with Virgin Media in the UK so I can see my Router the VMDG490. You need to find the WANIPConnection part as highlighted in my image, right-click -> properties and see if anything is added under the “Port Mapping” tab
FYI if your device isn’t shown in there use nmap and do a “quick scan plus” to see what ports your router is listening on and you should see one for UPnP.
My router is located at 192.168.0.1 so the command I used was:
nmap -sV -T4 -O -F --version-light 192.168.0.1
And I correctly see my router is listening for UPnP connections
syncthing is indicating it can’t discover the router in question, so this is most likely a UPnP discovery issue. Once the router is properly discovered, port mapping will probably work fine as well.
For debugging UPnP discovery, I usually use the filter udp.port==1900 in Wireshark. UDP port 1900 is the standard port for UPnP broadcast messages such as discovery requests and responses, so this filter should show those requests and responses.
When syncthing initially starts, you should see some packets sent from the local host and responses from your router. The first thing to do is verify you’re actually seeing response packets from the router. This is usually not an issue on a local network.
Assuming you’re getting the response packets, they should have a LOCATION field which gives the root device description URL. If you visit that URL in a browser and paste the contents of that XML file into a pastebin (or similar) and share the link with us, we should be able to get to the bottom of this.
Also, if btsync is generating noise in the Wireshark capture, then it might be worthwhile to disable btsync temporarily while we’re debugging this issue.
Yeah, UPnP devices can definitely get noisy! The issue with clever filters is making sure the cleverness doesn’t omit important packets by accident. I tend to prefer using a dumb filter and turning off any noisy services and devices, just to make sure I’m not missing anything.
I’m interested in what results come back from the OP because I’m not sure if you remember @AudriusButkevicius but our UPnP issue magically solved itself. Our logs indicated 0 UPnP devices found but using the tools I’ve mentioned above I could correctly see that UPnP was working.
Maybe a problem with the UPnP discovery part of the code or with certain brands of router?
So my problem turned out to be a buggy router which resets UPnP settings after a reboot.
I am claiming that there aren’t any bugs in the UPnP code, there very well might be, or it might just need a longer delay before giving up… But we need some logs or something to be able to figure out what’s happening.
Thanks everyone for the suggestions. I’m not ignoring you, I just haven’t had 5 minutes to test this today, nor will I do for at least tomorrow, but I will update here when I do.
In the meantime I have just tried the nmap scan from my Linux box as that’s a quick test, and apparently port 1900 isn’t open, despite the Draytek configuration claiming it is all enabled, and despite the UPnP scan from my Windows box suggesting that it is too. Suggestions as to why the discrepancy?