RHCE服务----DNS
实验要求:1、建立DNS服务器,负责解析的域为openedu.com
2、要求将MX记录指向mail.openedu.com,且对应A记录为本机IP
3、要求将NS记录指向ns1.openedu.com,且对应A记录为本机IP
4、建立www的A记录指向本机IP; 建立ftp对应A记录为x.x.x.123; 为mail主机建立别名记录pop3和smtp
5、为所有A记录建立PTR记录
6、openedu.com区域仅允许本网段中的主机x.x.x.200(NS为ns2.openedu.com)做区域传送; 对应的反向区域不允许任何主机做区域传送
7、客户端测试
1、安装bind软件
# yum install bind-y2、修改主配置文件
# vim /etc/named.conf
# 注释一行,改俩行
listen-on port 53 { 192.168.11.110; };
//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";
recursing-file"/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { 192.168.11.0/24; }; # 修改为本网段,或者用any3、修改区域文件
# vim /etc/named.rfc1912.zones
zone "openedu.com" IN {
type master;
file "openedu.com.zone";
};
zone "11.168.192.in-addr.arpa" IN {
type master;
file "192.168.11.zone";
};4、拷贝模板解析文件
# cat openedu.com.zone
$TTL 1D
@ IN SOAdns1.openedu.com. admin.openedu.com. (
2023032001 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns1.openedu.com.
MX 5 mail.openedu.com.
dns1 A 192.168.11.110
mail A 192.168.11.110
www A 192.168.11.110
ftp A 192.168.11.123
pop3 CNAME mail
smtp CNAME mail5、语法检测
# named-checkzone openedu.com /var/named/openedu.com.zone
zone openedu.com/IN: loaded serial 2023032001
OK6、重启服务
# systemctl restart named7、客户端测试
# 安装工具
# yum install bind-utils.x86_64 -y
# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.11.110
# 测试命令
> www.openedu.com
Server: 192.168.11.110
Address: 192.168.11.110#53
Name: www.openedu.com
Address: 192.168.11.110
> mail.openedu.com
Server: 192.168.11.110
Address: 192.168.11.110#53
Name: mail.openedu.com
Address: 192.168.11.110
> pop3.openedu,com
^C
# nslookup
> pop3.openedu.com
Server: 192.168.11.110
Address: 192.168.11.110#53
pop3.openedu.com canonical name = mail.openedu.com.
Name: mail.openedu.com
Address: 192.168.11.110
# nslookup
> ftp.openedu.com
Server: 192.168.11.110
Address: 192.168.11.110#53
Name: ftp.openedu.com
Address: 192.168.11.123
> pop3.openedu.com
Server: 192.168.11.110
Address: 192.168.11.110#53
pop3.openedu.com canonical name = mail.openedu.com.
Name: mail.openedu.com
Address: 192.168.11.1108、修改反向解析域
# cat 192.168.11.zone
$TTL 1D
@ IN SOA dns1.openedu.com. admin.openedu.com. (
2023032001 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns1.openedu.com.
dns1.openedu.com. A 192.168.11.110
110 PTR dns1.openedu.com.
110 PTR mail.openedu.com.
110 PTR www.openedu.com.
123 PTR ftp.openedu.com.9、语法检测
# named-checkzone openedu.com 192.168.11.zone
zone openedu.com/IN: loaded serial 2023032001
OK10、重启服务
# systemctl restart named11、客户端测试
# host -t PTR 192.168.11.110
110.11.168.192.in-addr.arpa domain name pointer www.openedu.com.
110.11.168.192.in-addr.arpa domain name pointer dns1.openedu.com.
110.11.168.192.in-addr.arpa domain name pointer ftp.openedu.com.
110.11.168.192.in-addr.arpa domain name pointer mail.openedu.com.
# host -t PTR 192.168.11.123
123.11.168.192.in-addr.arpa domain name pointer ftp.openedu.com.12、添加允许传送的从服务器,allow-transfer { address_match_elment;...};
# vim /etc/named.conf
options {
listen-on port 53 { 192.168.11.110; };
//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";
recursing-file"/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { 192.168.11.0/24; };
allow-transfer { 192.168.11.200;};13、添加NS2
# vim openedu.com.zone
$TTL 1D
@ IN SOAdns1.openedu.com. admin.openedu.com. (
2023032002 ; serial #注意手动修改序列号
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns1.openedu.com.
NS dns2.openedu.com.
MX 5 mail.openedu.com.
dns1 A 192.168.11.110
dns2 A 192.168.11.200
mail A 192.168.11.110
www A 192.168.11.110
ftp A 192.168.11.123
pop3 CNAME mail
smtp CNAME mail14、语法检测+重启服务
# named-checkzone openedu.com openedu.com.zone
zone openedu.com/IN: loaded serial 2023032002
OK
# systemctl restart named15、客户端测试
反向解析:
# host -t PTR 192.168.11.123
123.11.168.192.in-addr.arpa domain name pointer ftp.openedu.com.
# host -t PTR 192.168.11.110
110.11.168.192.in-addr.arpa domain name pointer mail.openedu.com.
110.11.168.192.in-addr.arpa domain name pointer www.openedu.com.
110.11.168.192.in-addr.arpa domain name pointer dns1.openedu.com.
正向解析
# nslookup
> www.openedu.com.
Server: 192.168.11.110
Address: 192.168.11.110#53
Name: www.openedu.com
Address: 192.168.11.110
> mail.openedu.com
Server: 192.168.11.110
Address: 192.168.11.110#53
Name: mail.openedu.com
Address: 192.168.11.110
> dns2.openedu.com
Server: 192.168.11.110
Address: 192.168.11.110#53
Name: dns2.openedu.com
Address: 192.168.11.200实验完成,恢复环境
出处:http://www.cnblogs.com/sre-chan/-------------------------------------------
个性签名:今天做了别人不想做的事,明天你就做得到别人做不到的事,尝试你都不敢,你拿什么赢!
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!
来源:https://www.cnblogs.com/sre-chan/p/17237528.html
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!
页:
[1]