System Administrator Guide

DNS4J Server

Installation

On Linux:

  1. Install Java 6 Runtime Enviroment on you server
  2. download latest DNS4J release from http://dns4j.sourceforge.net/downloads
  3. put downloaded jar in $JRE_HOME/lib/ext
  4. create configurations files:
    • mkdir /etc/dns4j
    • touch /etc/dns4j/nsd.yml
  5. if you choose to use MySQL as zone storage do also:
    • install mysql jdbc driver in $JRE_HOME/lib/ext
    • create database (CREATE DATABASE dns4j)
    • create a database user (GRANT ALL ON dns4j.* TO 'dns4j'@'localhost' IDENTIFIED BY 'password')
    • initialize database (run java it.lorenzoingrilli.dns4j.nsadmin --install-db -j jdbc:mysql://localhost:3306/dns4j --username=dns4j --password=password)
  6. done

Configuration

The default configuration file is located in /etc/dns4j/nsd.yml

You can configure various component using YAML language:

  • generic components
  • plugins
  • resolvers

A simple configuration file (tcp/udp sever, yaml zones datastore):

---
&yaml !yamlresolver { file: /etc/dns4j/zones.yml }
---
!tcp { port: 5053, resolver: *yaml}
---
!udp { port: 5053, resolver: *yaml}
---

And example yaml zones file (/etc/dns4j/zones.yml):

!zone
name: example.net
rrs:
- !soa { name: example.net, mname: ns.example.net, rname: info.example.net, ttl: 300}
- !txt { name: www.example.net, data: test, ttl: 100 }
- !a { name: www.example.net, address: 10.11.12.13 }
- !mx { name: example.net, exchange: mail.example.net, preference: 10 }

 

Command line utilities

Launch name server daemon:

java it.lorenzoingrilli.dns4j.nsd

Supported Resource Records (RR)

Currently dns4j support following kind of resource records: SOA, NS, A, AAAA, MX, CNAME, TXT, HINFO, PTR, SRV
Unknown RR are also supported.

Resolvers

Following resolvers are supported:

  • Yaml Resolver. Shortcut !yamlresolver , you should indicate a 'file' properties, this file is the zones file in yaml format.
  • Database Resolver. Shorcut !dbresolver, you should indicate a 'datasource'.
  •  Scripted Resolver. Shortcut !scriptresolver, you should indicate a 'file' properties. This file is a script which return a DNS Message. All language compatible with "JSR 223: Scripting for the Java™ Platform API" are supported (tested aganist Groovy 1.7 and JRuby 1.9). You can have a statefull script (across multiple executions) by using the 'context' variable (map).