Running A MySQL-Based DNS Server: MyDNS - Page 2
2 Install A Web Interface To MyDNS
In the following steps I assume you use Debian Sarge; the default Debian Apache document root is /var/www so I will install the web interfaces here. Furthermore I assume that the host name is ns1.example.com.
2.1 phpMyAdmin
phpMyAdmin has been installed at the beginning of this tutorial (apt-get install mysql-server mysql-client libmysqlclient12-dev phpmyadmin), so you should be able to access it under http://ns1.example.com/phpmyadmin. Then select the database mydns, and you should see the tables rr and soa. Have a look here for an explanation of the database structure/fields, etc.: http://mydns.bboy.net/doc/html/mydns_8.html#SEC8
2.2 The Original MyDNS Web Interface
To install the original MyDNS web interface (comes with the MyDNS sources that should still be in the /tmp directory), do this:
cp /tmp/mydns-1.0.0/contrib/admin.php /var/www
Then edit /var/www/admin.php and configure the variables in the first part of that script, e.g. like this:
/***************************************************************************** |
Take care that you fill in the correct database details. In addition to that I set $auto_update_serial and $auto_update_ptr to 1 and specify values in $default_ns and $default_mbox so that serials are incremented automatically in case of changes and PTR records are also created automatically. But of course, this is up to you if you wish that behaviour.
You can now access the web interface under http://ns1.example.com/admin.php.
2.3 Install MyDNSConfig
MyDNSConfig is an interface written by me using PHP. I found that the original MyDNS web interface is hard to handle for newbies because it does not have any field descriptions (it is easy to manage if you come from the Bind world though because of the design of the interface which resembles Bind's zone files).
You can download MyDNSConfig from http://www.mydnsconfig.org.
Now lets assume you have downloaded mydnsconfig-<version>.tar.gz to /tmp. Then you install it like this:
cd /tmp
tar xvfz mydnsconfig-<version>.tar.gz
cd mydnsconfig
cp -fr * /var/www
Then you have to adjust /var/www/lib/config.inc.php. Mine looks like this:
<?php |
Make sure you fill in the correct database details! If you want MyDNSConfig to automatically create reverse DNS records (PTR records) when you create a new DNS records, then set $conf['auto_create_ptr'] to 1 and specify a default name server in $conf['default_ns'] (do not forget the dot at the end!) and an admin email address in $conf['default_mbox'] (also with a dot at the end, and the @ sign must be replaced by a dot!).
Next we have to change the rr and soa table in the mydns database and create a new table needed by MyDNSConfig:
mysql -u root -p
Enter password:
Use mydns;
ALTER TABLE `rr` ADD `sys_userid` INT NOT NULL,
ADD `sys_groupid` INT NOT NULL AFTER `sys_userid`,
ADD `sys_perm_user` VARCHAR( 5 ) NOT NULL AFTER `sys_groupid`,
ADD `sys_perm_group` VARCHAR( 5 ) NOT NULL AFTER `sys_perm_user`,
ADD `sys_perm_other` VARCHAR( 5 ) NOT NULL AFTER `sys_perm_group`;
ALTER TABLE `soa` ADD `sys_userid` INT NOT NULL,
ADD `sys_groupid` INT NOT NULL AFTER `sys_userid`,
ADD `sys_perm_user` VARCHAR( 5 ) NOT NULL AFTER `sys_groupid`,
ADD `sys_perm_group` VARCHAR( 5 ) NOT NULL AFTER `sys_perm_user`,
ADD `sys_perm_other` VARCHAR( 5 ) NOT NULL AFTER `sys_perm_group`;
CREATE TABLE `sys_user` (
`userid` int(11) NOT NULL auto_increment,
`sys_userid` int(11) NOT NULL default '0',
`sys_groupid` int(11) NOT NULL default '0',
`sys_perm_user` varchar(5) NOT NULL default '',
`sys_perm_group` varchar(5) NOT NULL default '',
`sys_perm_other` varchar(5) NOT NULL default '',
`username` varchar(100) NOT NULL default '',
`passwort` varchar(100) NOT NULL default '',
`modules` varchar(255) NOT NULL default '',
`startmodule` varchar(255) NOT NULL default '',
`app_theme` varchar(100) NOT NULL default 'default',
`typ` varchar(20) NOT NULL default 'user',
`active` tinyint(4) NOT NULL default '1',
`name` varchar(100) NOT NULL default '',
`vorname` varchar(100) NOT NULL default '',
`unternehmen` varchar(100) NOT NULL default '',
`strasse` varchar(100) NOT NULL default '',
`ort` varchar(100) NOT NULL default '',
`plz` varchar(10) NOT NULL default '',
`land` varchar(50) NOT NULL default '',
`email` varchar(100) NOT NULL default '',
`url` varchar(255) NOT NULL default '',
`telefon` varchar(100) NOT NULL default '',
`fax` varchar(100) NOT NULL default '',
`language` varchar(10) NOT NULL default 'de',
`groups` varchar(255) NOT NULL default '',
`default_group` int(11) NOT NULL default '0',
PRIMARY KEY (`userid`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;
INSERT INTO `sys_user` (`userid`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `username`, `passwort`, `modules`, `startmodule`, `app_theme`, `typ`, `active`, `name`, `vorname`, `unternehmen`, `strasse`, `ort`, `plz`, `land`, `email`, `url`, `telefon`, `fax`, `language`, `groups`, `default_group`) VALUES (1, 1, 0, 'riud', 'riud', '', 'admin', '21232f297a57a5a743894a0e4a801fc3', 'admin,designer,resellers,sites,dns', 'dns', 'default', 'admin', 1, '', 'Administrator', '', '', '', '', '', '', '', '', '', 'en', '1,2', 1);
quit;
Now you can access MyDNSConfig under http://ns1.example.com. The default login username is admin, the password is also admin. Please change the password after your first login under System -> Edit user.
2.4 Use dig To Test Your Records
After you have created DNS records using one of the three web interfaces I have described here, you can test your records using dig. Lets assume you have created the zone test.com. (with a dot at the end!) with the A record www. When you run
dig @localhost www.test.com
the output should look like this:
:~# dig @localhost www.test.com |
If you have enabled automatic creation of PTR records in the original MyDNS web interface or in MyDNSConfig, then you can also check the reverse DNS record. If www.test.com points to 1.2.3.4, then
dig @localhost -x 1.2.3.4
should show something like this:
~# dig @localhost -x 1.2.3.4 |