Ubuntu12.04 server DNS server 搭建

来源:互联网 发布:传奇霸业 魔血符数据 编辑:程序博客网 时间:2024/05/22 05:29

Ubuntu12.04 server  DNSserver 搭建

 

操作系统:

ubuntu 12.04 server

使用软件:

Bind9

 IP

10.10.10.15

   关:

   :

10.10.10.1

www.hasee1212.com

.

1、安装bind9

 

#apt-get -y install bind9 bind9utils

这里我以 hasee1212.com 域名为例

2.配置bind9

查看name.conf配置文件

# cat/etc/name.conf

=====================================================

// This is the primary configuration filefor the BIND DNS server named.

//

// Please read/usr/share/doc/bind9/README.Debian.gz for information on the

// structure of BIND configuration filesin Debian, *BEFORE* you customize

// this configuration file.

//

// If you are just adding zones, please dothat in /etc/bind/named.conf.local


 

include"/etc/bind/named.conf.options";                       

include"/etc/bind/named.conf.local";

include"/etc/bind/named.conf.default-zones";

=========================================

接下来针对 /etc/bind/named.conf.default-zones 进行域名添加


# vim/etc/bind/named.conf.default-zones  注意红色的部分

=========================================

// prime the server with knowledge of theroot servers

zone "." {

        type hint;

        file"/etc/bind/db.root";

};
 

// be authoritative for the localhostforward and reverse zones, and for

// broadcast zones as per RFC 1912
 

zone "localhost" {

        type master;

        file"/etc/bind/db.local";

};

zone "127.in-addr.arpa" {

        type master;

        file"/etc/bind/db.127";

};


 

zone "0.in-addr.arpa" {

        type master;

        file"/etc/bind/db.0";

};
 

zone "255.in-addr.arpa" {

        type master;

        file"/etc/bind/db.255";

};
 

zone "hasee1212.com" {

        type master;

        file"/etc/bind/hasee1212.local";

};
 

zone "10.in-addr.arpa" {
        type master;
        file "/etc/bind/db.10";
};

 

#cp db.localhasee1212.local  //hasee1212.local 是正解

#cp db.127 db.10             //db.10是反解


#vim hasee1212.local


#vim db.10


#/etc/init.d/bind9restart

或者#/servicebind9 restart

 

3、测试

使用命令nslookup,host, dig

root@ubuntu:/etc/bind#nslookup

 

 

 

如果出现问题现在/var/log/syslog 中查找。如果一切正常,可能是本地的DNS没有设置成自己的DNS ip值。在12.04之前,我们只需要修改/etc/resolv.conf便可手动配置DNS了。但在12.04下,却会出现重启后/etc/resolv.conf被重写的情况

解决办法:vim/etc/network/interfaces: 将其中的DNS 改为自己设置的DNS ip 本例中就设置为10.10.10.15即可如图所示:


然后重启:service  networking  restart 测试,成功!

 

 

 

参考:

1、 Bind9安装设置指南.pdf

2、鸟哥私房菜服务器架设版—DNS服务器

http://vbird.dic.ksu.edu.tw/linux_server/0350dns/0350dns-centos4.php

3http://www.qianshoublog.com/post/7625.html

 

 

 

 

原创粉丝点击