eol's blog

I discovered DNS wildcard !

Why I am dumb

To host stuff, I obviously use DNS to access the various services I have, and to have a bit of load balancing.

I use knot for that, with a master/slave setup. Since most of my stuff is on a server in my flat, I use two cheap VPS as firewalls and proxy / NAT traffic through a tunnel.

So my zone file looked like that :

\[...\]

@                   IN  A       54.37.10.118
@                   IN  A       146.59.155.182

home                CNAME       avapxia
git                 CNAME       sysco.re.
acme                CNAME       sysco.re.
blog                CNAME       sysco.re.

avapxia             A           51.159.59.160
strigoi             A           54.37.10.118
moroi               A           146.59.155.182

\[...\]

This way, I have two IP addresses for each records, and I case OVH cook sausage again in one of their datacenter, I should keep access to my home server. It does not protect if I barbecue my flat, but at least I have control over that.

I could also specify another host if it was on another machine.

Each time I wanted a new web host, I would log into the DNS master on my server, insert the record I wanted, update the serial, reload knot, and it would be online.

It worked, everything was fine.

Wildcard DNS

Wildcard DNS permit to bind every request to a record. My file now look like this :

\[...\]

@                   IN  A       54.37.10.118
@                   IN  A       146.59.155.182

home                CNAME       avapxia
*                   CNAME       sysco.re.

avapxia             A           51.159.59.160
strigoi             A           54.37.10.118
moroi               A           146.59.155.182

\[...\]

And now : I can avoid touching my DNS master each time I have a new thing.

#Sysadmin