`
chenlb
  • 浏览: 693361 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

dns server on centos

阅读更多
    想到局域网上建一个dns服务器,昨天晚上搞了好久都不成,包括今天也发了好多时间也不能通过.最后找到

水小筑之Blog

http://blog.chinaunix.net/u/5302/showart_238337.html
的博客, 帮了大忙,网上的很多文章都试过了都没有很好的结果.

我安装的centos是单CD的服务版本.安装后已经有bind了

1.配置文件在/etc/named.conf
//
// named.conf for Red Hat caching-nameserver 
//

options {
    directory 
"/var/named";
    dump
-file "/var/named/data/cache_dump.db";
        statistics
-file "/var/named/data/named_stats.txt";
    
/*
     
* If there is a firewall between you and nameservers you want
     
* to talk to, you might need to uncomment the query-source
     
* directive below.  Previous versions of BIND always asked
     
* questions using port 53, but BIND 8.1 uses an unprivileged
     
* port by default.
     
*/
     
// query-source address * port 53;
};

// 
// a caching only nameserver config
// 
controls {
    inet 
127.0.0.1 allow { localhost; } keys { rndckey; };
};

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 
"chenlb.com" IN {
    type master;
    file 
"chenlb.com.zone";
    allow
-query { any; };
    allow
-transfer { any; };
    allow
-update { none; };
};

zone 
"0.0.127.in-addr.arpa" IN {
    type master;
    file 
"named.local";
    allow
-update { none; };
};

zone 
"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
        type master;
    file 
"named.ip6.local";
    allow
-update { none; };
};

zone 
"255.in-addr.arpa" IN {
    type master;
    file 
"named.broadcast";
    allow
-update { none; };
};

zone 
"0.in-addr.arpa" IN {
    type master;
    file 
"named.zero";
    allow
-update { none; };
};

include 
"/etc/rndc.key";

    只要添加一个zone就行,看上面
zone "chenlb.com" IN {
    type master;
    file 
"chenlb.com.zone";
    allow
-query { any; };
    allow
-transfer { any; };
    allow
-update { none; };
};

2.在/var/named/chroot/var/named/目录里建个chenlb.com.zone(上面的file),内容如下:
$TTL    86400
@       IN      SOA    chenlb.com.  root.chenlb.com.(
                                      
2008050201 ; Serial
                                      
28800      ; Refresh
                                      
14400      ; Retry
                                      
3600000    ; Expire
                                      
86400 )    ; Minimum
        IN NS    chenlb.com.
        IN MX 
10 mail.chenlb.com.
@       IN A     
192.168.0.60
www     IN A     
192.168.0.60
ftp     IN A     
192.168.0.60
mail    IN A     
192.168.0.60

3.在/var/named目录下建链接
# ch /var/named
#
 ln -s /var/named/chroot/var/named/chenlb.com.zone chenlb.com.zone

4.启动named
# /etc/init.d/named start

5.测试前添加nds服务地址
# vi /etc/resolv.conf

在加
nameserver 192.168.0.60
search chenlb.com
说明:192.168.0.60是我本机地址

现在本机下可以ping  www.chenlb.com了

要在加的机上可以使用DNS服务,要在防火墙里允许

6.修改/etc/sysconfig/iptables添加下面的
-A RH-Firewall-1-INPUT -p udp -m udp --dport 53 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 53 -j ACCEPT

    OK,现在在win里添加dns地址192.168.0.60就在ping  www.chenlb.com了. 呵呵


分享到:
评论

相关推荐

    CentOS 7 Server Deployment Cookbook

    What You Will Learn * See how to deploy CentOS easily and painlessly, even in multi-server environments * Configure various methods of remote access to the server so you don't always have to be in ...

    CentOS 7 Linux Server Cookbook(PACKT,2ed,2016).

    Further on, we cover advanced topics such as FTP services, building your own DNS server, running database servers, and providing mail and web services. Finally, you will get a deep understanding of ...

    centos通过bind配置DNS服务

    Bind是DNS服务中最常用的一款开源软件,尤其在Linux系统如CentOS中广泛使用。本文将详细介绍如何在CentOS 7上通过Bind配置DNS服务,包括正向和反向区域解析。 首先,我们要安装Bind服务。在CentOS 7中,可以使用`...

    Centos下DNS服务器的配置.docx

    文件内容可能包括`SOA`(Start of Authority)记录,`NS`(Name Server)记录和其他DNS记录如`A`(主机记录)和`MX`(邮件交换器记录)。 3. 修改完成后,别忘了通过`/etc/init.d/named restart`重启`named`服务来...

    CentOS5.5(2.6内核)下配置lamp+samba+ssh+dns

    通过以上步骤,你可以成功地在一个 CentOS 5.5 的系统上配置好 LAMP 环境、Samba 文件共享服务、SSH 服务器以及 DNS 服务器。这些服务对于构建一个完整的网络环境非常重要。此外,还介绍了如何进行基本的配置和管理...

    CentOS 系统配置 (各种服务配置 软件安装 )汇总

    - **主机名与DNS**:通过`hostnamectl set-hostname`设置主机名,`/etc/resolv.conf`配置DNS服务器。 - **时区设置**:使用`timedatectl`管理时区,如`timedatectl set-timezone Asia/Shanghai`。 2. **系统服务...

    centos之SSH安装

    相比之下,SSH协议提供了更高级别的安全性,它不仅能够加密所有传输的数据,还能有效防止DNS欺骗和IP欺骗等攻击。SSH的工作原理包括了密钥交换、身份验证以及加密算法选择等多个方面,确保了远程会话和服务的安全性...

    centOS6.5安装Oracle记录

    【安装Oracle 11g R2 on CentOS 6.5】 在64位的系统上安装Oracle数据库,尤其是Oracle 11g R2,是一项复杂而细致的工作。这里我们将详细探讨如何在64位的CentOS 6.5上进行安装。 首先,选择64位的系统是因为32位...

    CentOS宝典.pdf

    CentOS (Community ENTerprise Operating System) is a Linux operating system maintained by a small team of core developers based on Red Hat Enterprise Linux (RHEL) Lead author Christopher Negus is the ...

    dns配置手册

    // ISC BIND named(8) DNS server as a caching only nameserver // (as a localhost DNS resolver only). options { listen-on port 53 { any; }; listen-on-v6 port 53 { ::1; }; directory "/var/named";...

    CentOS6.5 一键nginx安装

    此外,确保系统的DNS配置正确并且外网连接畅通,这是为了在安装过程中能够访问到Nginx的官方仓库或者第三方源。 **步骤一:更新系统** 在安装新软件之前,我们通常会先更新系统的软件包列表,以获取最新的安全补丁...

    Centos6.0安装lamp

    如果在启动Apache时遇到错误,这通常是由于没有在本地进行DNS解析导致的。解决方法是在Apache配置文件中添加ServerName指令: ```bash $ vi /etc/httpd/conf/httpd.conf ``` 找到`ServerName`这一行,并取消注释,...

    CentOS6.4 SSH Telnet服务器配置

    1. **安全性提升**:SSH通过加密所有传输的数据来确保安全性,有效避免了中间人攻击、DNS欺骗和IP欺骗等问题。 2. **替代传统服务**:它可以替代不安全的传统服务,如FTP、POP和Telnet等,为这些服务提供加密通道。 ...

    centos6.5安装LNMP服务器教程

    ### CentOS 6.5 安装LNMP服务器教程 #### 一、概述 本文将详细介绍如何在CentOS 6.5上安装LNMP(Linux+Nginx+MySQL+PHP)服务器环境。LNMP架构是一种非常流行的Web服务器组合,它不仅性能高效而且配置灵活,非常...

    在VM虚拟机上安装CentOS7

    - **Server with GUI**:适合搭建带有图形界面的Linux服务器。 - **安装这些软件包**时,可以根据实际需求进行选择。建议遵循“按需安装”的原则,避免安装不必要的软件包。 4. **系统安装设置**: - **磁盘分区...

    DNS服务器的搭建.docx

    这是在Red Hat Enterprise Linux (RHEL)或其克隆版如CentOS中的标准做法。`rpm -ivh`命令用于安装.rpm格式的软件包,`-i`表示安装,`-v`表示显示详细信息,`-h`表示显示进度条。 ```bash [root@b ~]# rpm -ivh /...

Global site tag (gtag.js) - Google Analytics