> For the complete documentation index, see [llms.txt](https://docs.verge.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verge.io/knowledge-base/fr/networking/wireguard--adding-nameserver-entries-to-client-configs.md).

# WireGuard - Ajout d’entrées de serveur de noms aux configurations client

Les instructions suivantes expliquent comment ajouter un **PostUp** et **PostDown** script à la **WireGuard** configuration.\
Pour **Windows**, cela ajoute **PowerShell** des commandes pour ajouter et supprimer une **règle client DNS** lorsque le client se connecte et se déconnecte.

## Clients Windows

1. Dans le **Windows** client WireGuard, **modifiez la config**.
2. Ajoutez les commandes suivantes dans la **\[Interface]** section :

```pwsh
PostUp = powershell -command "Add-DnsClientNrptRule -Namespace 'domainname.com' -NameServers '10.1.10.2'"
PostDown = powershell -command "Get-DnsClientNrptRule | Where { $_.Namespace -match '.*domainname\.com' } | Remove-DnsClientNrptRule -force"
```

3. Modifiez les entrées suivantes pour qu'elles correspondent à **votre** configuration :
   * **Namespace**: Une liste de noms de domaine séparés par des virgules à ajouter.
   * **NameServers**: Une liste d'adresses IP de serveurs de noms séparées par des virgules.

{% hint style="info" %}
**Pour -match, assurez-vous d'inclure une barre oblique inverse (\\) avant chaque point (.)**
{% endhint %}

***

## Clients Linux

Cela peut varier selon votre distribution Linux.

1. **Modifiez le fichier de configuration** sur le **client Linux** .
2. Dans le **\[Interface]** section, ajoutez ce qui suit :

```bash
PostUp = resolvectl dns %i 10.1.10.2; resolvectl domain %i domainname.com
PreUp = iptables -A INPUT -i wg -m state --state ESTABLISHED,RELATED -j ACCEPT
PreUp = iptables -A INPUT -i wg -j REJECT
PostDown = iptables -D INPUT -i wg -m state --state ESTABLISHED,RELATED -j ACCEPT
PostDown = iptables -D INPUT -i wg -j REJECT
```

3. Remplacez **10.1.10.2** avec l'adresse IP correcte de votre **serveur de noms**.
4. Remplacez **domainname.com** avec le nom de votre domaine.

***

{% hint style="info" %}
**Informations sur le document**

* Dernière mise à jour : 2024-08-29
* Version de vergeOS : 4.12.6
  {% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.verge.io/knowledge-base/fr/networking/wireguard--adding-nameserver-entries-to-client-configs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
