时间:2023-02-20 08:14:01 | 来源:建站知识
时间:2023-02-20 08:14:01 来源:建站知识
Linux环境下DNS域名解析服务:DNS系统的作用[root@localhost Packages]# mkdir /media/cdrom[root@localhost Packages]# mount /dev/cdrom /media/cdrom/mount: block device /dev/sr0 is write-protected, mounting read-only[root@localhost Packages]# cd /media/cdrom/Packages/[root@localhost Packages]# ls | grep "^bind"bind-9.8.2-0.17.rc1.el6_4.6.x86_64.rpmbind-chroot-9.8.2-0.17.rc1.el6_4.6.x86_64.rpmbind-dyndb-ldap-2.3-5.el6.x86_64.rpmbind-libs-9.8.2-0.17.rc1.el6_4.6.i686.rpmbind-libs-9.8.2-0.17.rc1.el6_4.6.x86_64.rpmbind-utils-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm[root@localhost Packages]# [root@localhost Packages]# rpm -qa | grep "^bind"bind-libs-9.8.2-0.17.rc1.el6_4.6.x86_64bind-utils-9.8.2-0.17.rc1.el6_4.6.x86_64[root@localhost Packages]# rpm -ivh bind-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm warning: bind-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEYPreparing... ########################################### [100%] 1:bind ########################################### [100%][root@localhost Packages]# rpm -ivh bind-chroot-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm warning: bind-chroot-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEYPreparing... ########################################### [100%] 1:bind-chroot ########################################### [100%][root@localhost Packages]#
[root@localhost etc]# vim /etc/named.conf options {directory "/var/named"; #定义区域数据文件的默认存储位置 };zone "jt.com" IN { #正向区域 type master; #类型为master(主服务器) file "jt.com.zone"; #区域数据文件名为jt.com allow-update { none; };};zone "3.168.192.in-addr.arpa" IN { #反向区域 type master; #类型为master(主服务器) file "192.168.3.arpa"; #区域数据文件名为192.168.3.arpa};
[root@localhost named]# vim jt.com.zone$TTL 86400 //TTL配置用于设置默认生存周期。即缓存解析结果的有效时间。@ SOA jt.com. admin.jt.com. ( //SOA记录部分用于设置区域名称,管理邮箱,以及为从域名服务器指定更新参数。 20181202 //更新序列号 4H //刷新时间:重新下载数据的间隔 30M //重试延时:下载失败后的重试间隔 12H //失效时间:超过该时间仍无法下载则放弃 1D //无效解析记录的生存周期)@ IN NS jt.www IN A 192.168.3.111 #这里要写DNS服务器的IP地址,也可以是主机名。hhh IN A 192.168.3.112[root@localhost named]# vim 192.168.3.arpa$TTL 86400@ SOA jt.com. admin.jt.com. ( 20181202 //更新序列号 4H //刷新时间:重新下载数据的间隔 30M //重试延时:下载失败后的重试间隔 12H //失效时间:超过该时间仍无法下载则放弃 1D //无效解析记录的生存周期) IN NS jt.111 IN PTR www.jt.com.112 IN PTR hhh.jt.com.
[root@localhost named]# vim /etc/resolv.conf # Generated by NetworkManagerdomain localdomainsearch localdomainnameserver 192.168.3.111[root@localhost named]# named-checkconf -z /etc/named.conf zone jt.com/IN: loaded serial 20181202zone 3.168.192.in-addr.arpa/IN: loaded serial 20181202[root@localhost named]# service named startGenerating /etc/rndc.key: [确定]启动 named: [确定][root@localhost named]# nslookup www.jt.comServer: 192.168.3.111Address: 192.168.3.111#53Name: www.jt.comAddress: 192.168.3.111[root@localhost named]# nslookup hhh.jt.comServer: 192.168.3.111Address: 192.168.3.111#53Name: hhh.jt.comAddress: 192.168.3.112[root@localhost named]# nslookup 192.168.3.111Server: 192.168.3.111Address: 192.168.3.111#53111.3.168.192.in-addr.arpa name = www.jt.com.[root@localhost named]# nslookup 192.168.3.112Server: 192.168.3.111Address: 192.168.3.111#53112.3.168.192.in-addr.arpa name = hhh.jt.com.[root@localhost named]#
[root@localhost named]# vim /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.3.111 jt192.168.3.110 python
[root@localhost named]# vim 192.168.3.arpa $TTL 86400@ SOA jt.com. admin.jt.com. ( 20181202 4H 30M 12H 1D) IN NS jt. IN NS python.1111 IN PTR www.jt.com.1112 IN PTR hhh.jt.com.[root@localhost named]# vim jt.com.zone $TTL 86400@ SOA jt.com. admin.jt.com. ( 20181202 4H 30M 12H 1D)@ IN NS jt.@ IN NS python.www IN A 192.168.11.111hhh IN A 192.168.11.112
[root@localhost named]# vim /etc/resolv.conf # Generated by NetworkManagerdomain localdomainsearch localdomainnameserver 192.168.3.111nameserver 192.168.3.110
[root@localhost named]# vim /etc/named.conf options {directory "/var/named"; };zone "jt.com" IN { type slave; masters { 192.168.3.111; }; file "slaves/jt.com.zone"; };zone "3.168.192.in-addr.arpa" IN { type slave; masters { 192.168.3.111; } file "slaves/192.168.3.arpa";};
[root@localhost slaves]# service named restart停止 named:. [确定]启动 named: [确定][root@localhost slaves]# ls192.168.3.arpa jt.com.zone
[root@localhost slaves]# nslookup www.jt.comServer: 192.168.3.111Address: 192.168.3.111#53Name: www.jt.comAddress: 192.168.3.111[root@localhost slaves]# service named stop停止 named:. [确定][root@localhost slaves]# nslookup www.jt.comServer: 192.168.3.110Address: 192.168.3.110#53Name: www.jt.comAddress: 192.168.3.111[root@localhost slaves]# service named start启动 named: [确定][root@localhost slaves]# nslookup www.jt.comServer: 192.168.3.111Address: 192.168.3.111#53Name: www.jt.comAddress: 192.168.3.111[root@localhost slaves]#
科技改变中国,学IT技术可以防身。关键词:服务,环境