66 lines
2.5 KiB
Markdown
66 lines
2.5 KiB
Markdown
---
|
||
title: 'Hosting websites without a static IP with Gandi LiveDNS'
|
||
date: 2022-12-29T18:11:42-05:00
|
||
toc: false
|
||
images:
|
||
tags:
|
||
- web
|
||
- homelab
|
||
description: Want to ditch expensive dynamic DNS and keep your home server online? I built a tool to use Gandi's free LiveDNS with lightning-fast updates – under 250ms!
|
||
---
|
||
|
||
I've been hosting this website at home now for a few years. My ISP doesn't offer
|
||
a static IP address however, which means my IP address occasionally changes.
|
||
This is sort of a dealbreaker, because your domain will be left pointing to the
|
||
wrong address whenever your IP address changes.
|
||
Luckily you can solve this by using a dynamic DNS solution, like DynDNS, but these
|
||
can be pretty pricy.
|
||
|
||
Which is why I was very excited when I saw [gandi.net](https://www.gandi.net/)
|
||
has a system they call "LiveDNS" which allows you to update the IP address your
|
||
domain points to very quickly. Their website advertises that updates are
|
||
propagated in under 250ms which is amazing. Although other DNS servers may cache
|
||
results and not update for significantly longer, that's not a massive issue for
|
||
me. My IP address doesn't change that often, and my personal blog having a short
|
||
downtime is not a big deal.
|
||
|
||
Gandi provides this service at no additional cost, all you need to do is to
|
||
register your domain with them (or transfer it over). I've been using them for
|
||
years and have had great service, and the LiveDNS is the cherry on top.
|
||
|
||
## Updating your IP
|
||
|
||
Unlike some other dynamic DNS providers, Gandi does not provide a program that
|
||
you can use to update your IP address. But being an open API, there are many
|
||
programs and scripts you can use to update your IP. One of these is a program I
|
||
made, [gandi-live-dns-rust](https://github.com/SeriousBug/gandi-live-dns-rust).
|
||
|
||
After installing `gandi-live-dns` on my home server (I used the ArchLinux
|
||
package, but there are other options available), I copied over the
|
||
[example configuration](https://github.com/SeriousBug/gandi-live-dns-rust/blob/master/example.toml)
|
||
|
||
in the repository. I just added my domain, obtained an API key and set it up,
|
||
then I just added the subdomains I want.
|
||
|
||
```
|
||
fqdn = "bgenc.net"
|
||
api_key = "key goes here"
|
||
|
||
[[entry]]
|
||
name = "@"
|
||
types = ["A"]
|
||
|
||
[[entry]]
|
||
name = "gitea"
|
||
types = ["A"]
|
||
|
||
[[entry]]
|
||
fqdn = "kaangenc.me"
|
||
name = "@"
|
||
types = ["A"]
|
||
```
|
||
|
||
The configuration file is a bit trimmed, but it shows the gist of everything.
|
||
I'm updating `bgenc.net`, along with `gitea.bgenc.net`. I also update
|
||
`kaangenc.me`, which is an old domain I was using.
|