Post

Redes domesticas DD-WRT WireGuard y Pi-hole

Redes domesticas DD-WRT WireGuard y Pi-hole

Redes domesticas DD-WRT WireGuard y Pi-hole

Este post ayuda a documentar tareas de red domestica: repetidores, VPN WireGuard, resolucion DNS con Pi-hole y pruebas basicas de conectividad.

WireGuard: servidor

1
2
3
4
5
6
7
8
[Interface]
Address = 10.10.10.1/24
ListenPort = 51820
PrivateKey = <PRIVATE_KEY>

[Peer]
PublicKey = <PUBLIC_KEY_CLIENTE>
AllowedIPs = 10.10.10.2/32

WireGuard: cliente

1
2
3
4
5
6
7
8
9
10
[Interface]
Address = 10.10.10.2/24
PrivateKey = <PRIVATE_KEY_CLIENTE>
DNS = <IP_DNS>

[Peer]
PublicKey = <PUBLIC_KEY_SERVIDOR>
Endpoint = vpn.example.local:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25

Comprobaciones

1
2
3
4
wg show
ip route
ping <IP_INTERNA>
dig example.local @<IP_DNS>

Wireshark basico

Filtros utiles:

1
2
3
4
ip.addr == <IP_INTERNA>
tcp.port == 443
dns
icmp

Consultar DNS en Cloudflare por API

1
2
3
4
5
6
curl -s -X GET \
  "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/dns_records?type=A&name=<FQDN>" \
  -H "X-Auth-Email: usuario@example.com" \
  -H "X-Auth-Key: <TOKEN>" \
  -H "Content-Type: application/json" \
  | jq -r '.result[0].content'

Actualizar OpenVPN con IP DNS

1
2
3
4
5
6
7
ip_dns="$(curl -fsS \
  -H "Authorization: Bearer <CLOUDFLARE_API_TOKEN>" \
  "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/dns_records?type=A&name=<FQDN>" \
  | jq -r '.result[0].content')"

nmcli connection modify "<VPN_CONNECTION>" +vpn.data "remote=$ip_dns"
nmcli connection reload
This post is licensed under CC BY 4.0 by the author.