centOS6简单搭建DNS
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centOS6简单搭建DNS相关的知识,希望对你有一定的参考价值。
记录自己的实验过程:
系统类型:centOS6.5
2块网卡,一内网,一公网。 eth0:192.168.1.201 eth1:连接到公网
1、配置yum。
2、安装bind、 bind-libs、 bind-utils、 bind-chroot
$yum install bind bind-libs bind-utils bind-chroot
3、配置named
$vim /etc/named.conf options { listen-on port 53 { any; }; /* 修改为any或者IP地址*/ 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"; allow-query { any; }; /* 修改为any*/ recursion yes; forwarders { 202.106.0.20; }; /* 设置DNS转发,用于解析外网域名*/ // forwarders first; dnssec-enable yes; dnssec-validation yes; dnssec-lookaside auto; /* Path to ISC DLV key */ bindkeys-file "/etc/named.iscdlv.key"; managed-keys-directory "/var/named/dynamic"; }; logging { channel default_debug { file "data/named.run"; severity dynamic; }; }; zone "." IN { type hint; file "named.ca"; }; include "/etc/named.rfc1912.zones"; include "/etc/named.root.key";
4、创建域名zone,在
$vim /etc/named.rfc1912.zones zone "test.com" IN { type master; file "test.com.zone"; }; zone "1.168.192.in-addr.arpa" IN { type master; file "1.168.192.zone"; }; zone "cdn.com" IN { type master; file "cdn.com.zone"; };
添加需要解析的域名。
5、建立域名zone文件。
正向解析:
$cd /var/named/ vim test.com.zone $TTL 86400 @ IN SOA ns.test.com. root ( 0 1D 1H 1W 3H ) @ IN NS ns.test.com. @ IN MX 5 mail.test.com. ns IN A 192.168.1.201 mail IN A 192.168.1.201 smtp IN A 192.168.1.201 pop3 IN A 192.168.1.201 pop IN A 192.168.1.201 www IN A 192.168.1.201
反向解析:
$vim 1.168.192.zone $TTL 86400 @ IN SOA ns.test.com. root ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum @ IN NS ns.test.com. 201 IN PTR mail.test.com. 201 IN PTR www.test.com.
7、检查语法。
$named-checkconf /etc/named.conf $named-checkzone test.com /var/named/test.com.zone zone test.com/IN: loaded serial 0 OK $/etc/init.d/iptables stop $setenforce 0
8、配置DNS地址。
$vim /etc/resolv.conf nameserver 192.168.1.201 #本地DNS服务器地址
9、启动、测试named。
$/etc/init.d/named start $nslookup www.test.com Server: 192.168.1.201 Address: 192.168.1.201#53 Name: www.test.com Address: 192.168.1.201
OK ,最简单的DNS服务已经搭建完成,第一次写博客,还是新手一枚,记录一下自己的成长过程 (^ ^)。
本文出自 “linux” 博客,请务必保留此出处http://share66.blog.51cto.com/8194888/1860654
以上是关于centOS6简单搭建DNS的主要内容,如果未能解决你的问题,请参考以下文章