阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

RedHat Linux AS 5.3 下DNS的配置步骤

237次阅读
没有评论

共计 10561 个字符,预计需要花费 27 分钟才能阅读完成。

RedHat Linux AS 5.3 下 DNS 的配置与 RedHat Linux AS 4.5 的有很多地方不太一样,这里我把在 RedHat Linux AS 5.3 下 DNS 配置步骤做了一个笔记,操作如下:

一、检查 BIND 包,缺少 bind、bind-chroot 包

RedHat Linux AS 5.3 下 DNS 的配置步骤

 

二、利用 YUM 源,安装 BIND 包

1、配 YUM 源

[root@mydb ~]# mount /dev/cdrom /mnt

mount: block device /dev/cdrom is write-protected, mounting read-only

[root@mydb ~]# vi/etc/yum.repos.d/update.repo

[update]
name=update
baseurl=file:///mnt/Server
gpgcheck=0
enabled = 1

2、安装 bind 包

[root@mydb ~]# yum list

[root@mydb~]# yum install bind

Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package bind.x86_64 30:9.3.4-10.P1.el5 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================
 Package                Arch                      Version                                Repository                Size
==========================================================================================================================
Installing:
 bind                    x86_64                    30:9.3.4-10.P1.el5                    update                    961 k

Transaction Summary
==========================================================================================================================
Install      1 Package(s)       
Update      0 Package(s)       
Remove      0 Package(s)       

Total download size: 961 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing    : bind                                              [1/1]

Installed: bind.x86_64 30:9.3.4-10.P1.el5
Complete!

更多详情见请继续阅读下一页的精彩内容 :http://www.linuxidc.com/Linux/2013-11/93224p2.htm

相关阅读

RHEL6 服务器搭建 DNS 服务器  http://www.linuxidc.com/Linux/2013-10/91256.htm

精解 Linux RHEL 6.x DNS 服务器  http://www.linuxidc.com/Linux/2013-08/88986.htm

CloudFoundry 虚拟机实例配置 DNS  http://www.linuxidc.com/Linux/2013-07/87182.htm

Ubuntu DNS 服务器配置  http://www.linuxidc.com/Linux/2013-07/87181.htm

CentOS 6.4 DNS 服务器搭建  http://www.linuxidc.com/Linux/2013-06/86060.htm

[root@mydb~]# yum install bind-chroot

Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package bind-chroot.x86_64 30:9.3.4-10.P1.el5 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================
 Package                      Arch                    Version                              Repository              Size
==========================================================================================================================
Installing:
 bind-chroot                  x86_64                  30:9.3.4-10.P1.el5                    update                  42 k

Transaction Summary
==========================================================================================================================
Install      1 Package(s)       
Update      0 Package(s)       
Remove      0 Package(s)       

Total download size: 42 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing    : bind-chroot                                      [1/1]

Installed: bind-chroot.x86_64 30:9.3.4-10.P1.el5
Complete!

3、检查安装的 BIND 包,Ok 了!

RedHat Linux AS 5.3 下 DNS 的配置步骤

 

 

[root@mydb ~]# service named status

rndc: connect failed: 127.0.0.1#953: connection refused

named is stopped

说明 DNS 没有配好,接下来就开始配置 DNS。

RedHat Linux AS 5.3 下 DNS 的配置与 RedHat Linux AS 4.5 的有很多地方不太一样,这里我把在 RedHat Linux AS 5.3 下 DNS 配置步骤做了一个笔记,操作如下:

一、检查 BIND 包,缺少 bind、bind-chroot 包

RedHat Linux AS 5.3 下 DNS 的配置步骤

 

二、利用 YUM 源,安装 BIND 包

1、配 YUM 源

[root@mydb ~]# mount /dev/cdrom /mnt

mount: block device /dev/cdrom is write-protected, mounting read-only

[root@mydb ~]# vi/etc/yum.repos.d/update.repo

[update]
name=update
baseurl=file:///mnt/Server
gpgcheck=0
enabled = 1

2、安装 bind 包

[root@mydb ~]# yum list

[root@mydb~]# yum install bind

Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package bind.x86_64 30:9.3.4-10.P1.el5 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================
 Package                Arch                      Version                                Repository                Size
==========================================================================================================================
Installing:
 bind                    x86_64                    30:9.3.4-10.P1.el5                    update                    961 k

Transaction Summary
==========================================================================================================================
Install      1 Package(s)       
Update      0 Package(s)       
Remove      0 Package(s)       

Total download size: 961 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing    : bind                                              [1/1]

Installed: bind.x86_64 30:9.3.4-10.P1.el5
Complete!

更多详情见请继续阅读下一页的精彩内容 :http://www.linuxidc.com/Linux/2013-11/93224p2.htm

相关阅读

RHEL6 服务器搭建 DNS 服务器  http://www.linuxidc.com/Linux/2013-10/91256.htm

精解 Linux RHEL 6.x DNS 服务器  http://www.linuxidc.com/Linux/2013-08/88986.htm

CloudFoundry 虚拟机实例配置 DNS  http://www.linuxidc.com/Linux/2013-07/87182.htm

Ubuntu DNS 服务器配置  http://www.linuxidc.com/Linux/2013-07/87181.htm

CentOS 6.4 DNS 服务器搭建  http://www.linuxidc.com/Linux/2013-06/86060.htm

三、配置 DNS

1、安装 caching-nameserver

[root@mydb~]# yum install caching-nameserver

Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package caching-nameserver.x86_64 30:9.3.4-10.P1.el5 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================
 Package                            Arch                  Version                            Repository            Size
==========================================================================================================================
Installing:
 caching-nameserver                x86_64                30:9.3.4-10.P1.el5                  base                  58 k

Transaction Summary
==========================================================================================================================
Install      1 Package(s)       
Update      0 Package(s)       
Remove      0 Package(s)       

Total download size: 58 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing    : caching-nameserver                                [1/1]

Installed: caching-nameserver.x86_64 30:9.3.4-10.P1.el5
Complete!

2、安装完成会在 /etc/ 下生成 named.caching-nameserver.conf,查看其内容如下:

[root@mydb~]# cat /etc/named.caching-nameserver.conf

//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver
// (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// DO NOT EDIT THIS FILE – use system-config-bind or an editor
// to create named.conf – edits to this file will be lost on
// caching-nameserver package upgrade.
//
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”;

        // Those options should be used carefully because they disable port
        // randomization
        // 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”;
};

3、拷贝 /etc/named.caching-nameserver.conf 到 /var/named/chroot/etc/named.conf

[root@mydb ~]# cp /etc/named.caching-nameserver.conf /var/named/chroot/etc/named.conf

 

 

4、编辑 /var/named/chroot/etc/named.conf

[root@mydb ~]# vi/var/named/chroot/etc/named.conf

options {
        listen-on port 53 {0.0.0.0/0;};
        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”;

        // Those options should be used carefully because they disable port
        // randomization
        // query-source    port 53;
        // query-source-v6 port 53;

        allow-query    {any;};
      //allow-query-cache    {any;};
};
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”;
#};
#
# —- 添加以下这一段
zone “example.com.”{
        type master;
        file “example.file”;
};

5、修改 named.conf 权限

[root@mydb~]# cd /var/named/chroot/etc/

[root@mydbetc]# ll

total 20

-rw-r–r–1 root root 405 Sep 26 22:10 localtime

-rw-r—–1 root named 1195 Jan 6 2009 named.caching-nameserver.conf

-rw-r—–1 root root 1371 Nov 27 10:19 named.conf

-rw-r—–1 root named 955 Jan 6 2009named.rfc1912.zones

-rw-r—–1 root named 113 Nov 27 09:53 rndc.key

[root@mydbetc]# chown .named named.conf

[root@mydbetc]# ll

total 20

-rw-r–r–1 root root 405 Sep 26 22:10 localtime

-rw-r—–1 root named 1195 Jan 6 2009 named.caching-nameserver.conf

-rw-r—–1 root named 1371 Nov 27 10:19 named.conf

-rw-r—–1 root named 955 Jan 6 2009named.rfc1912.zones

-rw-r—– 1 root named 113 Nov 27 09:53 rndc.key

 

 

 

6、配域名

root@mydbnamed]# pwd

/var/named/chroot/var/named

[root@mydbnamed]# ls -l

total 36

drwxrwx—2 named named 4096 Aug 26 2004 data

-rw-r—–1 root named 198 Jan 6 2009 localdomain.zone

-rw-r—–1 root named 195 Jan 6 2009 localhost.zone

-rw-r—–1 root named 427 Jan 6 2009 named.broadcast

-rw-r—–1 root named 1892 Jan 6 2009named.ca

-rw-r—–1 root named 424 Jan 6 2009 named.ip6.local

-rw-r—–1 root named 426 Jan 6 2009 named.local

-rw-r—–1 root named 427 Jan 6 2009 named.zero

drwxrwx— 2 named named 4096 Jul 27 2004 slaves

 

[root@mydb named]# cplocaldomain.zone example.file

 

7、编辑 example.file

[root@mydb named]# vi /var/named/chroot/var/named/example.file

$TTL    86400
@              IN SOA  guoyjoe.example.com. root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M            ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
                IN NS          guoyjoe.example.com
guoyjoe        IN A            192.168.153.129
mydb            IN A            192.168.153.129

四、启动 DNS 服务

[root@mydbnamed]# service named restart

Stoppingnamed: [OK]

Starting named: [OK]

 

五、客户端的 DNS 指定

[root@mydb ~]# more /etc/resolv.conf
; generated by /sbin/dhclient-script
search localdomain
nameserver 192.168.153.129

更多 RedHat 相关信息见 RedHat 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=10

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计10561字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中