BIND+DLZ+MYSQL

BIND-DLZ实验环境:RHEL4

所用到的软件包:BIND-9.5.0-P2.tar.gz(9.4.2以上版本都已经包含了DLZ补丁)、Mysql-5.0.56.tar.gz

写在前面:DLZ(Dynamically Loadable Zones),它允许你的区域记录放置到数据库中,并且支持多种数据库。你可以在

BIND-DLZ

上找到相应的资料。

1、先安装mysql

shell>tar zxvf mysql-version.tar.gz

shell>cd mysql-*

shell>./configure --prefix=/usr/local/mysql /

>--localstatedir=/usr/local/mysql/data /

>--libexecdir=/usr/local/mysql/lib /

>--disable-shared

shell>make && make install

安装完成后。

进入安装mysql的目录

>cd /usr/local/mysql

>chown -R mysql .

>chgrp -R mysql .

>chown -R mysql data

>chown -R mysql lib

>groupadd -g 1003 mysql

>adduser -g 1003 mysql

>./bin/mysql_install_db --user=mysql //以mysql用户的身份安装

>chown -R root .

>./bin/mysqld_safe --user=mysql &  //启动mysql并转入后台自行处理

>/usr/local/mysql/bin/mysqladmin -u root -p password '*******'

password:(由于初始密码为空,此处直接敲回车)

>/usr/local/mysql/bin/mysql -u root -p

password:(输入你的密码)

mysql>

2、安装bind

shell>tar zxvf bind-9.5.0-p2.tar.gz

shell>cd bind-9.5.0-p2

shell>./configure --prefix=/usr/local/bind9 --with-dlz-mysql=/usr/local/mysql --enabl-threads=no --disable-openssl-version-check

--with-dlz-mysql=/usr/local/mysql  要求bind安装中支持DLZ

--enabl-threads=no  关闭多线程

--disable-openssl-version-check   这项是禁止openssl版本的检查

shell>make

shell>make install

3、创建数据库、表

mysql>create database mydata;

mysql>use mydata;

mysql>create table other_dns_records (

>zone varchar (255),

>host varchar (255),

>type varchar (255),

>data varchar (255),

>ttl int(11),

>mx_priority varchar (255),

>refresh int(11),

>retry int(11),

>expire int(11),

>minimum int(11),

>serial bigint(20),

>resp_person varchar (255),

>primary_ns varchar (255)

>);

mysql>create table cnc_dns_records (

>zone varchar (255),

>host varchar (255),

>type varchar (255),

>data varchar (255),

>ttl int(11),

>mx_priority varchar (255),

>refresh int(11),

>retry int(11),

>expire int(11),

>minimum int(11),

>serial bigint(20),

>resp_person varchar (255),

>primary_ns varchar (255)

>);

>//向表中添加一条记录

>insert into other_dns_records (zone,host,type,data,ttl,retry) values ('aaa.com','www','A','192.168.199.2','86400','15');

>insert into cnc_dns_records (zone,host,type,data,ttl,retry) values ('bbb.com','www','A','192.199.22.22','86400','13');

4、编辑/usr/local/bind9/etc/named.conf

>cd /usr/local/bind9/etc

>../sbin/rndc-config -a

>../sbin/rndc-config > named.conf

>vi !$

//删除# Use with the following in named.conf, adjusting the allow list as needed: 以前的行

将# Use with the following in named.conf, adjusting the allow list as needed: 和 # End of named.conf 之间的行前#号

最终的etc/named.conf文件如下:

# Use with the following in named.conf, adjusting the allow list as needed:

key "rndc-key" {

algorithm hmac-md5;

secret "2rkqGUle0VlsawCL2+IKsA==";

};

controls {

inet 127.0.0.1 port 953

allow { 127.0.0.1; } keys { "rndc-key"; };

};

# End of named.conf

options {

directory "/usr/local/binid/etc/";

pid-file "/usr/local/binid/var/run/named.pid";

allow-query { any; };

recursion no;

version "gaint-d1";

};

include "/usr/local/binid/etc/cnc.cl";

include "/usr/local/binid/etc/other.cl";

view "cnc-user" {

match-clients { cnc; };

dlz "Mysql zone" {

database "mysql

{host=localhost dbname=mydb ssl=false port=3306 user=root pass=abc123!}

{select zone from cnc_dns_records where zone='%zone%'}

{select ttl, type, mx_priority, case when lower(type)='txt' then concat('/"', data, '/"')

when lower(type)='soa' then concat_ws(' ',data,resp_person,serial,refresh,retry,expire,minimum) else data end as mydata from cnc_dns_records where zone='%zone%' and host='%record%'}";

};

};

view "other-user" {

match-clients { other; };

dlz "Mysql zone" {

database "mysql

{host=localhost dbname=mydb ssl=false port=3306 user=root pass=abc123!}

{select zone from other_dns_records where zone='%zone%'}

{select ttl, type, mx_priority, case when lower(type)='txt' then concat('/"', data, '/"')

when lower(type)='soa' then concat_ws(' ',data,resp_person,serial,refresh,retry,expire,minimum) else data end as mydata from other_dns_records where zone='%zone%' and host='%record%'}";

};

};

etc/cnc.cl如下:

acl "cnc" {

192.168.9.0/24;

};

etc/other.cl如下:

acl "other" {

127.0.0.0/18;

};

5、测试

打开named测试/usr/local/bind9/sbin/named -g -d 1 -c /usr/local/bind9/etc/named.conf

注:如果不想写全路径来启动bind和mysql的话,可以编辑:

>vi /root/.bash_profile

加入如下两行:

PATH=$PATH:/usr/local/bind9/sbin

PATH=$PATH:/usr/local/mysql/bin/

保存退出

> . /root/.bash_profile (或者:. !$)

这次的实验只是做了一部分,可能也会用到区域传送。这些查询可以参照

BIND-DLZ

【zonshy】

未完待续......

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/66138/showart_1296195.html

with dlz mysql 条件_BIND+DLZ+MYSQL相关推荐

  1. with dlz mysql 条件_BIND+DLZ+MYSQL实现区域记录动态更新

    BIND+DLZ+MYSQL实现区域记录动态更新 [zonshy] BIND-DLZ实验环境:RHEL4 所用到的软件包:BIND-9.5.0-P2.tar.gz(9.4.0以上版本都已经包含了DLZ ...

  2. with dlz mysql 条件_Flask Bind-DLZ + Mysql DNS管理平台

    系统环境:CentOS 6.5 X64 软件版本: 绑定-9.9.5.tar.gz mysql-5.6.16.tar.gz 描述: 数据库安装就不在这里具体说了,了解运维的同学都应该知道,不知道的大家 ...

  3. with dlz mysql 条件_Bind-DLZ with MySQL

    系统环境: 系统:centos 6.8 Mysql: 5.1 BIND: bind-9.11.0-P2.tar.gz 软件下载地址:ftp://ftp.isc.org/ 一.安装并配置MySQL. 1 ...

  4. bind9 dlz mysql_利用BIND+DLZ+MYSQL构建企业智能DNS

    目录: 一.简介 二.服务规划 三.安装BIND及基本环境 四.配置Bind-View-DLZ-MYSQL 五.添加相关记录并进行测试 六.配置从DNS 七.本文以FreeBSD 10.2 stabl ...

  5. mysql有选择地输出数据_有条件地选择MYSQL列

    我的问题的示例模式在 SQLFiddle给出,如下所示: CREATE TABLE `players` ( `player1id` int(11) NOT NULL, `player2id` int( ...

  6. MySQL 条件查询 limit、in、between and、like等等

    MySQL 条件查询 环境: CREATE TABLE `test_user` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户id',`userna ...

  7. MySQL学习-MySQL条件查询

    MySQL条件查询 操作的表 1.条件查询概述 2.条件查询between and] 3.条件查询is null和is not null 4.and和or的优先级的问题 5.条件查询in 6.模糊查询 ...

  8. Mysql 条件查询(like、between、and、in······)

    目录 Mysql 条件查询 示例 一.比较运算和逻辑运算符符 二.范围运算符 三.列表运算符 四.模糊匹配符 五.空值判断符 Mysql 条件查询 Mysql 条件查询即where子句后跟条件 运算符 ...

  9. mysql条件变量单引号_mysql语法

    mysql 语句 1.rpm -qa | grep mysql //检查是否有mysql的安装包 2.rpm -e mysql // 普通删除模式 3.rpm -e --nodeps mysql // ...

最新文章

  1. 【sgTopo】强哥古法炮制、纯手工打造简单拓扑图、流程图、思维导图组件(完善中ing)
  2. ​综述 | SLAM回环检测方法
  3. pycharm 自动函数注释
  4. WPF快速指导1:资源
  5. vsftpd配置文件详细介绍
  6. 基于J2EE+JBPM3.x/JBPM4.3+Flex流程设计器+Jquery+授权认证)企业普及版贝斯OA与工作流系统...
  7. 计算机系统结构教程卷子,计算机系统结构试卷试题.docx
  8. 2020前端面试(一面面试题)
  9. 【运动女神】99年、健身达人、北方女孩、直爽善谈、乐天派、旅行爱好者
  10. Docker框架的使用系列教程(一)
  11. Reporting Services Internal Error(诡异的问题)-【转载】
  12. 用python画漂亮图-大部分人都不知道-Python竟能画这么漂亮的花,帅呆了
  13. (6)机器学习_支持向量机
  14. 中间弹框_Flutter AlertDialog弹框的基本使用概述
  15. python 文件转base64
  16. 测绘工作日常总结(不定稿)
  17. C语言int类型数值溢出会怎么样
  18. 解决MacBook浏览器打开北京工作居住证系统问题
  19. 可盈可乐研究院 | 2019:区块链+跨境支付”新旧”势力的新一轮角力
  20. javascript预加载图片、css、js的方法研究

热门文章

  1. 2018-2019 ACM-ICPC, China Multi-Provincial Collegiate Programming Contest
  2. 全网顶尖,毫不夸张的说这份斯坦福大学机器学习教程中文笔记,能让你机器学习从入门到精通
  3. 协众技术教你玩转电商海报设计
  4. linux安装mysql步骤用yum_linux 使用yum安装mysql详细步骤
  5. 微信关注二维码不显示
  6. UNIX发展史(BSD,GNU,linux)(转)
  7. 排序算法——希尔排序的图解、代码实现以及时间复杂度分析
  8. ipa上架App Store流程
  9. 分享一个宝藏级 Java 插件
  10. 应用容器化之Kubernetes实践