redhat dns服务器搭建

这段时间一直在郁闷这个问题,昨天在冰川帮助下终于解决了。哈哈

linux下dns的建立其实理论都是一样的不外乎版本不同,有的无有模板和有的没有模板(这就要自己写了)

当然我们这里提到的是有模板的,以后把这个cp下来,就是自己的dns模板了

安装dns

1、配ip

2、检查必须的安装包

     rpm -qa | grep bind(一般情况下,装系统时基本都装了)

3、按主程序包

    rpm -ivh caching-。。。。。。。

4、配置dns配置文件

    共有4个文件需要配置

     /etc/named.caching-...........................  

    /etc/named,rfc9329..........

    /var/named/chroot/var/named下的两个文件

    当然最好cp出来配置,保证即使配置出错了,从新cp就ok了。

当然基本方法就是这样,具体问题还的具体分析。

Dns的配置<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

1、  配置计算机名、dns指向、ip地址

   Hostname linux

  Vi  /etc/resolv.conf

  Setup

2、  安装包

先检查包安装情况

Rpm –qa | grep bind

如果没安装在安装

Rpm –ivh caching-补全(这个包一般没有安装)

3、  配置主配置文件

Vi  /etc/named.caching-补全

其中有四项是单dns不用的,给注释掉

还有一些是ddns用的,研究一下这个文件

Vi  /etc/named.rcf补全

这个是正向和方向的模版

4、  配置正向区域和方向区域

第一排配置主机名.域名.  Root.域名.

下面也要写主机名.域名.

然后正向主要配置www ip    A记录和mx记录,当然也可以有别名cname配置

反向主要配置ipwww     ptr指针

5、  重启

Service bind restart

Chkconfig --level 35 bind on

Chkconfig –list | grep bind



实验:

5、Dns的配置

1、  配置计算机名、dns指向、ip地址

  Hostname linux

  Vi /etc/resolv.conf

  Setup

2、  安装包

先检查包安装情况

Rpm –qa | grep named

如果没安装在安装

Rpm –ivh caching-补全          (这个包一般没有安装)   

3、  配置主配置文件

Vi  /etc/named.caching-补全

// named.caching-nameserver.conf

//

// Provided by Red Hatcaching-nameserver package to configure the

// ISC BIND named(8) DNS server asa caching only nameserver

// (as a localhost DNS resolveronly).

//

// See/usr/share/doc/bind*/sample/ for example named configuration files.

//

// DO NOT EDIT THIS FILE - usesystem-config-bind or an editor

// to create named.conf - edits tothis file will be lost on

// caching-nameserver packageupgrade.

//

options {

//      listen-on port 53 { 127.0.0.1; };

        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";

        query-source    port 53;

        query-source-v6 port 53;

//      allow-query     { localhost; };

};

logging {

        channel default_debug {

                file"data/named.run";

                severity dynamic;

        };

};

view localhost_resolver {

//      match-clients      { localhost; };

//      match-destinations { localhost; };

        recursion yes;

        include"/etc/named.rfc1912.zones";

};

                                                                                                                                                   "/etc/named.caching-nameserver.conf"36L, 1108C   

其中有四项是单dns不用的,给注释掉

还有一些是ddns用的,研究一下这个文件

Vi  /etc/named.rcf补全

// named.rfc1912.zones:

//

// Provided by Red Hatcaching-nameserver package

//

// ISC BIND named zoneconfiguration for zones recommended by

// RFC 1912 section 4.1 :localhost TLDs and address zones

//

// See/usr/share/doc/bind*/sample/ for example named configuration files.

//

zone "." IN {

        type hint;

        file "named.ca";

};

 

zone "localdomain" IN {

        type master;

        file "localdomain.zone";

        allow-update { none; };

};

 

//zone "localhost" IN {

//      type master;

//      file "localhost.zone";

//      allow-update { none; };

//};

 

//zone"0.0.127.in-addr.arpa" IN {

//      type master;

//      file "named.local";

//      allow-update { none; };

//};

 

zone "kk.com" IN {

        type master;

        file "zx.zone";

//        allow-update { none; };

};

 

zone"1.168.192.in-addr.arpa" IN {

        type master;

        file "fx.zone";

//        allow-update { none; };

};

                                                                                                                                                     

"/etc/named.rfc1912.zones" 43L, 850C

这个是正向和方向的模版

4、配置正向区域和方向区域

第一排配置 主机名.域名. Root.域名.

下面也要写 主机名.域名.

   反向主要配置ip对www     ptr指针

 

$TTL    86400

@       IN     SOA     linux.kk.com.root.kk.com.  (

                                     1997022700 ; Serial

                                     28800      ; Refresh

                                     14400      ; Retry

                                     3600000    ; Expire

                                      86400 )    ; Minimum

        IN     NS      linux.kk.com.

2       IN     PTR     www.kk.com.

2       IN  PTR       mail.kk.com.

2       IN PTR         ftp.kk.com.

                                                                                                                                                       

"fx.zone" 11L, 501C  

然后正向主要配置www 对ip    A记录和mx记录,当然也可以有别名cname配置

$TTL   86400

@      IN      SOA     linux.kk.com. root.kk.com.  (

                                     1997022700 ; Serial

                                     28800      ; Refresh

                                     14400      ; Retry

                                     3600000    ; Expire

                                      86400 )    ; Minimum

       IN      NS      linux.kk.com.

      IN      MX  20   mail.kk.com.

linx   IN     A        192.168.1.2

www    IN    A         192.168.1.2

ftp     IN   A         192.168.1.2

mail    IN   A         192.168.1.2

                                                                                                                                                        

"zx.zone" 14L, 577C

 

5、重启

--service bind restart

--chkconfig --level 35 named on

--chkconfig –list | grep named

--service httpd status

欢迎加入
database群:119224876(db china联盟) 虚拟化方面群:229845401(虚拟化-云计算-物联网)

 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值