Centos7搭建DNS正向解析和反向解析-成都快上网建站

Centos7搭建DNS正向解析和反向解析

Centos 7 搭建DNS正向解析和反向解析

服务的三要素:安装-配置-启动

创新互联是专业的祁门网站建设公司,祁门接单;提供网站设计制作、成都网站制作,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行祁门网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!

1.使用yum安装DNS
yum install bind -y

2.修改配置文件

     vi /etc/named.conf
    修改以下内容:
  listen-on port 53 { any; };
  allow-query     { any; };
vi /etc/named.rfc1912.zones
    在末尾添加以下内容:
zone "hello.com" IN {                     -----正向解析
        type master;
        file "hello.com.zone";
};

zone "80.168.192.in-addr.arpa" IN {  -----反向解析
        type master;
        file "hello.com.local";
};
wq    --保存退出
cd /var/named/
cp -p named.localhost hello.com.zone    ---复制模板

创建一个正向解析文件跟你 file "hello.com.zone",文件名要一样;

vi hello.com.zone           ---

$TTL 1D
@       IN SOA  hello.com. 123213123.qq.com (
                                        1       ; 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  

创建一个反向解析 file "hello.com.local",文件名要一样;

vi hello.com.local
$TTL 1D
@       IN SOA  hello.com. 12123123.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

3.启动DNS服务
systemctl start named

查看DNS服务是否启动成功

   `netstat  -anpt  | grep  named`

Centos 7  搭建DNS正向解析和反向解析

     测试DNS服务
     1.安装nslookup命令
     `yum   install  bind-utils  -y`

     2.给网卡指定DNS
     `vi /etc/sysconfig/network-scripts/ifcfg-ens32 `
     在末尾添加以下内容:
```
 DNS1=192.168.80.100   (根据实际情况添写DNS地址)

 wq   ---保存退出

     systemc  restart    network     ---重新启动网卡服务
      3.使用nslookup测试正向解析和反向解析
正向解析就是根据网址解析出ip地址

Centos 7  搭建DNS正向解析和反向解析
反向解析就是根据ip地址解析出网址
Centos 7  搭建DNS正向解析和反向解析


当前标题:Centos7搭建DNS正向解析和反向解析
链接分享:http://kswjz.com/article/gesogc.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流