Step by step to install SynKnot

How to deploy SynKnot on your DNS server. You should have prepared DNS server (e.g. on Debian), Knot DNS server (installed on your DNS server) and your own database (or other kind of storage like REST service, Web service, …) with DNS records. Let’s start:

SSH to your DNS server

That is an easy one, isn’t it? You will have probably more DNS servers (primary and secondary). The instructions are the same for both of them. You can set up primary / secondary server status in config.ini (later on).

It is probably not a good idea to run synchronization tool from the root account. It could be ok for testing purposes, but for production, it is better to use dedicated user with the custom rights. This user needs rights to restart Knot DNS server. If you have installed Knot DNS server (apt-get install knot), it will create a user and group named “knot”. Thats the right user for our purpose.

Or you can choose different installation path. It doesn’t matter. In that case, change other paths accordingly.

The synknot folder will be created with the whole aplication. You can update your SynKnot instance anytime you want. Just run git pull. Your own configuration file (config.ini) will not be rewritten.

You will probably run SynKnot reload and reboot commands via cron. And in the crontab, you can specify the user, who will be running SynKnot (user knot). So it’s necessary to set up right rights to the files.

We are now making your own confing.ini. The config.ini is in the gitignore path. So don’t worry about the rewriting. You can setup predefined variables and even define your own variables, which can be used in the custom adapters (later on).

Change your preferences in the config.ini file

All config.ini.dist configurations are the defaults. Your config.ini will rewrite these configurations. You don’t have to rewrite all of the options. Just select the one, that interesting for you.

Some other CUSTOM parameters for CUSTOM DataAdapters – they will be inserted to the adapter automatically. You can use any config name or value, that you want (keep in mind, not to rewrite used once – up here)

  • server = 192.168.1.1
  • login = root
  • password = password
  • database = databasename

You can define your own configurable options, which can by used in your data adapters.

We are creating the copies of data adapters. Do not overwrite default adapters, because it can be rewritten in future updates. Content of the data adapter is up to you. Some basic skills of SQL querying will be probably needed.

Edit the adapters, that they can return lists of DNS / PTR

You can find the example data structure in the test adapters.

Link your new adapters at config.ini

There are two paths definded in config.ini. The first for DNS records adapter and the second for PTR records adapter. Use similar name of the class, name the class file accordingly and you are good to go.

and finally run SynKnot synchronization:

This is basic command, which is needed to run your synchronization. It’s based on Symfony console structure. You don’t want to restart your SynKnot all the time. It is better to run php ./dns-sync.php dns-sync:restart once a day (for example) and php ./dns-sync.php dns-sync:reload every five minutes (for example). Restart will load all the zones from the master server (in case of your runnig restart on the slave server). And reload only load the changes.

For more commands, you can use standard Symfony console php /opt/synknot/dns-sync.php It will show you a list of available commands.