标签:none 搭建 访问 第一步 ret nes try 没有 sla
第一步:安装Name: www.hello.com
Address: 192.168.80.10
[root@localhost ~]# nslookup 192.168.80.10
成功显示:
Server: 192.168.80.10
Address: 192.168.80.10#53
10.80.168.192.in-addr.arpa name = www.hello.com.
搭建主、从域名服务器
第一步:搭建主从同步服务器(主服务器上配置)
[root@localhost ~]# vi /etc/named.rfc1912.zones
zone "hello.com" IN {
type master;
file "hello.com.zone";
allow-update { 192.168.80.20; }; //配置为从服务器IP地址
also-notify { 192.168.80.20; };
};
保存退出
第二步:配置从服务器(从服务器上配置)
--------1.搭建DNS服务器--------(参照上面配置)
//编辑主配置文件
[root@localhost ~]# vi /etc/named.conf
options {
listen-on port 53 { 192.168.80.20; }; //改成监听的服务器的IP(主服务器地址)
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; }; //任何人都可以访问
保存退出
--------2.搭建主从同步服务器(从服务器上配置)----------
[root@localhost ~]# vi /etc/named.rfc1912.zones
//正向区域配置
zone "hello.com" IN {
type slave;
masters { 192.168.80.10; };
file "slaves/hello.com.zone";
allow-notify { 192.168.80.10; };
};
//反向区域配置
zone "80.168.192.in-addr.arpa" IN {
type slave;
masters { 192.168.80.10; };
file "slaves/hello.com.local";
allow-notify { 192.168.80.10; };
};
保存退出
第三步:启动服务
[root@localhost named]# systemctl start named
[root@localhost named]# netstat -anpu | grep name //查看服务运行状态,UDP 53端口在监听
成功显示:
netstat -anpu | grep name
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 192.168.80.20:53 0.0.0.0: 1102/named
udp6 0 0 ::1:53 ::: 1102/named
[root@localhost ~]# cd /var/named/slaves/
[root@localhost slaves]# ls
成功显示:
hello.com.local hello.com.zone
[root@localhost slaves]# yum install bind-utils
[root@localhost ~]# nslookup www.hello.com
成功显示:
Server: ::1
Address: ::1#53
Name: www.hello.com
Address: 192.168.80.10
第四步:测试验证
-----主服务器修改配置-----
[root@localhost ~]# vi /var/named/hello.com.zone
$TTL 1D
@ IN SOA @ rname.invalid. (
1 ; serial //修改序列号,往上修改
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 192.168.80.10
www IN A 192.168.80.10
ftp IN A 192.168.80.20 //修改ftp地址,用来验证
mail IN CNAME www
Name: ftp.hello.com
Address: 192.168.80.20
--------从服务器验证---------
[root@localhost ~]# nslookup ftp.hello.com
成功显示:
Server: ::1
Address: ::1#53
Name: ftp.hello.com
Address: 192.168.80.20
//测试成功
标签:none 搭建 访问 第一步 ret nes try 没有 sla
原文地址:https://blog.51cto.com/14519331/2438639