> 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/es/networking/wireguard--adding-nameserver-entries-to-client-configs.md).

# WireGuard: agregar entradas de servidor de nombres a las configuraciones del cliente

Cómo agregar scripts PostUp y PostDown a las configuraciones del cliente WireGuard para la resolución de servidores de nombres DNS en Windows y Linux.

Las siguientes son instrucciones para agregar un **PostUp** y **PostDown** script a la **WireGuard** configuración.\
Para **Windows**, esto agrega **PowerShell** comandos para agregar y eliminar una **Regla del cliente DNS** cuando el cliente se conecta y se desconecta.

## Clientes Windows

1. En el **Windows** cliente WireGuard, **edita la configuración**.
2. Agrega los siguientes comandos en la **\[Interface]** sección:

```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. Cambia las siguientes entradas para que coincidan con **tu** configuración:
   * **Espacio de nombres**: Una lista de nombres de dominio separados por comas para agregar.
   * **Servidores de nombres**: Una lista de direcciones IP de servidores de nombres separadas por comas.

{% hint style="info" %}
**Para -match, asegúrate de incluir una barra invertida (\\) antes de cada punto (.)**
{% endhint %}

***

## Clientes Linux

Esto puede variar según tu distribución de Linux.

1. **Edita el archivo de configuración** en el **Linux** cliente.
2. En el **\[Interface]** sección, agrega lo siguiente:

```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. Reemplace **10.1.10.2** con la IP correcta de tu **servidor de nombres**.
4. Reemplace **domainname.com** con tu nombre de dominio.

***

{% hint style="info" %}
**Información del documento**

* Última actualización: 2024-08-29
* Versión 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
