Domain instead of ip in Wireguard
from Dust0741@lemmy.world to selfhosted@lemmy.world on 17 Nov 2024 03:54
https://lemmy.world/post/22113565

Like the title says, I want to replace the IP address in a wireguard .conf file to be a domain instead.

I own a domain through cloudflare, so say I wanted to use vpn.example.org

What DNS record and info do I need to put into Cloudflare? (I am aware I’ll need to update it if my ip changes)

#selfhosted

threaded - newest

Decipher0771@lemmy.ca on 17 Nov 2024 04:10 next collapse

Just an A record, you just need the domain query to resolve to your IP.

Dust0741@lemmy.world on 17 Nov 2024 04:30 collapse

Thank you. It really was that simple

majestictechie@lemmy.fosshost.com on 17 Nov 2024 09:46 collapse

I do this on my home network which has a Dynamic IP. I wrote a script which I cron to check and update it if it changes github.com/MajesticTechie/CloudflareDynamicDNS

SaltySalamander@fedia.io on 17 Nov 2024 14:46 collapse

I do this with the dynamic dns plugin in OPNsense. It really is set-it-and-forget-it.

eskuero@lemmy.fromshado.ws on 17 Nov 2024 09:29 next collapse

Note that most wireguard clients wont re-resolve when the dns entry changes and they will keep silently a failed tunnel so you would have to do some measure to periodically restart the tunnel.

state_electrician@discuss.tchncs.de on 17 Nov 2024 14:22 collapse

It is that easy, like you said. And with Cloudflare and Caddy you can get TLS for your internal VPN hosts. I love that.

Dust0741@lemmy.world on 17 Nov 2024 22:56 next collapse

Yup! This is what I do! Love it so much

Ajen@sh.itjust.works on 20 Nov 2024 23:42 collapse

LetsEncrypt is a good option if you want to set it up yourself. More work than cloudflare though.

state_electrician@discuss.tchncs.de on 21 Nov 2024 05:08 collapse

I am using Let’s Encrypt. Cloudflare is used for DNS validation.