正向:
服务端:
vim /etc/named.conf
options {
listen-on port 53 { 192.168.41.128; };
directory "/var/named";
allow-query { any; };
};
zone "openlab.com" IN {
type master;
file "openlab.zone";
cd /var/named/
ll
总用量 44
cp -a named.localhost openlab.zone
vim /var/named/openlab.zone
$TTL 1D
@ IN SOA dns.openlab.com. test.163.com ( 0
1D
1H
1W
3H
)
IN NS dns.openlab.com.
IN MX 10 mail.openlab.com.
dns.openlab.com. IN A 192.168.41.160
mail.openlab.com. IN A 192.168.41.161
www.openlab.com. IN A 192.168.41.160
named-checkconf /etc/named.conf
named-checkzone openlab.com /var/named/openlab.zonezone openlab.com/IN: loaded serial 0
systemctl restart named
客户端
nslookup www.openlab.com
Server: 192.168.41.128
Address: 192.168.41.128#53
Name: www.openlab.com
Address: 192.168.41.160
nslookup mail.openlab.com
Server: 192.168.41.128
Address: 192.168.41.128#53
Name: mail.openlab.com
Address: 192.168.41.161
二.反向:
服务端:
vim /etc/named.conf
zone "41.168.192.in-addr.arpa" IN {
type master;
file "41.168.192.zone";
};
vim /var/named/41.168.192.zone
$TTL 1D
@ IN SOA dns.openlab.com. test.163.com (
0
1D
1H
1W
3H
)
IN NS dns.openlab.com.
160 IN PTR dns.openlab.com
161 IN PTR mail.openlab.com
160 IN PTR www.openlab.com
named-checkconf /etc/named.conf
named-checkzone 41.168.192 /var/named/41.168.192.zone
zone 2.168.192/IN: loaded serial 0
systemctl restart named
nslookup 192.168.41.160
160.41.168.192.in-addr.arpa name = dns.openlab.com.41.168.192.in-addr.arpa.