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. ...
随机推荐
- Javascript单元测试框架比较Qunit VS Jasmine
Javascript单元测试框架比较Qunit VS Jasmine 工欲行其事必先利其器,好的单元测试框架是TDD成功的一半.Javascript优秀的测试框架很多, 包括Jasmine,Qunit ...
- ASP.NET MVC C#知识点提要
ASP.NET MVC C#知识点提要 本篇博文主要对asp.net mvc开发需要撑握的C#语言知识点进行简单回顾,尤其是C# 3.0才有的一些C#语言特性.对于正在学asp.net mvc的童鞋, ...
- How to use USB 3G dongle/stick Huawei E169/E620/E800 ( Chip used Qualcomm e1750) in Linux (China and world)
Using this 3G module in Linux is so great. I want it. So I made it. The 3G dongle of Huawei E169/E62 ...
- flask tutorial => make a blog :) flask 搭建博客系统从零开始!
please follow the tutorial from the official site :) http://flask.pocoo.org/docs/ You could download ...
- Nginx学习之十四-GDB调试Nginx初试
本文的测试环境: Win7+虚拟机VMWareVMware-workstation-full-7.1.4-385536+Ubuntu12.04 Nginx-1.4.0 要想有效的研究Nginx源码,必 ...
- 写一个Redis封装类
打算自己封装一个Redis操作类,方便使用,且有一定log记录.Redis的封装思路:基于Redis类进一步封装 一般属性 单例 (配置参数从配置文件中读取还是写死?考虑多配置之间切换) 常规操作根据 ...
- mysql之多列索引
mysql的多列索引是经常会遇到的问题,怎样才能有效命中索引,是本文要探讨的重点. 多列索引使用的Btree,也就是平衡二叉树.简单来说就是排好序的快速索引方式.它的原则就是要遵循左前缀索引. 多个索 ...
- MVC实现省级联动
前言 省级联动的效果,网上现成的都有很多,各种JS实现,Jquery实现等等,今天我们要讲的是在MVC里面,如何更方便.更轻量的实现省级联动呢? 实现效果如下: 具体实现 如图所示,在HTML页非常简 ...
- eclipse 中导入 maven项目 启动报错
导入Maven项目到Eclipse中时,出现问题如下: java.lang.ClassNotFoundException: org.springframework.web.context.Contex ...
- 开发团队在TFS中使用Git Repository (一)
在研发团队中,代码版本管理是最为基础的必要工具.个人使用过的版本管理工具有SVN.VSS.ClearCase.TFS.Git,从团队的角度和使用角度来说,个人倾向于与使用TFS作为团队的基础工具.首先 ...