Skip to content
/ dnsf Public

A simple DNS server built on top of https://github.com/miekg/dns which aims at loading a single file defining the DNS records.

Notifications You must be signed in to change notification settings

maoueh/dnsf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DNSF(aker)

A simple DNS server built on top of https://github.com/miekg/dns which aims at loading a single file defining the DNS records.

The server reads all the records and infers which zone it manages by collecting all unique zones and sub-zones.

The server then serves queries for those answer questions with records that matches the type.

Note

Caveats Only one question is supported per query for now.

Here the copy of simple.zone file:

$ORIGIN matt.local.     ; designates the start of this zone file in the namespace
$TTL 3600                ; default expiration time (in seconds) of all RRs without their own TTL value
matt.local.  IN  SOA   ns.matt.local. username.matt.local. ( 2020091025 7200 3600 1209600 3600 )
matt.local.  IN  NS    ns
matt.local.  IN  A     127.0.0.1
ns            IN  A     127.0.0.1
workers            IN  A     12.0.0.2
workers            IN  A     12.0.0.3

Note

The SOA records is required and used for providing authority information on DNS answer

Install

go install github.com/maoueh/dnsf@latest

Run

# Listen on 8053 by default, pass port as second argument to change it
dnsf run simple.zone

Test

dig -p 8053 @127.0.0.1 matt.local A
dig -p 8053 @127.0.0.1 workers.matt.local A

Local IPs

You can create listenable IPs on Mac OS X (and probably Unix works too) by creating an alias for the loopback interface:

sudo ifconfig lo0 alias 12.0.0.1
sudo ifconfig lo0 alias 12.0.0.2
sudo ifconfig lo0 alias 12.0.0.3
sudo ifconfig lo0 alias 12.0.0.4
sudo ifconfig lo0 alias 12.0.0.5

You can then make you service listen on 12.0.0.X:<port> and register multiple A records under a subdomain on your local zone file:

...
workers            IN  A     12.0.0.1
workers            IN  A     12.0.0.2
workers            IN  A     12.0.0.3
workers            IN  A     12.0.0.4
workers            IN  A     12.0.0.5

Load balancer working with DNS name server will be able to spread the local through all those 5 addresses.

About

A simple DNS server built on top of https://github.com/miekg/dns which aims at loading a single file defining the DNS records.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages