Centos 5.2安装配置DNS服务器
BIND安装配置(主从)
我的系统环境:centos 5.2
作者:哈密瓜
主:
我采用的是yum安装
[root@linux src]#yum -y install bind*
生成rndc控制命令的key文件
[root@linux usr]# sbin/rndc-confgen > /etc/rndc.conf
从rndc.conf文件中提取named.conf用的key
[root@linux usr]# cd /etc
[root@linux etc]# tail -10 rndc.conf | head -9 | sed s/#\ //g >
/var/named/chroot/etc/named.conf
自动在/var/named/chroot/etc下生成named.conf文件
进入/var/named/chroot/etc
[root@linux etc]# cd /var/named/chroot/etc
现在named.conf文件中有了rndc-key区段
[root@linux etc]# more named.conf
key "rndc-key" {
algorithm hmac-md5;
secret "Nd0nLoL8t4Mv0iSpqP1noA==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
然后我们来完善它:
[root@linux etc]#vi named.conf
options {
directory "/var/named";
};
zone "." IN {
type hint;
file "named.ca";
};
zone "localhost" IN {
type master;
file "localhost.zone";
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
};
zone "learningsky.org" IN {
type master;
file "learningsky.zone";
allow-transfer { 192.168.22.155 ; }; //192.168.22.155为本机网关
notify yes;
also-notify { 192.168.22.155 ; }; //使用notify指令会自动通知所有这个域的所有在
ns记录上的机器,also-notify指令可以用来通知所有不在ns记录上的dns服务器.
};
zone "22.168.192.in-addr.arpa" IN {
type master;
file "22.168.192";
allow-transfer { 192.168.22.155 ; };
notify yes;
also-notify { 192.168.22.155 ; };
};
key "rndc-key" {
algorithm hmac-md5;
secret "Nd0nLoL8t4Mv0iSpqP1noA==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
进入/var/named/chroot/var/named
[root@linux etc]# cd /var/named/chroot/var/named
建立localhost.zone文件
[root@linux named]#vi localhost.zone
$TTL 86400
$ORIGIN localhost.
@ 1D IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
1D IN NS @
1D IN A 127.0.0.1
建立named.local文件
[root@linux named]#vi named.local
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.
dig命令直接生成named.ca文件
[root@linux named]#dig > named.ca
建立learningsky.org域名正向解析文件
[root@linux named]#vi learningsky.zone
$TTL 86400
$ORIGIN learningsky.org.
@ 1D IN SOA dns.learningsky.org. root.mail.learningsky.org.
(
1053891162
3H
15M
1W
1D )
1D IN NS dns.learningsky.org.
1D IN MX 5 mail.learningsky.com.
dns IN A 192.168.22.150 //192.168.22.150为本机IP
mail IN A 192.168.22.150
www IN A 192.168.22.150
建立learningsky.org域名反向解析文件
[root@linux named]#vi 22.168.192
$TTL 86400
@ IN SOA dns.learningsky.org. root.mail.learningsky.org.(
20031001;
7200;
3600;
43200;
86400);
@ IN NS dns.learningsky.org.
150 IN PTR dns.learningsky.org.
150 IN PTR mail.learningsky.org.
150 IN PTR www.learningsky.org.
[root@linux named]#netstat -an |grep :53
tcp 0 0 192.168.22.150:53 0.0.0.0:*
LISTEN
tcp 0 0 127.0.0.1:53 0.0.0.0:*
LISTEN
udp 0 0 192.168.22.150:53 0.0.0.0:*
udp 0 0 127.0.0.1:53 0.0.0.0:*
修给reslov.conf
[root@linux named]#vi /etc/reslov.conf
nameserver 192.168.22.150
search learningsky.org
[root@linux etc]# ps -aux|grep named
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
named 13310 0.0 0.5 38160 2900 ? Ssl 14:53 0:00
/usr/sbin/named -u
named -t /var/named/chroot
root 13375 0.0 0.1 5212 688 pts/1 R+ 16:08
0:00 grep named
[root@linux etc]#more nsswitch.conf
# To use db, put the "db" in front of "files" for entries you want to be
# looked up first in the databases
#
# Example:
#passwd: db files nisplus nis
#shadow: db files nisplus nis
#group: db files nisplus nis
passwd: files
shadow: files
group: files
#hosts: db files nisplus nis dns
hosts: files dns
# Example - obey only what nisplus tells us...
#services: nisplus [NOTFOUND=return] files
#networks: nisplus [NOTFOUND=return] files
#protocols: nisplus [NOTFOUND=return] files
#rpc: nisplus [NOTFOUND=return] files
#ethers: nisplus [NOTFOUND=return] files
#netmasks: nisplus [NOTFOUND=return] files
bootparams: nisplus [NOTFOUND=return] files
ethers: files
netmasks: files
networks: files
[root@linux etc]# more host.conf
order hosts,bind
启动named
/[root@linux etc]# usr/local/sbin/named
测试DNS
[root@linux etc]# nslookup
>www.learningsky.org
Server: 192.168.22.150
Address: 192.168.22.150#53
Name: www.learningsky.org
Address: 192.168.0.244
>192.168.22.250
Server: 192.168.22.250
Address: 192.168.22.250#53
150.22.168.192.in-addr.arpa name = dns.learningsky.org.
150.22.168.192.in-addr.arpa name = www.learningsky.org.
150.22.168.192.in-addr.arpa name = mail.learningsky.org.
>set type=MX
>learningsky.org
Server: 192.168.22.150
Address: 192.168.22.150#53
learningsky.org mail exchanger = 5 mail.learningsky.com.
>exit
主DNS配置完成。
从:
安装跟主的一样,不同的就是named.conf
named.conf内容:
options {
directory "/var/named";
};
zone "." IN {
type hint;
file "named.root";
};
zone "localhost" IN {
type master;
file "localhost.zone";
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
};
zone "learningsky.org" IN {
type slave;
file "learningsky.zone";
masters { 192.168.22.150; };
};
zone "22.168.192.in-addr.arpa" IN {
type slave;
file "22.168.192";
masters { 192.168.22.150; };
};
key "rndc-key" {
algorithm hmac-md5;
secret "80hKqo5bkGMAqHqeAlaLCA==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
注:
1、主从同步的两台机器要在同一个时区,时间相差不要太大。
2、主的dns服务器在修改了正向解析文件跟反向分解析文件时,要修改相应的 serial(通常
是加数值,这个值必须主的要大于从的,要不同步不了)
3、/var/named/chroot这个文件的宿主要是named,不是那权限other也要是7
4、红色字体一定要注意,同步关键……
Centos 5.2安装配置DNS服务器的更多相关文章
- CentOS 6.6安装配置LAMP服务器(Apache+PHP5+MySQL)
准备篇: CentOS 6.6系统安装配置图解教程 http://www.osyunwei.com/archives/8398.html 1.配置防火墙,开启80端口.3306端口 vi /etc/s ...
- CentOS 6.5安装配置LNMP服务器(Nginx+PHP+MySQL)
CentOS 6.5安装配置LNMP服务器(Nginx+PHP+MySQL) 一.准备篇: /etc/init.d/iptables stop #关闭防火墙 关闭SELINUX vi /etc/sel ...
- CentOS 6.4安装配置LAMP服务器(Apache+PHP5+MySQL)
这篇文章主要介绍了CentOS 6.4安装配置LAMP服务器(Apache+PHP5+MySQL)的方法,需要的朋友可以参考下 文章写的不错,很详细:IDO转载自网络: 准备篇: 1.配置防火墙,开启 ...
- CentOS 7.0安装配置LAMP服务器(Apache+PHP+MariaDB)
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.service #停止fir ...
- CentOS 6.3安装配置LAMP服务器(Apache+PHP5+MySQL)
准备篇: 1.配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp -- ...
- CentOS 7.0安装配置Vsftp服务器步骤详解
安装Vsftp讲过最多的就是在centos6.x版本中了,这里小编看到有朋友写了一篇非常不错的CentOS 7.0安装配置Vsftp服务器教程,下面整理分享给各位. 一.配置防火墙,开启FTP服务器需 ...
- CentOS 7.0 安装配置LAMP服务器方法(Apache+PHP+MariaDB)(转)
转自:http://www.jb51.net/os/188488.html 作者:佚名 字体:[增加 减小] 来源:osyunwei 准备篇: CentOS 7.0系统安装配置图解教程 http:/ ...
- CentOS 6.5安装配置LAMP服务器(Apache+PHP5+MySQL)的方法
CentOS 6.5安装配置LAMP服务器(Apache+PHP5+MySQL)的方法 准备篇: 1.配置防火墙,开启80端口.3306端口vi /etc/sysconfig/iptables-A I ...
- CentOS 6.4安装配置LAMP服务器
CentOS 6.4安装配置LAMP服务器(Apache+PHP5+MySQL) 作者: 字体:[增加 减小] 类型:转载 这篇文章主要介绍了CentOS 6.4安装配置LAMP服务器(Apache+ ...
随机推荐
- 机器学习(4)之Logistic回归
机器学习(4)之Logistic回归 1. 算法推导 与之前学过的梯度下降等不同,Logistic回归是一类分类问题,而前者是回归问题.回归问题中,尝试预测的变量y是连续的变量,而在分类问题中,y是一 ...
- 在CentOS6上使用YUM安装php5.5.x
这里使用 Webtatic EL6的YUM源来安装php5.5,我们首页安装Webtatic EL6 YUM源 rpm -Uvh http://repo.webtatic.com/yum/el6/la ...
- 创建组合索引SQL从1个多小时到1S的案例
select aa.acct_org, aa.loan_acct_no, aa.FUNCTIONARY, aa.cust_no, sum(dwm.pkg_tools.currcdtran(bb.INT ...
- POJ3436 ACM Computer Factory(最大流)
题目链接. 分析: 题意很难懂. 大体是这样的:给每个点的具体情况,1.容量 2.进入状态 3.出去状态.求最大流. 因为有很多点,所以如果一个点的出去状态满足另一个点的进入状态,则这两个点可以连一条 ...
- LeetCode——Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number. The ...
- iOS进阶读物
不知不觉作为 iOS 开发也有两年多的时间了,记得当初看到 OC 的语法时,愣是被吓了回去,隔了好久才重新耐下心去啃一啃.啃了一阵,觉得大概有了点概念,看到 Cocoa 那么多的 Class,又懵了, ...
- RHEL6配置IP
修改配置文件:/etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0BOOTPROTO=noneBROADCAST=192.168.10.255HW ...
- 【转】在Eclipse环境下配置Servlet开发环境
配置这个真心坑···浪费我一下午时间,而且去网上找了一圈资料发现都不靠谱呀= = 于是自己写一个,防止忘记了 一.配置前准备 你需要下载三个东西 Eclipse J2EE:http://www.ecl ...
- maven项目中找不到Maven Dependencies解决办法
用eclipse创建maven项目后,在Deployment Assembly中通过Add...->Java Build Path Entries导入Maven Dependencies时,发现 ...
- RESTFul中的那些事(1)---在RESTFul中,HTTP Put和Patch操作的差别?
笔者在用调用Google Calendar和Google Tasks的RESTFul API的时候.遇到了一个特殊的操作,PATCH. 那么PATCH操作和PUT操作的差别是什么呢? 依据PATCH ...