mydns安装配置

回复 收藏
远程下载
http://mydns.bboy.net/download/mydns-1.1.0.tar.gz

本地下载


rpm包下载
http://www.lishiming.net/data/a ... ql-1.1.0-1.i386.rpm

1.  因为mydns依赖mysql,所以需要先安装mysql。
yum install -y mysql-server

2.  安装mydns
wget  http://www.lishiming.net/data//a ... ql-1.1.0-1.i386.rpm
rpm -ivh mydns-mysql-1.1.0-1.i386.rpm

3. 创建库和表
mysql -uroot  -e "create database mydns"
mysql -uroot mydns
mysql> 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.  创建第一个zone
mysql> use mydns
mysql> 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. 配置文件参考4楼回复帖。

6. /etc/init.d/mydns start
2010-02-23 16:10 举报
已邀请:
0

阿铭 管理员

赞同来自:

mysql> show create table soa\G;


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;
0

阿铭 管理员

赞同来自:

mysql> show create table rr\G;
*************************** 1. row ***************************
       Table: rr
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;
0

阿铭 管理员

赞同来自:

mysql> select * from soa where id=3;
+----+--------------+--------------+---------------------+--------+---------+-------+--------+---------+-------+------+
| id | origin       | ns           | mbox                | serial | refresh | retry | expire | minimum | ttl   | xfer |
+----+--------------+--------------+---------------------+--------+---------+-------+--------+---------+-------+------+
|  3 | example.com. | ns.example.com. | julyclyde.gmail.com |      1 |   28800 |  7200 | 604800 |   86400 | 86400 | NULL |
0

阿铭 管理员

赞同来自:

mysql> select * from rr where id=1;
+----+------+------+------+----------------+-----+-----+-------+-------+
| id | zone | name | type | data           | aux | ttl | inter | intra |
+----+------+------+------+----------------+-----+-----+-------+-------+
|  1 |    1 | www  | A    | 1.1.1.1 |   0 |   1 |     1 |     1 |
0

雷老师 管理员

赞同来自:

很好,很强大
0

阿铭 管理员

赞同来自:

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
0

hanwen

赞同来自:

很好用
0

hanwen

赞同来自:

铭哥,你的第四步这一行insert into rr values(1, 1, 'www', 'A', '1.1.1.1', 0, 1, 1, 1, 1);错了,多插入了一个数值。
0

biankm_gz

赞同来自:

顶一个
0

Shawn

赞同来自:

好厉害
0

wangzai

赞同来自:

学习
0

学习求生存 - openstack运维工程师

赞同来自:

来学习一下,支持铭哥

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: