远程下载http://mydns.bboy.net/download/mydns-1.1.0.tar.gz1. 因为mydns依赖mysql,所以需要先安装mysql。yum install -y mysql-server2. 安装mydnswgethttp://www.lishiming.net/data//a ... ql-1.1.0-1.i386.rpmrpm -ivh mydns-mysql-1.1.0-1.i386.rpm3. 创建库和表mysql -uroot -e "create database mydns"mysql -uroot mydnsmysql> CREATE TABLE `soa` ( `id` int(10) unsigned NOT NULL auto_increment, `origin` char(255) default NULL, `ns` char(255) default NULL, `mbox` char(255) default NULL, `serial` int(10) unsigned default '1', `refresh` int(10) unsigned default '28800', `retry` int(10) unsigned default '7200', `expire` int(10) unsigned default '604800', `minimum` int(10) unsigned default '86400', `ttl` int(10) unsigned default '86400', `xfer` char(255) default NULL, PRIMARY KEY (`id`), UNIQUE KEY `origin` (`origin`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=gbk;mysql> CREATE TABLE `rr` ( `id` int(10) unsigned NOT NULL auto_increment, `zone` int(10) unsigned NOT NULL, `name` char(64) default NULL, `type` enum('A','AAAA','CNAME','HINFO','MX','NAPTR','NS','PTR','RP','SRV','TXT') default NULL, `data` char(128) default NULL, `aux` int(10) unsigned NOT NULL, `ttl` int(10) unsigned NOT NULL default '600', `inter` tinyint(3) unsigned NOT NULL default '1', `intra` tinyint(3) unsigned NOT NULL default '1', PRIMARY KEY (`id`), KEY `name` (`name`), KEY `rr` (`zone`,`name`,`type`,`data`) ) ENGINE=MyISAM AUTO_INCREMENT=1437896 DEFAULT CHARSET=gbk;4. 创建第一个zonemysql> use mydnsmysql> insert into soa (id, origin,ns,mbox,serial,refresh,retry,expire,minimum,ttl) values(1,'abc.com.', 'ns.abc.com.', 'root.aminglinux.com', 1, 28800, 7200, 604800, 86400, 86400);mysql> insert into rr values(1, 1, 'www', 'A', '1.1.1.1', 0, 1, 1, 1, 1);
5. mydns配置
cat /etc/mydns.conf
##
## /etc/mydns.conf
## Wed Nov 19 10:04:14 2008
## For more information, see mydns.conf(5).
##
# DATABASE INFORMATION
db-host = localhost # SQL server hostname
db-user = yourdbname # SQL server username
db-password = yourpassword # SQL server password
database = dns # MyDNS database name
# GENERAL OPTIONS
user = nobody # Run with the permissions of this user
group = nobody # Run with the permissions of this group
listen = * # Listen on these addresses ('*' for all)
no-listen = # Do not listen on these addresses
# CACHE OPTIONS
zone-cache-size = 1024 # Maximum number of elements stored in the zone cache
zone-cache-expire = 60 # Number of seconds after which cached zones expires
reply-cache-size = 1024 # Maximum number of elements stored in the reply cache
reply-cache-expire = 30 # Number of seconds after which cached replies expire
# ESOTERICA
log = /var/log/mydns.log # Facility to use for program output (LOG_*/stdout/stderr)
pidfile = /var/run/mydns.pid # Path to PID file
timeout = 120 # Number of seconds after which queries time out
multicpu = 4 # Number of CPUs installed on your system - (deprecated)
servers = 2 # Number of servers to run
recursive = 8.8.8.8 # Location of recursive resolver
recursive-timeout = # Number of seconds before first retry
recursive-retries = # Number of retries before abandoning recursion
recursive-algorithm = # Recursion retry algorithm one of: linear, exponential, progressive
allow-axfr = no # Should AXFR be enabled?
allow-tcp = no # Should TCP be enabled?
allow-update = no # Should DNS UPDATE be enabled?
ignore-minimum = no # Ignore minimum TTL for zone?
soa-table = soa # Name of table containing SOA records
rr-table = rr # Name of table containing RR data
use-soa-active = no # Use the soa active attribute if provided
use-rr-active = no # Use the rr active attribute if provided
notify-enabled = no # Enable notify from updates
notify-source = 0.0.0.0 # Source address for ipv4 notify messages
notify-source6 = 0.0.0.0 # Source address for ipv6 notify messages
notify-timeout = 60 # Number of seconds before first retry
notify-retries = 5 # Number of retries before abandoning notify
notify-algorithm = linear # Notify retry algorithm one of: linear, exponential, progressive
ixfr-enabled = no # Enable IXFR functionality
ixfr-gc-enabled = no # Enable IXFR GC functionality
ixfr-gc-interval = 86400 # How often to run GC for IXFR
ixfr-gc-delay = 600 # Delay until first IXFR GC runs
extended-data-support = no # Support extended data fields for large TXT records
dbengine = MyISAM # Support different database engines
wildcard-recursion = 0 # Wildcard ancestor search levels
soa-where = # Extra WHERE clause for SOA queries
rr-where = inter=1 # Extra WHERE clause for RR queries
/etc/init.d/mydns start