Linux As 4下安装配置DNS服务器(9.4.1版)
创建子域授权:
再主服务器里我们加入一下内容:
@ 1D IN SOA xzxj11.com. root.xzxj11.com. (
2004081201 ;serial
1H ;refresh
15M ;retry
1W ;expire
1D ) ;TTL
NS xzxj11.com.
MX 10 mail.xzxj11.com.
A 192.168.1.129
ns IN A 192.168.1.129
www IN A 192.168.1.129
mail IN A 192.168.1.111
ftp IN A 192.168.1.112
news IN CNAME www
test IN NS ns.test
ns.test IN A 192.168.1.121
保存退出。
接着登录到192.168.1.121上面创建:
#vi /etc/named.conf
options {
directory "/var/named";
pid-file "/var/run/named/named.pid";
};
zone "." {
type hint;
file "named.ca";
};
zone "localhost" {
type master;
file "named.local";
};
zone "test.xzxj11.com" {
type master;
file "test.xzxj11.com.zone";
};
zone "0.0.127.in-addr.arpa" {
type master;
file "127.0.0.zone";
};
# Use with the following in named.conf, adjusting the allow list as needed:
key "rndc-key" {
algorithm hmac-md5;
secret "h0A4n6gBw60NPfmJCpB8wQ==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
# End of named.conf
#vi /var/named/test.xzxj11.com.zone
$TTL 1D
@ IN SOA @ root (
2004081201 ;serial
1H ;refresh
15M ;retry
1W ;expire
1D ) ;TTL
IN NS ns
ns IN A 192.168.1.121
www IN A 192.168.1.129
测试:
#host ns.test.xzxj11.com
ns.test.xzxj11.com has address 192.168.1.121
# host www.test.xzxj11.com
www.test.xzxj11.com has address 192.168.1.129
退出子域服务器,进入主服务器,测试成功;
建立辅助域服务器
在辅助服务器上建立;
# vi /etc/named.conf加入:
zone "xzxj11.com" IN {
type slave;
file "xzxj11.com.zone";
masters { 192.168.1.129; };
};
然后rndc reload,在查看一下/var/named/目录里多了个xzxj11.com.zone文件,辅助域名服务器建立成功。
以普通用户身份执行named:
在/etc/named.conf里的options选项里介入:
Options {
……………………………….
Pid-file “/var/run/named/named.pid”
};
#useradd –s /bin/false –d /dev/null named
#mkdir /var/run/named
#chown named.named /var/run/named
以named 用户来启动dns服务器:
#named –u named
让dns在开机的时候启动:
#echo “/usr/local/sbin/named –u named” >>/etc/rc.local