DNS服务搭建(1)

 dns服务端的工作:

  yum insatll bind -y
   systemctl start named
   netstat -antulpe | grep named
   firewall-cmd --list-all
   firewall-cmd --permanent --add-service=dns
   firewall-cmd --reload
   //-----------------------------------------------------------------------------------------------------

   vim /etc/named.conf

...

  ns {
          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服务端查询
 
  $UDPServerRun 514

...
-----------------------------------
  vim /etc/named.rfc1912.zones

...............

  zone "westoslinux.com" IN {  ##dns的要查询域名

          type master;    ##数据库类型为主数据库
          file "westoslinux.com";  ##查询文件区域
          allow-update { none; };

  };

..........

  --------------------------------------------------
  Zone文件的编写
  vim /var/named/westoslinux.com
  $TTL 1D
  @       IN SOA  dns.westoslinux.com. root.westoslinux.com. (
                                          0       ; serial
                                          1D      ; refresh
                                          1H      ; retry
                                          1W      ; expire
                                          3H )    ; minimum
          NS      dns.westoslinux.com.   ##dbs服务器名称
  dns     A       192.168.122.2           ##dns服务器地址
  www     A       172.25.254.111          ##解析的地址

----------------------------------------------
反解的Zone文件的编写
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服务器的域名
dns     A       192.168.122.2

222     PTR     www.westoslinux.com.
-------------------------------------------------------------------------------------------------------------------------

客户端:

vim /etc/resolve.conf中设置DNS服务器地址。
查询正解 dig 域名
查询反解 dig + ip地址
---------------------------------------

 

你可能感兴趣的:(DNS服务搭建(1))