记录自己的实验过程:
系统类型:centOS6.5
2块网卡,一内网,一公网。 eth0:192.168.1.201 eth1:连接到公网
1、配置yum。
2、安装bind、 bind-libs、 bind-utils、 bind-chroot
$yuminstallbindbind-libsbind-utilsbind-chroot
3、配置named
$vim/etc/named.conf options{ listen-onport53{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*/ recursionyes; forwarders{202.106.0.20;};/*设置DNS转发,用于解析外网域名*/ //forwardersfirst; dnssec-enableyes; dnssec-validationyes; dnssec-lookasideauto; /*PathtoISCDLVkey*/ bindkeys-file"/etc/named.iscdlv.key"; managed-keys-directory"/var/named/dynamic"; }; logging{ channeldefault_debug{ file"data/named.run"; severitydynamic; }; }; zone"."IN{ typehint; file"named.ca"; }; include"/etc/named.rfc1912.zones"; include"/etc/named.root.key";
4、创建域名zone,在
$vim/etc/named.rfc1912.zones zone"test.com"IN{ typemaster; file"test.com.zone"; }; zone"1.168.192.in-addr.arpa"IN{ typemaster; file"1.168.192.zone"; };
添加需要解析的域名。
5、建立域名zone文件。
正向解析:
$cd/var/named/ vimtest.com.zone $TTL86400 @INSOAns.test.com.root( 0 1D 1H 1W 3H) @INNSns.test.com. @INMX5mail.test.com. nsINA192.168.1.201 mailINA192.168.1.201 smtpINA192.168.1.201 pop3INA192.168.1.201 popINA192.168.1.201 wwwINA192.168.1.201
反向解析:
$vim1.168.192.zone $TTL86400 @INSOAns.test.com.root( 0;serial 1D;refresh 1H;retry 1W;expire 3H);minimum @INNSns.test.com. 201INPTRmail.test.com. 201INPTRwww.test.com.
7、检查语法。
$named-checkconf/etc/named.conf $named-checkzonetest.com/var/named/test.com.zone zonetest.com/IN:loadedserial0 OK $/etc/init.d/iptablesstop $setenforce0
8、配置DNS地址。
$vim/etc/resolv.conf nameserver192.168.1.201#本地DNS服务器地址
9、启动、测试named。
$/etc/init.d/namedstart $nslookupwww.test.com Server: 192.168.1.201 Address: 192.168.1.201#53 Name: www.test.com Address:192.168.1.201
OK ,最简单的DNS服务已经搭建完成,第一次写博客,还是新手一枚,记录一下自己的成长过程 (^ ^)。
原文链接:https://www.f2er.com/centos/380423.html