成都网站建设设计

将想法与焦点和您一起共享

DNS正反向解析

yum install bind -y #安装DNS服务

成都创新互联公司专注于企业全网营销推广、网站重做改版、五莲网站定制设计、自适应品牌网站建设、H5网站设计商城网站建设、集团公司官网建设、外贸网站制作、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为五莲等各大城市提供网站开发制作服务。

vi /etc/named.conf    #进入dns配置文件修改以下内容
listen-on port 53 { any; };
allow-query     { any; };  

DNS 正反向解析

vi /etc/named.rfc1912.zones:         
到最后一行添加以下内容

zone "hello.com" IN {      //正向解析
      type master;
      file "hello.zone";
};
zone "80.168.192.in-addr.arpa" IN {    //反向解析
        type master;
        file "hello.local";
};
cd /var/named
cp -p named.localhost hello.zone  //正向解析模板
vi  hello.zone

$TTL 1D
@       IN SOA  hello.zone 3040401509@qq.com (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      dns.hello.com.
dns     IN A    192.168.80.100
www     IN A    192.168.80.101
ftp     IN A    192.168.80.102

cp -p named.localhost hello.local //反向解析模板

vi hello.local

$TTL 1D
@ IN SOA hello. 3040401509@qq.com (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.hello.com.
100 IN PTR dns.hello.com.
101 IN PTR www.hello.com.

检查主配置文件语法是否有错误:
named-checkconf

systemctl start named 启动服务

netstat -anpt | grep named


![](/upload/otherpic53/b7b30a20bf2b8cd096c57af923b861c4.jpg)

vi /etc/sysconfig/network-scripts/ifcfg-ens32

DNS1=192.168.80.100



![](/upload/otherpic53/77efd6b912f0ba5637c59ac6dafe6034.jpg)

> systemctl restart network
> nslookup www.hello.com

![](/upload/otherpic53/3ce4a31281a70ac11e5590dfc4dc1826.jpg)

> nslookup 192.168.80.100

![](/upload/otherpic53/c775ec6022840c0f461b9bc026014973.jpg)

网站标题:DNS正反向解析
URL链接:http://chengdu.cdxwcx.cn/article/gejddj.html