RHCE 四

[root@mouse ~]#yum -y install bind
[root@mouse ~]#rpm-qa |grep bind97

修改主配置文件

[root@mouse ~]#vim /etc/named.conf
# 注释一行,改俩行
listen-on port 53 { 192.168.152.112; };
        //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.152.0/24; }; # 修改为本网段,或者用any

修改区域文件
 

[root@mouse ~]# 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.152.zone";
};

拷贝模板解析文件

[root@mouse named]# cat openedu.com.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.
        MX 5    mail.openedu.com.
dns1    A       192.168.152.112
mail    A       192.168.152.112
www     A       192.168.152.112
ftp     A       192.168.152.113
pop3    CNAME   mail
smtp    CNAME   mail

语法检测

[root@mouse named]# named-checkzone openedu.com /var/named/openedu.com.zone
zone openedu.com/IN: loaded serial 2023032001
OK

重启服务

root@mouse named]# systemctl restart named

客户端测试

# 安装工具
[root@mouse ~]# yum install bind-utils.x86_64 -y
[root@mouse ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.152.112
# 测试命令
> www.openedu.com
Server:         192.168.152.112
Address:        192.168.152.112#53
 
Name:   www.openedu.com
Address: 192.168.152.112
> mail.openedu.com
Server:         192.168.152.112
Address:        192.168.152.112#53
 
Name:   mail.openedu.com
Address: 192.168.152.112
> pop3.openedu,com
^C
[root@mouse ~]# nslookup
> pop3.openedu.com
Server:         192.168.152.112
Address:        192.168.152.112#53
 
pop3.openedu.com        canonical name = mail.openedu.com.
Name:   mail.openedu.com
Address: 192.168.152.112
[root@server ~]# nslookup
> ftp.openedu.com
Server:         192.168.152.112
Address:        192.168.152.112#53
 
Name:   ftp.openedu.com
Address: 192.168.11.123
> pop3.openedu.com
Server:         192.168.152.112
Address:        192.168.152.112#53
 
pop3.openedu.com        canonical name = mail.openedu.com.
Name:   mail.openedu.com
Address: 192.168.152.112

修改反向解析域

[root@mouse named]# cat 192.168.152.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.

语法检测

[root@mouse named]# named-checkzone openedu.com 192.168.152.zone
zone openedu.com/IN: loaded serial 2023032001
OK

重启服务

[root@mouse named]# systemctl restart named

客户端测试

[root@mouse ~]# host -t PTR 192.168.152.112
112.152.168.192.in-addr.arpa domain name pointer www.openedu.com.
112.152.168.192.in-addr.arpa domain name pointer dns1.openedu.com.
112.152.168.192.in-addr.arpa domain name pointer ftp.openedu.com.
112.152.168.192.in-addr.arpa domain name pointer mail.openedu.com.
[root@mouse ~]# host -t PTR 192.168.152.113
113.152.168.192.in-addr.arpa domain name pointer ftp.openedu.com.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值