# UPnP not happening

**URL:** https://forum.syncthing.net/t/upnp-not-happening/13241
**Category:** Support
**Created:** [May 3, 2019, 5:57am UTC](https://forum.syncthing.net/t/upnp-not-happening/13241 "2019-05-03T05:57:41Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![azjet77](https://forum.syncthing.net/user_avatar/forum.syncthing.net/azjet77/32/6157_2.png) [@azjet77](https://forum.syncthing.net/u/azjet77)
#### Post date: [May 3, 2019, 5:57am UTC](https://forum.syncthing.net/t/upnp-not-happening/13241/1 "2019-05-03T05:57:42Z")

</div>

I am running 0.14.36 and have NAT Traversal enabled in the settings. The router syncthing is behind is UPnP enabled (other apps successfully use it that way). However, I can’t see anything in the logs about syncthing attempting to create UPnP port mapping. This is confirmed by checking the mapped ports with upnpc.

Any ideas on how I can get UPnP working?

---

<div class="post-metadata">

### Author: ![imsodin](https://forum.syncthing.net/user_avatar/forum.syncthing.net/imsodin/32/3317_2.png) [@imsodin](https://forum.syncthing.net/u/imsodin)
#### Post date: [May 3, 2019, 6:04am UTC](https://forum.syncthing.net/t/upnp-not-happening/13241/2 "2019-05-03T06:04:32Z")

</div>

Enable the `upnp` debug facility. In your version probably only through `STTRACE` env var, but I’d generally just upgrade first, which besides many other benefits will give you a log view in the web UI and we don’t actually debug ancient versions.

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [May 3, 2019, 6:06am UTC](https://forum.syncthing.net/t/upnp-not-happening/13241/3 "2019-05-03T06:06:43Z")

</div>

It probably fails to find upnp devices, potentially because of firewalls or network configuration.

---

<div class="post-metadata">

### Author: ![azjet77](https://forum.syncthing.net/user_avatar/forum.syncthing.net/azjet77/32/6157_2.png) [@azjet77](https://forum.syncthing.net/u/azjet77)
#### Post date: [May 3, 2019, 6:26am UTC](https://forum.syncthing.net/t/upnp-not-happening/13241/4 "2019-05-03T06:26:45Z")

</div>

Ok, I upgraded to 1.1.1 and enabled upnp debugging via the GUI. Don’t see anything in the logs yet besides:

`2019-05-03 06:25:37 Detected 1 NAT service`

How often will it attempt to create a port mapping?

---

<div class="post-metadata">

### Author: ![azjet77](https://forum.syncthing.net/user_avatar/forum.syncthing.net/azjet77/32/6157_2.png) [@azjet77](https://forum.syncthing.net/u/azjet77)
#### Post date: [May 3, 2019, 7:28am UTC](https://forum.syncthing.net/t/upnp-not-happening/13241/5 "2019-05-03T07:28:50Z")

</div>

Here are the logs:

```
2019-05-03 06:55:27 Starting discovery of device type urn:schemas-upnp-org:device:InternetGatewayDevice:1 on eth0
2019-05-03 06:55:27 Starting discovery of device type urn:schemas-upnp-org:device:InternetGatewayDevice:2 on eth0
2019-05-03 06:55:27 Sending search request for device type urn:schemas-upnp-org:device:InternetGatewayDevice:1 on eth0
2019-05-03 06:55:27 Sending search request for device type urn:schemas-upnp-org:device:InternetGatewayDevice:2 on eth0
2019-05-03 06:55:27 Listening for UPnP response for device type urn:schemas-upnp-org:device:InternetGatewayDevice:2 on eth0
2019-05-03 06:55:27 Listening for UPnP response for device type urn:schemas-upnp-org:device:InternetGatewayDevice:1 on eth0
2019-05-03 06:55:37 Discovery for device type urn:schemas-upnp-org:device:InternetGatewayDevice:2 on eth0 finished.
2019-05-03 06:55:37 Discovery for device type urn:schemas-upnp-org:device:InternetGatewayDevice:1 on eth0 finished.

```

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [May 3, 2019, 9:13am UTC](https://forum.syncthing.net/t/upnp-not-happening/13241/6 "2019-05-03T09:13:22Z")

</div>

I don’t think Syncthing logs created port mappings, so this is not a good basis for assuming port mappings don’t happen.

---

<div class="post-metadata">

### Author: ![azjet77](https://forum.syncthing.net/user_avatar/forum.syncthing.net/azjet77/32/6157_2.png) [@azjet77](https://forum.syncthing.net/u/azjet77)
#### Post date: [May 3, 2019, 9:27pm UTC](https://forum.syncthing.net/t/upnp-not-happening/13241/7 "2019-05-03T21:27:01Z")

</div>

My basis is that checking the ports with the `upnpc` command does not show any that syncthing would use.

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [May 4, 2019, 6:36pm UTC](https://forum.syncthing.net/t/upnp-not-happening/13241/8 "2019-05-04T18:36:55Z")

</div>

If you provided the full logs it might be more obvious.

---

<div class="post-metadata">

### Author: ![azjet77](https://forum.syncthing.net/user_avatar/forum.syncthing.net/azjet77/32/6157_2.png) [@azjet77](https://forum.syncthing.net/u/azjet77)
#### Post date: [May 5, 2019, 4:21pm UTC](https://forum.syncthing.net/t/upnp-not-happening/13241/9 "2019-05-05T16:21:47Z")

</div>

Here are the full logs from the restart:

```
2019-05-05 16:03:25 syncthing v1.1.1 "Erbium Earthworm" (go1.11.5 linux-amd64) unknown-user@9b54055ad277 2019-04-16 18:39:31 UTC
2019-05-05 16:03:25 My ID: KTBACKG-ZALUFDI-QBZ77VB-JGL6P4F-7OOWJHE-XHBC7VB-WIKAXRX-BCUPYAS
2019-05-05 16:03:26 Single thread SHA256 performance is 316 MB/s using minio/sha256-simd (196 MB/s using crypto/sha256).
2019-05-05 16:03:27 Hashing performance is 272.71 MB/s
2019-05-05 16:03:28 Ready to synchronize "Default Folder" (default) (sendreceive)
2019-05-05 16:03:28 Ready to synchronize "radarr" (gndsh-mnvsv) (sendreceive)
2019-05-05 16:03:28 Ready to synchronize "sonarr" (zhhqc-nsznn) (sendreceive)
2019-05-05 16:03:28 Overall send rate is unlimited, receive rate is unlimited
2019-05-05 16:03:28 Using discovery server https://discovery-v4.syncthing.net/v2/?nolookup&id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
2019-05-05 16:03:28 Using discovery server https://discovery-v6.syncthing.net/v2/?nolookup&id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
2019-05-05 16:03:28 ...
2019-05-05 16:03:28 Using discovery server https://discovery.syncthing.net/v2/?noannounce&id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
2019-05-05 16:03:28 Completed initial scan of sendreceive folder "Default Folder" (default)
2019-05-05 16:03:28 TCP listener ([::]:22000) starting
2019-05-05 16:03:28 Relay listener (dynamic+https://relays.syncthing.net/endpoint) starting
2019-05-05 16:03:28 Completed initial scan of sendreceive folder "radarr" (gndsh-mnvsv)
2019-05-05 16:03:28 GUI and API listening on [::]:8384
2019-05-05 16:03:28 Access the GUI via the following URL: http://127.0.0.1:8384/
2019-05-05 16:03:28 My name is "plex-sync"
2019-05-05 16:03:28 Device PULDPYB-UCMUIQ7-IK6PVG6-IYABRWH-3WFGRXJ-2DJCJ2G-BLBOFAN-K5Q4LQG is "whatbox.ca" at [dynamic]
2019-05-05 16:03:28 Device XZTODMH-73XAN2I-T26WE7F-6TYW6MF-AQZKNF3-TVE35FB-H63SNEE-24SCOAP is "chadikins" at [dynamic]
2019-05-05 16:03:30 Completed initial scan of sendreceive folder "sonarr" (zhhqc-nsznn)
2019-05-05 16:03:31 Established secure connection to XZTODMH-73XAN2I-T26WE7F-6TYW6MF-AQZKNF3-TVE35FB-H63SNEE-24SCOAP at 172.17.0.3:36748-198.27.241.245:22000/tcp-client/TLS1.2-TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
2019-05-05 16:03:31 Device XZTODMH-73XAN2I-T26WE7F-6TYW6MF-AQZKNF3-TVE35FB-H63SNEE-24SCOAP client is "syncthing v0.14.54" named "298eaebc24e6" at 172.17.0.3:36748-198.27.241.245:22000/tcp-client/TLS1.2-TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
2019-05-05 16:03:48 Detected 1 NAT service
2019-05-05 16:04:02 Enabled debug data for "upnp"
2019-05-05 16:04:14 Joined relay relay://172.245.135.170:22067
2019-05-05 16:08:44 Established secure connection to PULDPYB-UCMUIQ7-IK6PVG6-IYABRWH-3WFGRXJ-2DJCJ2G-BLBOFAN-K5Q4LQG at 172.17.0.3:34108-172.245.135.170:22067/relay-server/TLS1.2-TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
2019-05-05 16:08:44 Device PULDPYB-UCMUIQ7-IK6PVG6-IYABRWH-3WFGRXJ-2DJCJ2G-BLBOFAN-K5Q4LQG client is "syncthing v1.1.1" named "whatbox.ca" at 172.17.0.3:34108-172.245.135.170:22067/relay-server/TLS1.2-TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305

```

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [May 5, 2019, 10:13pm UTC](https://forum.syncthing.net/t/upnp-not-happening/13241/10 "2019-05-05T22:13:15Z")

</div>

You enabled upnp logging after upnp discovery cycle has completed, so there is not much use out of these logs. I suggest you enable logging via an env var before startup.

---

<div class="post-metadata">

### Author: ![azjet77](https://forum.syncthing.net/user_avatar/forum.syncthing.net/azjet77/32/6157_2.png) [@azjet77](https://forum.syncthing.net/u/azjet77)
#### Post date: [May 7, 2019, 8:29am UTC](https://forum.syncthing.net/t/upnp-not-happening/13241/11 "2019-05-07T08:29:36Z")

</div>

Ok, after enabling `STTRACE=upnp`, here are the logs:

```
2019-05-07 07:35:15 syncthing v1.1.1 "Erbium Earthworm" (go1.11.5 linux-amd64) unknown-user@9b54055ad277 2019-04-16 18:39:31 UTC
2019-05-07 07:35:15 My ID: KTBACKG-ZALUFDI-QBZ77VB-JGL6P4F-7OOWJHE-XHBC7VB-WIKAXRX-BCUPYAS
2019-05-07 07:35:15 Single thread SHA256 performance is 315 MB/s using minio/sha256-simd (196 MB/s using crypto/sha256).
2019-05-07 07:35:16 Hashing performance is 272.12 MB/s
2019-05-07 07:35:17 Ready to synchronize "sonarr" (zhhqc-nsznn) (sendreceive)
2019-05-07 07:35:17 Ready to synchronize "Default Folder" (default) (sendreceive)
2019-05-07 07:35:17 Ready to synchronize "radarr" (gndsh-mnvsv) (sendreceive)
2019-05-07 07:35:17 Overall send rate is unlimited, receive rate is unlimited
2019-05-07 07:35:17 Using discovery server https://discovery-v4.syncthing.net/v2/?nolookup&id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
2019-05-07 07:35:17 Using discovery server https://discovery-v6.syncthing.net/v2/?nolookup&id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
2019-05-07 07:35:17 ...
2019-05-07 07:35:17 Using discovery server https://discovery.syncthing.net/v2/?noannounce&id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
2019-05-07 07:35:17 TCP listener ([::]:22000) starting
2019-05-07 07:35:17 Relay listener (dynamic+https://relays.syncthing.net/endpoint) starting
2019-05-07 07:35:17 Starting discovery of device type urn:schemas-upnp-org:device:InternetGatewayDevice:1 on eth0
2019-05-07 07:35:17 Sending search request for device type urn:schemas-upnp-org:device:InternetGatewayDevice:1 on eth0
2019-05-07 07:35:17 Listening for UPnP response for device type urn:schemas-upnp-org:device:InternetGatewayDevice:1 on eth0
2019-05-07 07:35:17 Starting discovery of device type urn:schemas-upnp-org:device:InternetGatewayDevice:2 on eth0
2019-05-07 07:35:17 Sending search request for device type urn:schemas-upnp-org:device:InternetGatewayDevice:2 on eth0
2019-05-07 07:35:17 Listening for UPnP response for device type urn:schemas-upnp-org:device:InternetGatewayDevice:2 on eth0
2019-05-07 07:35:17 Completed initial scan of sendreceive folder "Default Folder" (default)
2019-05-07 07:35:17 Completed initial scan of sendreceive folder "radarr" (gndsh-mnvsv)
2019-05-07 07:35:17 GUI and API listening on [::]:8384
2019-05-07 07:35:17 Access the GUI via the following URL: http://127.0.0.1:8384/
2019-05-07 07:35:17 My name is "plex-sync"
2019-05-07 07:35:17 Device PULDPYB-UCMUIQ7-IK6PVG6-IYABRWH-3WFGRXJ-2DJCJ2G-BLBOFAN-K5Q4LQG is "whatbox.ca" at [dynamic]
2019-05-07 07:35:17 Device XZTODMH-73XAN2I-T26WE7F-6TYW6MF-AQZKNF3-TVE35FB-H63SNEE-24SCOAP is "chadikins" at [dynamic]
2019-05-07 07:35:19 Established secure connection to XZTODMH-73XAN2I-T26WE7F-6TYW6MF-AQZKNF3-TVE35FB-H63SNEE-24SCOAP at 172.17.0.3:47148-198.27.241.245:22000/tcp-client/TLS1.2-TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
2019-05-07 07:35:19 Device XZTODMH-73XAN2I-T26WE7F-6TYW6MF-AQZKNF3-TVE35FB-H63SNEE-24SCOAP client is "syncthing v0.14.54" named "298eaebc24e6" at 172.17.0.3:47148-198.27.241.245:22000/tcp-client/TLS1.2-TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
2019-05-07 07:35:22 Completed initial scan of sendreceive folder "sonarr" (zhhqc-nsznn)
2019-05-07 07:35:27 Discovery for device type urn:schemas-upnp-org:device:InternetGatewayDevice:1 on eth0 finished.
2019-05-07 07:35:27 Discovery for device type urn:schemas-upnp-org:device:InternetGatewayDevice:2 on eth0 finished.
2019-05-07 07:35:37 Detected 1 NAT service
2019-05-07 07:35:51 Joined relay relay://199.181.238.100:22067

```

The UPnP router definitely works (confirmed with `upnpc -l`), but I’m thinking this is not working because the syncthing is running inside a Docker container…

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [May 7, 2019, 11:50am UTC](https://forum.syncthing.net/t/upnp-not-happening/13241/12 "2019-05-07T11:50:51Z")

</div>

Docker has it’s own networking, so it won’t work, it’s probably discovering something that is not your gateway.

You need to run with --net=host, also capture the logs from the console not the web ui as the logs in the web ui are partial.

---

<div class="post-metadata">

### Author: ![azjet77](https://forum.syncthing.net/user_avatar/forum.syncthing.net/azjet77/32/6157_2.png) [@azjet77](https://forum.syncthing.net/u/azjet77)
#### Post date: [May 7, 2019, 3:07pm UTC](https://forum.syncthing.net/t/upnp-not-happening/13241/13 "2019-05-07T15:07:50Z")

</div>

Yeah, running it with --net=host seemed to work, the NAT port mapping is now created. Thanks for your help.

---

<div class="post-metadata">

### Author: ![system](https://forum-uploads.syncthingcdn.net/original/2X/0/0b50e0a202b22ae6a67190759e8c868805b8ed9f.png) [@system](https://forum.syncthing.net/u/system)
#### Post date: [June 6, 2019, 3:21pm UTC](https://forum.syncthing.net/t/upnp-not-happening/13241/14 "2019-06-06T15:21:47Z")

</div>

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