UPnP seems not to work (Mac OS X 10.10; ST 0.10.24; FritzBox! 7330 router)

Hi!

I’ve switched over to Syncthing after the Bittorrent guys decided to limit the free Sync features. I have installed Syncthing on three machines:

  1. Ubuntu Server (syncthing 0.10.24; private server)
  2. Windows 7 (syncthing 0.10.25 (0.10.25; work PC)
  3. Mac OS X 10.10 (syncthing 0.10.25; private notebook)

All devices should see each other. Currently, only the server sees the two other devices, but the Windows and Mac computers do not see each other. Since I’ve spotted the IP address of the Windows PC on my Mac (and of course allowed the communication), I started to search for the problem on the Mac side. There i find this error in the GUI:

Failed to create UPnP port mapping

Setting STTRACE=upnp and restarting syncthing, I find these entries (repeated about 10 times):

[4GKUQ] 2015/03/08 23:14:06.195710 main.go:664: INFO: Starting web GUI on xxx:8080/
[4GKUQ] 2015/03/08 23:14:07.183370 upnp.go:106: INFO: Starting UPnP discovery...
[4GKUQ] 2015/03/08 23:14:07.183419 upnp.go:155: DEBUG: Starting discovery of device type urn:schemas-upnp-org:device:InternetGatewayDevice:2...
[4GKUQ] 2015/03/08 23:14:07.183744 upnp.go:175: DEBUG: Sending search request for device type urn:schemas-upnp-org:device:InternetGatewayDevice:2...
[4GKUQ] 2015/03/08 23:14:07.183872 upnp.go:187: DEBUG: Listening for UPnP response for device type urn:schemas-upnp-org:device:InternetGatewayDevice:2...
[4GKUQ] 2015/03/08 23:14:10.186560 upnp.go:228: DEBUG: Discovery for device type urn:schemas-upnp-org:device:InternetGatewayDevice:2 finished.
[4GKUQ] 2015/03/08 23:14:10.186775 upnp.go:155: DEBUG: Starting discovery of device type urn:schemas-upnp-org:device:InternetGatewayDevice:1...
[4GKUQ] 2015/03/08 23:14:10.186961 upnp.go:175: DEBUG: Sending search request for device type urn:schemas-upnp-org:device:InternetGatewayDevice:1...
[4GKUQ] 2015/03/08 23:14:10.187063 upnp.go:187: DEBUG: Listening for UPnP response for device type urn:schemas-upnp-org:device:InternetGatewayDevice:1...
[4GKUQ] 2015/03/08 23:14:10.191541 upnp.go:238: DEBUG: Handling UPnP response:
HTTP/1.1 200 OK
LOCATION: yyy:49000/igddesc.xml
SERVER: FRITZ!Box 7330 (UI) UPnP/1.0 AVM FRITZ!Box 7330 (UI) 107.06.20
CACHE-CONTROL: max-age=1800
EXT:
ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1
USN: uuid:75802409-bccb-40e7-8e6c-C025067A311E::urn:schemas-upnp-org:device:InternetGatewayDevice:1
[4GKUQ] 2015/03/08 23:14:10.211514 upnp.go:435: DEBUG: [http://192.168.0.1:49000/igddesc.xml] Found urn:schemas-upnp-org:service:WANIPConnection:1 with URL yyy:49000/igdupnp/control/WANIPConn1
[4GKUQ] 2015/03/08 23:14:10.211547 upnp.go:424: DEBUG: [http://192.168.0.1:49000/igddesc.xml] No services of type urn:schemas-upnp-org:service:WANPPPConnection:1 found on connection.
[4GKUQ] 2015/03/08 23:14:10.213190 upnp.go:335: DEBUG: Finished handling of UPnP response.
[4GKUQ] 2015/03/08 23:14:13.188767 upnp.go:228: DEBUG: Discovery for device type urn:schemas-upnp-org:device:InternetGatewayDevice:1 finished.
[4GKUQ] 2015/03/08 23:14:13.188983 upnp.go:118: DEBUG: UPnP discovery result:
[4GKUQ] 2015/03/08 23:14:13.189015 upnp.go:120: DEBUG: [75802409-bccb-40e7-8e6c-C025067A311E]
[4GKUQ] 2015/03/08 23:14:13.189089 upnp.go:123: DEBUG: * [urn:upnp-org:serviceId:WANIPConn1] yyy:49000/igdupnp/control/WANIPConn1
[4GKUQ] 2015/03/08 23:14:13.189124 upnp.go:133: INFO: UPnP discovery complete (found 1 device).
[4GKUQ] 2015/03/08 23:14:13.189290 upnp.go:496: DEBUG: SOAP Request URL: yyy:49000/igdupnp/control/WANIPConn1
[4GKUQ] 2015/03/08 23:14:13.189333 upnp.go:497: DEBUG: SOAP Action: "urn:schemas-upnp-org:service:WANIPConnection:1#AddPortMapping"
[4GKUQ] 2015/03/08 23:14:13.189353 upnp.go:498: DEBUG: SOAP Request:
<?xml version="1.0" ?>
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <s:Body><u:AddPortMapping xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
    <NewRemoteHost></NewRemoteHost>
    <NewExternalPort>9021</NewExternalPort>
    <NewProtocol>TCP</NewProtocol>
    <NewInternalPort>22000</NewInternalPort>
    <NewInternalClient>192.168.0.23</NewInternalClient>
    <NewEnabled>1</NewEnabled>
    <NewPortMappingDescription>syncthing-9021</NewPortMappingDescription>
    <NewLeaseDuration>0</NewLeaseDuration>
    </u:AddPortMapping></s:Body>
    </s:Envelope>
[4GKUQ] 2015/03/08 23:14:13.200221 upnp.go:508: DEBUG: SOAP Response:
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
<errorCode>403</errorCode>
<errorDescription>Not available Action</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>

What can I do? I’ve never had a problem with my router (FritzBox! 7330, newest firmware installed) and UPnP.

Thank you very much for your help!

Cheers, MCB

PS I had to cut down the IP adresses in the text above due to restrictions here in the forum for new users (where you finde xxx and yyy, there are vaild https followed by an IP entries)

That looks like a plain refusal from the fritzbox. Is it configured to allow new port forwards? Anyway, as a workaround you can add one manually - port 22000 on the outside to port 22000 on your syncthing host, then uncheck UPnP in the syncthing config…

I fully agree, that’s how it looks like. Still I wonder why this is. I’ve never had problems with UPnP before. At least not that I am aware of…

UPnP is enabled. I’ve also tried it when it was disabled - same result. Restart of the router also didn’t help. I’ll test the connectivity with an manual entry as soon as possible. Nonetheless. I’d prefer to have a dynamic solution.

Do you have a suggestion for a program (Mac or Linux) to test UPnP further, that might give you developers more information?

Problem solved! Thank you for your input!

It actually was the router - it has two distinct UPnP settings that both have to be enabled for the forwarding to work. Switching off the “obvious” one switches off the other - switching it on does not automatically activate the other one again.

Cheers, MCB

1 Like

just updated to 0.10.25 and now my machines cant find each other. i get this message in ST:

9:57:57: Failed to create UPnP port mapping

since i am also running a fritzbox i assume i have a similiar problem, but i can just find one setting regarding upnp. could you please explain where the two settings are?

thanks

Hi

I was looking it up in the manual. Found this page (in German):

http://avm.de/nc/service/fritzbox/fritzbox-7330-sl/wissensdatenbank/publication/show/894_Automatische-Portfreigaben-ueber-UPnP-einrichten/

The first setting that I readily found was under “Heimnetzwerk -> Netzwerkeinstellungen”, so the one among the general network properties.

The second one is in the port forwarding menu itself and is called “Änderungen der Sicherheitseinstellungen über UPnP gestatten” (Allow changes of security settings via UPnP). This one is the one that gets switched off by the first one, but not automatically activated, when the first one is activated.

How Bittorrent Sync handled that problem is still unclear to me… But now Syncthing works fine and all repositories see each other.

Hope that helps.

Cheers!

BTSync uses UDP which does not need UPnP.