# Utilizzo della funzione NAT IPv6 in Docker con Discourse

**URL:** https://meta.discourse.org/t/using-ipv6-nat-function-in-docker-with-discourse/253218
**Category:** Self-hosting
**Created:** [29 Gennaio 2023, 11:24am UTC](https://meta.discourse.org/t/using-ipv6-nat-function-in-docker-with-discourse/253218 "2023-01-29T11:24:03Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![GuidoD](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/guidod/32/292621_2.png) [@GuidoD](https://meta.discourse.org/u/GuidoD)
#### Post date: [29 Gennaio 2023, 11:24am UTC](https://meta.discourse.org/t/using-ipv6-nat-function-in-docker-with-discourse/253218/1 "2023-01-29T11:24:03Z")

</div>

per informazione, ho appena creato una pull request per web.ssl.template.yml per poter utilizzare la funzione NAT IPv6 di Docker in un’istanza Discourse.  
Con la mia modifica sono stato in grado di utilizzare il NAT IPv6 di Docker con Discourse.  
Senza la mia modifica, le richieste dai client IP6 venivano rifiutate da Discourse, solo le richieste dai client IP4 venivano accettate.  
NAT IP6 è ora gestito da Docker in modo simile a NAT IP4.

> <https://github.com/discourse/discourse_docker/pull/671>
>
> the "listen \[::\]:443 ssl http2;" is also required in the first rewrite section w…here it was only rewritten to "listen 443 ssl http2;" Otherwise Discourse will reject requests from pure IP6 webbrowser access.
> 
> it has to be:
> - replace: filename: "/etc/nginx/conf.d/discourse.conf" from: /listen 80;\\s+listen \\\[::\\\]:80;\\s+gzip on;/m to: | listen 443 ssl http2; listen \[::\]:443 ssl http2; SSL\_TEMPLATE\_SSL\_BLOCK
> 
> With this change the docker IPv6 NAT is handled correctly by Discourse.
> 
> In order to enable IP6 in docker without the userland-proxy do create the file /etc/docker/daemon.json and do restart the docker daemon. Then the original IP6 from the accessing client is visible in Discourse for the admins under last IP address and can be checked with the IP check. With the userland-proxy only the IP4 address of the docker daemon would be shown there.
> 
> Here the content of my daemon.json (I just anonymized my DNS servers a little bit with the xxx): {
> "userland-proxy": false,
> "ipv6": true,
> "fixed-cidr-v6": "fd00::/80",
> "experimental": true,
> "ip6tables": true,
> "dns": \["xxx.169.148.34","xxx.214.7.22","8.8.8.8","8.8.4.4"\]
> }
> 
> With this the docker container is not exposed directly to the internet with a global IPv6 but instead it is running with a ULA that is not accessible globally. So IP6 is handled in docker with NAT like IP4.
> And Discourse is now reachable by IP4 and IP6 and always the original IP address is visible in Discourse.

---

<div class="post-metadata">

### Author: ![GuidoD](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/guidod/32/292621_2.png) [@GuidoD](https://meta.discourse.org/u/GuidoD)
#### Post date: [4 Aprile 2023, 10:35am UTC](https://meta.discourse.org/t/using-ipv6-nat-function-in-docker-with-discourse/253218/2 "2023-04-04T10:35:48Z")

</div>

Qualcuno del team di sviluppatori principali di Discourse può controllare la mia PR? In modo che venga unito o rifiutato e chiuso.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [4 Aprile 2023, 10:45am UTC](https://meta.discourse.org/t/using-ipv6-nat-function-in-docker-with-discourse/253218/3 "2023-04-04T10:45:28Z")

</div>

Il problema qui è che non sono sicuro che vogliamo aumentare questa superficie per impostazione predefinita.

Sono indeciso se cambiare questo per tutte le installazioni, esporre v6 potrebbe o meno essere l’intento dell’utente.

Chiederò internamente se vogliamo apportare o meno la modifica.

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [4 Aprile 2023, 5:41pm UTC](https://meta.discourse.org/t/using-ipv6-nat-function-in-docker-with-discourse/253218/5 "2023-04-04T17:41:16Z")

</div>

> [@sam](#):
>
> Sono combattuto riguardo al cambiamento per tutte le installazioni, esporre v6 potrebbe o non potrebbe essere l’intento dell’utente.

Concordo. Quanto segue è un modo migliore per farlo e offre un facile percorso per aderire a questo comportamento:

> <https://github.com/discourse/discourse_docker/pull/701>
>
> By default nginx in the container only listens for IPv4 connections. Some users
> …want to enable direct IPv6 connectivity to the container either via forwarding
> or NAT. This provides an easy method to allow that.

---

<div class="post-metadata">

### Author: ![GuidoD](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/guidod/32/292621_2.png) [@GuidoD](https://meta.discourse.org/u/GuidoD)
#### Post date: [5 Aprile 2023, 6:47am UTC](https://meta.discourse.org/t/using-ipv6-nat-function-in-docker-with-discourse/253218/6 "2023-04-05T06:47:36Z")

</div>

grazie per la PR. e che è stata unita immediatamente in discourse docker.  
Ho appena fatto il `git pull`, abilitato il “templates/web.ipv6.template.yml” in app.yml e ricostruito l’app dopo aver disabilitato le mie modifiche in web.ssl.template.yml.

Il nostro sito funziona ancora bene su IPv4 e IPv6. 😉

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [5 Maggio 2023, 6:48am UTC](https://meta.discourse.org/t/using-ipv6-nat-function-in-docker-with-discourse/253218/7 "2023-05-05T06:48:21Z")

</div>

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