日期:2014-05-16  浏览次数:20763 次

linux下如何搭建简单的DNS Server

环境:lenovo PC, SUSE Linux 11.1 32bit,BIND 9.5.0-P2

安装步骤:

  1. 采用yast自动安装。安装内容包括:bind,bind-chrootenv ,bind-devel,bind-libs,bind-utils

配置步骤:

  1. whereis named,找到bind的配置文件所在目录。如下在/etc/named.conf

    pandora-test:~ # whereis named
    named: /usr/sbin/named /etc/named.conf /etc/named.d /usr/share/man/man8/named.8.gz

  2. 修改named.conf
    2.1. 去掉注释并修改监听端口: listen-on port 53 { 172.16.39.86; };
    2.2. 添加域名解析和反向解析配置:

    zone "p.com" in {
    type master;
    file "p.com.zone";
    };

    zone "39.16.172.in-addr.arpa" in{
    type master;
    file "172.16.39.zone";
    };

    2.3 添加2.2中所指定的域名解析和反向解析的具体配置文件。如:p.com.zone,172.16.39.zone

    在文件夹/var/lib/named下进行添加

    p.com.zone文件内容如下:

    $TTL 1000
    @ IN SOA @ root (
    ? ? 42 ; serial (d. adams)
    ? ? 200S ; refresh
    ? ? 4H ; retry
    ? ? 1D ; expiry
    ? ? 100S ) ; minimum
    @ IN NS 172.16.39.86;
    @ IN A 172.16.39.86;
    www A 172.16.39.86;
    pboss A 172.16.39.86;
    confluence A 172.16.39.86;
    redis A 172.16.39.86;
    mysql A 172.16.39.86;
    svn A 172.16.8.159;
    hudson A 172.16.8.159;
    mvnrepo A 172.16.8.159;
    jira A 172.16.8.159;

    172.16.39.zone文件内容如下:

    $TTL 1000
    @ IN SOA localhost. root.localhost. (