#################DNS服务器的简单搭建###############
---------------------------------------------------
yum install bind -y ##安装bind软件
systemctl start named ##开启named软件
firewall-cmd --permanent --add-service=dns
firewall-cmd --reload
firewall-cmd --list-all ##使火墙不产生影响
netstat -antulpe | grep named ##查看端口有没有打开
---------------------------------------------------
####正向解析:
####server端配置:
vim /etc/named.conf
---------------------------------------------------
options {
listen-on port 53 { any; }; ####dns服务查询的权限
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; }; ####为那些dns客户机提供服务
---------------------------------------------------
vim /etc/named.rfc1912.zones
---------------------------------------------------
zone "westoslinux.com" IN { ####
type master;
file "westoslinux.com.zone"; ####
allow-update { none; };
};
--------------------------------------------------
cd /var/named
ls
cp -p named.loopback westoslinux.com.zone
---------------------------------------------------
vim westoslinux.com.zone
---------------------------------------------------
$TTL 1D
@ IN SOA dns.westoslinux.com. root.westoslinux.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.westoslinux.com.
dns A 172.25.254.32
www A 172.25.254.66
www A 172.25.254.99
--------------------------------------------------
systemctl restart named ##重启
dig www.westoslinux.com ##测试
--------------------------------------------------
####反向解析:
####server端配置:
vim /etc/named.conf
--------------------------------------------------
options {
listen-on port 53 { any; }; ####dns服务查询的权限
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; }; ####为那些dns客户机提供服务
---------------------------------------------------
vim /etc/named.rfc1912.zones
----------------------------------------------------
zone "254.25.172.in-addr.arpa" IN {
type master;
file "westoslinux.com.ptr";
allow-update { none; };
};
---------------------------------------------------
vim westoslinux.com.ptr
---------------------------------------------------
$TTL 1D
@ IN SOA dns.westoslinux.com. root.westoslinux.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.westoslinux.com.
dns A 172.25.254.32
88 PTR www.westoslinux.com.
---------------------------------------------------
systemctl restart named ##重启
dig -x 172.25.254.88 ##测试
---------------------------------------------------
yum install bind -y ##安装bind软件
systemctl start named ##开启named软件
firewall-cmd --permanent --add-service=dns
firewall-cmd --reload
firewall-cmd --list-all ##使火墙不产生影响
netstat -antulpe | grep named ##查看端口有没有打开
---------------------------------------------------
####正向解析:
####server端配置:
vim /etc/named.conf
---------------------------------------------------
options {
listen-on port 53 { any; }; ####dns服务查询的权限
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; }; ####为那些dns客户机提供服务
---------------------------------------------------
vim /etc/named.rfc1912.zones
---------------------------------------------------
zone "westoslinux.com" IN { ####
type master;
file "westoslinux.com.zone"; ####
allow-update { none; };
};
--------------------------------------------------
cd /var/named
ls
cp -p named.loopback westoslinux.com.zone
---------------------------------------------------
vim westoslinux.com.zone
---------------------------------------------------
$TTL 1D
@ IN SOA dns.westoslinux.com. root.westoslinux.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.westoslinux.com.
dns A 172.25.254.32
www A 172.25.254.66
www A 172.25.254.99
--------------------------------------------------
systemctl restart named ##重启
dig www.westoslinux.com ##测试
--------------------------------------------------
####反向解析:
####server端配置:
vim /etc/named.conf
--------------------------------------------------
options {
listen-on port 53 { any; }; ####dns服务查询的权限
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; }; ####为那些dns客户机提供服务
---------------------------------------------------
vim /etc/named.rfc1912.zones
----------------------------------------------------
zone "254.25.172.in-addr.arpa" IN {
type master;
file "westoslinux.com.ptr";
allow-update { none; };
};
---------------------------------------------------
vim westoslinux.com.ptr
---------------------------------------------------
$TTL 1D
@ IN SOA dns.westoslinux.com. root.westoslinux.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.westoslinux.com.
dns A 172.25.254.32
88 PTR www.westoslinux.com.
---------------------------------------------------
systemctl restart named ##重启
dig -x 172.25.254.88 ##测试