VMware Images:
|
Running A MySQL-Based DNS Server: MyDNS
|
This is a "copy & paste" HowTo! The easiest way to follow this tutorial is to use a command line client/SSH client (like PuTTY for Windows) and simply copy and paste the commands (except where you have to provide own information like IP addresses, hostnames, passwords,...). This helps to avoid typos.
Running A MySQL-Based DNS Server: MyDNS Version 1.0 In this tutorial I will describe how to install and configure MyDNS, a DNS server that uses a MySQL database as backend instead of configuration files like, for example, Bind or djbdns. This has the advantage that you can easily use web-based frontends to administrate your DNS records. You could even write your own frontend, e.g. using PHP, to interact with the MyDNS database. MyDNS simply reads the records from the database, and it does not have to be restarted/reloaded when DNS records change or zones are created/edited/deleted! This is a major advantage. I will also show how to set up a secondary DNS server, but I will not use normal zone transfers to get the records from the primary to the secondary DNS server; instead, I will use MySQL database replication. I will simply replicate the data from the primary to the secondary server. There are multiple web frontends to MyDNS. Of course, you can use phpMyAdmin for the MyDNS administration, or you can use the web frontend that comes with MyDNS (which is not for beginners because it lacks the field descriptions), or you can use MyDNSConfig, a tool written by myself. I will show how to install each of them. All in all, MyDNS makes a very good impression on me, and I think that the future belongs to services that use a database as backend instead of configuration files. I have used a Debian Sarge system for this setup. However, most of the steps described here should also apply to other distributions like Fedora, SuSE, Mandriva, etc. I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!
1 Install MySQL And MyDNSFirst, make sure you have a working basic Debian installation, as described on http://www.howtoforge.com/perfect_setup_debian_sarge and http://www.howtoforge.com/perfect_setup_debian_sarge_p2 (please refer to the respective "Perfect Setup" document on HowtoForge if you use another distribution). Then install MySQL: apt-get install mysql-server mysql-client libmysqlclient12-dev phpmyadmin You will be asled a few questions: Enable suExec? <-- Yes Set a root MySQL password like this: mysqladmin -u root password yourrootsqlpassword The MyDNS installation is easy. Just follow these steps: cd /tmp/ Now we have to create the MyDNS database (called mydns) and a MyDNS database user (also called mydns, with mydns_password as password): mysql -u root -p Now, on the MySQL shell, we create the mydns database and the user mydns: CREATE DATABASE mydns; Back on the normal shell, we create the tables in the mydns database: mydns --create-tables | mysql -u root -p mydns If you see errors like these: mydns[14287]: error loading gid for group `nobody' do not worry, you can forget about them. Next we add two more columns to the soa table of the mydns database: mysql -u root -p With the active column, you can simply enable/disable zones later on, and the xfer column can be used for zone transfers (which we do not need because we will use MySQL database replication to get the data to the secondary DNS server, but I mention it for completeness) (if you want to use zone transfers instead of database replication, then the xfer column should contain one or more IP addresses separated by commas. These IP addresses will be allowed to transfer the zone.). Now we create the MyDNS configuration file /etc/mydns.conf by running this command: cd /tmp/mydns-1.0.0/ Then we edit /etc/mydns.conf so that it looks like this:
Make sure to fill in the correct database details, and also take care about the group. On Debian, nobody's group is nogroup, which is different from the default value in /etc/mydns.conf (also nobody), so make sure you change this! Also set allow-tcp to yes. Now we create the MyDNS init script /etc/init.d/mydns:
Then we make it executable and start MyDNS: chmod 755 /etc/init.d/mydns If you want that MyDNS is started automatically during the system boot, you have to create the necessary system bootup links. On Debian, you do it like this: update-rc.d mydns defaults 21 22 On Fedora or RedHat, you would run this: chkconfig --levels 235 mydns on
|



print: 


Recent comments
1 day 23 hours ago
3 days 1 hour ago
3 days 8 hours ago
3 days 9 hours ago
4 days 10 hours ago
5 days 21 hours ago
6 days 7 hours ago
1 week 1 hour ago
1 week 7 hours ago
1 week 1 day ago