Linuxsky
中国青基会
您当前的所在的位置是:主页>自由文档>网络服务> 文章页面

SUSE 10 简单配置DNS

去论坛讨论 来源: 作者: 发布时间:2008-11-22
 suse 10先已经是 IBM P系列服务器的 标准系统 这其中有两个选择
 
AIX 5  或 SUSE 9 这里,SUSE 在未来使用面积会越来越广.
 
这里配置SUSE 10 中的DNS
 
首先 可以看看你的SUSE 中是否安装了DNS
 
rpm -qa | grep bind
如果有会显示 BIND 的产品名称和版本号
 
OK 其实SUSE下的GONOME 的YAST 界面配置BIND 也很快,但网上介绍的不少请自己寻找
下面是 代码方式的
 
 
首先找到 配置文件 /etc/named.conf
 
打开文件(中文地方为解释)
 

# Copyright (c) 2001-2004 SuSE Linux AG, Nuernberg, Germany.
# All rights reserved.
#
# Author: Frank Bodammer, Lars Mueller <lmuelle@suse.de>
#
# /etc/named.conf
#
# This is a sample configuration file for the name server BIND 9.  It works as
# a caching only name server without modification.
#
# A sample configuration for setting up your own domain can be found in
# /usr/share/doc/packages/bind/sample-config.
#
# A description of all available options can be found in
# /usr/share/doc/packages/bind/misc/options.
这里是BIND 服务的核心
options {

   # The directory statement defines the name server's working directory
这里是BIND 服务的配置文件存放地点
   directory "/var/lib/named";

   # Write dump and statistics file to the log subdirectory.  The
   # pathenames are relative to the chroot jail.
这里是日志文件和服务器状态查看日志
   dump-file "/var/log/named_dump.db";
   statistics-file "/var/log/named.stats";

   # The forwarders record contains a list of servers to which queries
   # should be forwarded.  Enable this line and modify the IP address to
   # your provider's name server.  Up to three servers may be listed.
这里是转发地址 如果需要可以把 #去掉在里面加入你要转发的DNS地址
   #forwarders { 192.0.2.1; 192.0.2.2; };

   # Enable the next entry to prefer usage of the name server declared in
   # the forwarders section.

   #forward first;

   # The listen-on record contains a list of local network interfaces to
   # listen on.  Optionally the port can be specified.  Default is to
   # listen on all interfaces found on your system.  The default port is
   # 53.

   #listen-on port 53 { 127.0.0.1; };

   # The listen-on-v6 record enables or disables listening on IPv6
   # interfaces.  Allowed values are 'any' and 'none' or a list of
   # addresses.
支持IPV6
   listen-on-v6 { any; };

   # The next three statements may be needed if a firewall stands between
   # the local server and the internet.

   #query-source address * port 53;
   #transfer-source * port 53;
   #notify-source * port 53;

   # The allow-query record contains a list of networks or IP addresses
   # to accept and deny queries from. The default is to allow queries
   # from all hosts.

   #allow-query { 127.0.0.1; };

   # If notify is set to yes (default), notify messages are sent to other
   # name servers when the the zone data is changed.  Instead of setting
   # a global 'notify' statement in the 'options' section, a separate
   # 'notify' can be added to each zone definition.

   notify no;
   include "/etc/named.d/forwarders.conf";
};

# To configure named's logging remove the leading '#' characters of the
# following examples.
#logging {
#   # Log queries to a file limited to a size of 100 MB.
#   channel query_logging {
#       file "/var/log/named_querylog"
#           versions 3 size 100M;
#       print-time yes;         // timestamp log entries
#   };
#   category queries {
#       query_logging;
#   };
#
#   # Or log this kind alternatively to syslog.
#   channel syslog_queries {
#       syslog user;
#       severity info;
#   };
#   category queries { syslog_queries; };
#
#   # Log general name server errors to syslog.
#   channel syslog_errors {
#       syslog user;
#       severity error;
#   };
#   category default { syslog_errors;  };
#
#   # Don't log lame server messages.
#   category lame-servers { null; };
#};

# The following zone definitions don't need any modification.  The first one
# is the definition of the root name servers.  The second one defines
# localhost while the third defines the reverse lookup for localhost.

zone "." in {
   type hint;
   file "root.hint";
};

zone "localhost" in {
   type master;
   file "localhost.zone";
};

zone "0.0.127.in-addr.arpa" in {
   type master;
   file "127.0.0.zone";
};
这里我加入一个叫host 的的域名并给出文件的名字
zone "host.com" in {

   type master;

   file "host.zone";
};
这里是一个反向地址解析
zone "0.168.192.in-addr.arpa" in {
              type master;
              file "192.168.0.zone";

};
#Include the meta include file generated by createNamedConfInclude.  This
# includes all files as configured in NAMED_CONF_INCLUDE_FILES from
# /etc/sysconfig/named

# You can insert further zone records for your own domains below or create
# single files in /etc/named.d/ and add the file names to
# NAMED_CONF_INCLUDE_FILES.
# See /usr/share/doc/packages/bind/README.SUSE for more details.

好了配置完了 下面去写 HOST.COM 的配置文件和 反向解析文件

 

打开/var/lib/named/

创建 host.zone文件 在文件里面键入

$TTL 1W
host.com.       IN SOA host.com.     root (
               42      ; serial (d. adams)
               2D      ; refresh
               4H      ; retry
               6W      ; expiry
               1W )        ; minimum

       IN NS         host.com.  
       IN A        192.168.0.33
dns             IN A            192.168.0.33
www             IN A            192.168.0.33
vi              IN CNAME       www.host.com.

这里说明SOA 主要的意思是 HOST.COM 的域名解析 主要在 HOST.COM 中进行(一般不这样写) 剩下的 NS 说明主机的DNS A 为主机  CNAME 为别名

写完这些在对192.168.0.zone 文件进行建立和编辑

$TTL 1W
@       IN SOA      host.com.   root.localhost. (
               42      ; serial (d. adams)
               2D      ; refresh
               4H      ; retry
               6W      ; expiry
               1W )        ; minimum

       IN NS       host.com.
33      IN PTR      www.host.com.
 

此过程在 SUSE 企业版 10中通过

免费注册 | 网站地图 | RSS订阅 | 友情链接 | 论坛交流 | 用户搏客 | 返回顶端

站内资料部分由本人收集整理,所有文章版权均系原作者和出版者所有,如涉版权问题,恳请来信告知!

本站原创作品除特别声明外皆以创作共用协议发布