# Configurar DDNS Cloudflare en EdgeRouter 4

<figure><img src="/files/aBTolPyKqTIpAfdN1ZAT" alt=""><figcaption></figcaption></figure>

El cliente que usa el ER-4 es `ddclient`, actualmente no es compatible con la API v4 de Cloudflare, por tanto si intentas configurarlo via web o consola, no va sincronizar la IP con nuestro dominio.\
\
Requisitos:\
\- EdgeRouter 4 (valido EdgeRouter 6P) con firmware: `v2.0.9-hotfix.7` y `v3.0.0`\
\- Dominio con Cloudflare<br>

Entramos en Cloudflare, necesitaremos crear el subdominio y obtener la global api key.

<figure><img src="/files/YbOqHeyzS8ZhjiPJJPAP" alt=""><figcaption></figcaption></figure>

Seleccionamos nuestro dominio y bajamos al final de la página, y pinchamos a la derecha donde pone "**Obtenga el token de la API**"<br>

<figure><img src="/files/RyTgdGQiouLWYAumjUFq" alt=""><figcaption></figcaption></figure>

Pinchamos en "**Ver**" en "**Global API Key**"

<figure><img src="/files/Ewwm5o1Cl4iopQVwMMms" alt=""><figcaption></figcaption></figure>

nos aparecerá esta ventana, nos identificamos con nuestra clave de acceso y después nos mostrara la API KEY, la copiamos y la guardamos, que la vamos a necesitar mas tarde.<br>

<figure><img src="/files/am19xbu95HWg8p3gsyQW" alt=""><figcaption></figcaption></figure>

Ya con la key, ahora creamos el subdominio, volvemos a la pantalla principal de Cloudflare, y ahora pulsamos en "**DNS / Registros**" en el menu lateral.

<figure><img src="/files/h5cDO3kiblVky4ywaXrb" alt=""><figcaption></figcaption></figure>

Veremos una pantalla como esta

<figure><img src="/files/mBO43M6EbzYFAuia7WAp" alt=""><figcaption></figcaption></figure>

Pinchamos en "**Agregar registro**" y rellenamos los campos y guardamos.\
\
**Tipo:** A\
**Nombre:** el que queramos, solo nombre, ese va ser el nombre de nuestro subdominio `{subdomino}.{nuestro_dominio.com}`\
**Dirección IPv4:** Podemos poner cualquier IP, luego se va actualizar sólo cuando configuremos el ER-4\
**Estado del proxy:** Lo deshabilitamos\
**TTL:** Automático.

<figure><img src="/files/xh8pnb4CaEVc5GzwmiIP" alt=""><figcaption></figcaption></figure>

Ejemplo:

<figure><img src="/files/BGqb4hjjTfzS2g6Sn1MH" alt=""><figcaption></figcaption></figure>

Ya tenemos nuestra Global API key y nuestro subdominio creado, ahora nos vamos al router.

Abrimos un terminal y entramos a el por SSH.

<figure><img src="/files/1MKjJeuTtDobhHjFq00x" alt="v2.0.9-hotfix.7"><figcaption></figcaption></figure>

<figure><img src="/files/hxvYigdFvALvf0Okn6Xh" alt="v3.0.0"><figcaption></figcaption></figure>

Ahora es copiar, cambia los datos por los tuyos y pegalos en el terminal. Cambia el interface por el que corresponda en tu caso, en el mio es el `pppoe0`.

```sh
configure
set service dns dynamic interface pppoe0 service custom-cloudflare protocol cloudflare
set service dns dynamic interface pppoe0 service custom-cloudflare server api.cloudflare.com/client/v4
set service dns dynamic interface pppoe0 service custom-cloudflare host-name {your_subdomain.your_domain.com}
set service dns dynamic interface pppoe0 service custom-cloudflare login "your_mail_account_cloudflare"
set service dns dynamic interface pppoe0 service custom-cloudflare password "your_global_api_key"
set service dns dynamic interface pppoe0 service custom-cloudflare options "zone=your_domain.com use=web ssl=yes ttl=1"
commit ; save
```

Si nos fijamos le estamos diciendo en la parte `server`, que use la v4 del cliente de cloudflare. Y en `options`, le pasamos unos parámetros adicionales.

Comprobar el estado de sincronización:

<pre class="language-sh"><code class="lang-sh"><strong>show dns dynamic status
</strong></code></pre>

y nos devolverá si ha ido todo bien algo asi:

```sh
interface    : pppoe0
ip address   : xxx.xxx.xxx.xxx
host-name    : your.domain.com
last update  : Fri Dec 27 18:01:23 2024
update-status: good
```

Forzar actualización:

```sh
update dns dynamic interface pppoe0          
```

output:

```sh
interface    : pppoe0 
[ Status will be updated within 60 seconds ]
```

```sh
$ show dns dynamic status
interface    : pppoe0
ip address   : xxx.xxx.xxx.xxx
host-name    : your.domain.com
last update  : Wed Aug 27 15:08:22 2025
update-status: good
```

Si nos volvemos a cloudlfare, veremos que ahora aparece nuestra IP pública en nuestro registro de DNS. 🎉


---

# Agent Instructions: 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:

```
GET https://blog.azagra.dev/unifi/configurar-ddns-cloudflare-en-edgerouter-4.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
