linux安装bind with DLZ <NIOT>
2015年6月11日
1、sudo wget ftp://ftp.isc.org/isc/bind9/9.10.1/bind-9.10.1.tar.gz 或者 使用“rz”命令
2、tar -zxvf bind-9.10.1.tar.gz
3、创建目录
在/home/wkubuntu下创建named目录和namedfile目录
4、编译安装
cd bind-9.10.1
./configure --prefix=/home/wkubuntu/named/ --with-dlz-mysql=/usr/local/mysql
make
make install
此时进入/home/wkubuntu/named目录,里面自动生成了bin etc include lib sbin share var这些文件目录
5、配置bind
cd /home/wkubuntu/named/etc
touch named.conf ,或者从电脑上上传
vi named.conf张贴内容1
从电脑上上传5个文件到/home/wkubuntu/named/var 目录下
127.0.0.zone、localhost.reverse 、localhost.zone 、named.root 、root.hint
生成rndc的key
a)cd /home/wkubuntu/named/sbin/
b)vim random 输入很长一段字母。就是服务器上没有random产生器,这种情况下我们就手动伪造一个文件代替/dev/random的功能
c)./rndc-confgen -r random > /etc/rndc.key
d)cat /etc/rndc.key
e)拷贝
secret "pfNOQ0fENSBBGBYn/ndRsw=="; 这一行
覆盖/home/wkubuntu/named/etc 的named.conf对应的那一行
6、启动bind ,打印进程
输入sudo /home/wkubuntu/named/sbin/named -c /home/wkubuntu/named/etc/named.conf -n 1 &
出现done 就代表成功了,“-n 1”代表单线程启动,结合mysql驱动不会报错。
【如果出现了exit,出错了,看打印进程sudo /home/wkubuntu/named/sbin/named -gc /home/wkubuntu/named/etc/named.conf -n 1&
killall named 可以关闭掉所有named,如果用了-gc的话】
要建立一个log目录,如下的配置 mkdir logs
/home/wkubuntu/named/logs
其他:
内容1:
logging{
channel error_log {
file "/home/wkubuntu/named/logs/normal.log" versions 3 size 2m;
severity error;
print-time yes;
print-severity yes;
print-category yes;
};
category default{
error_log;
};
channel update_log{
file "/home/wkubuntu/named/logs/update.log" versions 3 size 1m;
severity info;
print-time yes;
print-severity yes;
print-category yes;
};
category update{
update_log;
};
channel notify_log{
file "/home/wkubuntu/named/logs/notify.log" versions 3 size 1m;
severity info;
print-time yes;
print-severity yes;
print-category yes;
};
category notify{
notify_log;
};
};
options {
directory "/home/wkubuntu/named/var/";
pid-file "/home/wkubuntu/named/var/run/named/named.pid";
dump-file "/home/wkubuntu/named/logs/named_dump.db";
statistics-file "/home/wkubuntu/named/logs/named.stats";
version "Welcome to NIOT platform!";
listen-on-v6 { any; };
allow-query { any; };
allow-query-cache { any; };
allow-recursion { localnets; localhost; };
notify no;
};
key "rndc-key" {
algorithm hmac-md5;
secret "fLDVvLVXFjMJpdiy+7nESw==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
zone "." IN {
type hint;
file "/home/wkubuntu/named/var/named.root";
};
zone "localhost" IN {
type master;
file "/home/wkubuntu/named/var/localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "/home/wkubuntu/named/var/localhost.reverse";
allow-update { none; };
};
dlz "Mysql zone" {
database "mysql
{host=127.0.0.1 dbname=db_dns ssl=false port=3306 user=root pass=root}
{select zone from supported_zone where zone = '$zone$' limit 1}
{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)
when lower(type) = 'naptr' then concat(' ', naptr_order, ' ', naptr_preference, ' \"', naptr_flags, '\"', ' \"', naptr_service, '\"', ' \"', naptr_regexp,'\" ', data, '.')
else data
end
from dns_records where zone = '$zone$' and host = '$record$'}";
};
2017配置文件变更部分
dlz "Mysql zone" {
database "mysql
{host=127.0.0.1 dbname=db_dns ssl=false port= user=pro_dns_manager pass=l+bbkqQX}
{select zone from dns_records where zone = '$zone$' limit }
{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)
when lower(type) = 'naptr' then concat(' ', naptr_order, ' ', naptr_preference, ' \"', naptr_flags, '\"', ' \"', naptr_service, '\"', ' \"', naptr_regexp,'\" ', data, '.')
else data
end
from dns_records where zone = '$zone$' and host = '$record$' and status = }";
};
7、测试
dig @localhost www.cniotroot.cn ys.cniotroot.cn
数据库里面要有这条记录,如上测试即可
8、北京服务器
sudo /home/niot/named/sbin/named -c /home/niot/named/etc/named.conf -n 1 &
9、rndc status 失败,端口被portreserve 占用
rndc: connect failed: 127.0.0.1#953: connection refused
#killall portreserve
linux安装bind with DLZ <NIOT>的更多相关文章
- Linux服务器---安装bind
安装bind 1.安装bind软件,需要安装3 个bind.bind-chroot.bind-util [root@localhost pub]# yum install -y bind bind-c ...
- Linux安装svn服务图文详解 ;出现No repository found in 'svn***问题
Linux安装svn服务 ** 示例都是用的root权限,可选择用 sudo** 1:检查 安装条件为:Linux(centos)上未安装过svn服务,若安装过或安装失败请自行删除,这里不多介绍.检查 ...
- ElasticSearch-6.3.2 linux 安装
在linux 系统安装ElasticSearch-6.3.2最新版本,也适合6.x 系列版本做参考 前提先在linux 安装好jdk1.8 创建用户 从5.0开始,ElasticSearch 安全级别 ...
- linux 安装【jdk、tomcat】查看对外开放端口(防火墙拦截处理)
1.安装 jdkhttps://www.cnblogs.com/xu-dong/p/6422938.html 查看Linux下查看JDK安装路径: https://www.cnblogs.com/im ...
- Linux 安装tomcat 及过程中遇到的问题
Linux 安装tomcat(tomcat能用的前提是系统已经安装jdk) 1.下载linux系统版tomcat,解压后通过ftp上传到Linux服务器 例:tomcat放在 /opt/tom ...
- linux安装配置redis
redis是支持linux的,所以linux安装redis非常简单,按照官网的提示操作即可. 下载 $ wget http://download.redis.io/releases/redis-3.2 ...
- Linux服务-bind
目录 1.安装bind 2.配置bind 3.添加正.反向解析域 3.1 指向生效的配置文件 3.2 生成配置文件cljhfy.com.zone和163.168.192.zone 4.验证 Linux ...
- 1.Linux安装redis
Linux安装redis 操作系统是Centos7 1.下载压缩包 2.解压 3.编译 4.启动redis 5.设置redis.conf和防火墙端口开放,外网可以访问 1.下载压缩包 下载地址:htt ...
- Linux安装redis服务器和部署
Linux安装redis和部署 第一步:下载安装包 wget http://download.redis.io/releases/redis-5.0.5.tar.gz 访问https://redis. ...
随机推荐
- resin-pro-4.0.34 服務器在windows环境下的配置
resin-pro-4.0.34 服務器在windows环境下的配置(轉載请注明作者:icelong) 到caucho網站上http://www.caucho.com/download/下載resin ...
- Tapestry5.3使用总结
1.Tapestry框架的加载是通过Filter来完成的,需要在web.xml中加入以下配置: <filter> <filter-name>app</filter-nam ...
- <我的外骨骼,诺基>后的访谈
<我的外骨骼,诺基>后的访谈 在接下采访任务之前,我对杨贵福的了解仅仅限于:有名的科幻作家,男性,成年.我虽然读过他的许多作品,但在这些作品中并不能找到作者的影子.我试着从作品的行文风格中 ...
- 第 1 章 Node.js 介绍
本章内容包括: 什么是 Node.js 框架,为什么要用 Node.js 框架,使用 Node.js 框架能够解决什么问题,在哪些场合下应该考虑使用 Node.js 框架. 如何下载 Node.js ...
- 【转载】深入Java单例模式
原文出处:http://devbean.blog.51cto.com/448512/203501 在GoF的23种设计模式中,单例模式是比较简单的一种.然而,有时候越是简单的东西越容易出现问题.下面就 ...
- 用C++实现的八皇后问题
我是一个C++初学者,控制台实现了一个八皇后问题. 代码如下: //"八皇后问题"V1.0 //李国良于2017年1月11日编写完成 #include <iostream&g ...
- 队列Queue FIFO先进先出 栈Stack FILO先进后出
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- 字典(Tire树)
4189 字典 时间限制: 1 s 空间限制: 256000 KB 题目等级 : 大师 Master 题目描述 Description 最经,skyzhong得到了一本好厉害的字典,这个 ...
- Santa Claus and Tangerines
Santa Claus and Tangerines 题目链接:http://codeforces.com/contest/752/problem/E 二分 显然直接求答案并不是很容易,于是我们将其转 ...
- mongodb tip-1
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 15.0px "Helvetica Neue"; color: #454545 } p. ...