1、域名解析服务器配置
1.设置dns服务器指向
root@debian:~# vim /etc/resolv.conf
nameserver 192.168.199.101
2.安装服务
root@debian:~# apt install bind9 bind9utils dnsutils -y
3.编辑区域文件
root@debian:~# vim /etc/bind/named.conf.default-zones
zone “skills.com” {
type master;
file “/etc/bind/db.z”;
};
zone “199.168.192.in-addr.arpa” {
type master;
file “/etc/bind/db.f”;
};
4.编辑区域解析文件
复制解析文件
root@debian:~# cp -p /etc/bind/db.local /etc/bind/db.z
root@debian:~# cp -p /etc/bind/db.0 /etc/bind/db.f
5.编辑正向解析文件
root@debian:~# vim /etc/bind/db.z
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA localhost. root.localhost. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS localhost.
node1 IN A 192.168.199.101
node2 IN A 192.168.199.102
node3 IN A 192.168.199.103
6.编辑反向解析文件
root@debian:~# vim /etc/bind/db.f
;
; BIND reverse data file for broadcast zone
;
$TTL 604800
@ IN SOA localhost. root.localhost. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS localhost.
101 IN PTR node1.skills.com.
102 IN PTR node2.skills.com.
103 IN PTR node3.skills.com.
7.重启服务
root@debian:~# systemctl restart bind9
root@debian:~# systemctl enable bind9
8.测试bind9服务
root@debian:~# nslookup
192.168.199.101
101.199.168.192.in-addr.arpa name = node1.skills.com.
192.168.199.102
102.199.168.192.in-addr.arpa name = node2.skills.com.
192.168.199.103
103.199.168.192.in-addr.arpa name = node3.skills.com.
node1.skills.com
Server: 192.168.199.101
Address: 192.168.199.101#53
Name: node1.skills.com
Address: 192.168.199.101
node2.skills.com
Server: 192.168.199.101
Address: 192.168.199.101#53
Name: node2.skills.com
Address: 192.168.199.102
node3.skills.com
Server: 192.168.199.101
Address: 192.168.199.101#53
Name: node3.skills.com
Address: 192.168.199.103