您的位置:首页 > 运维架构 > Linux

linux下DNS服务配置

2008-10-27 13:37 661 查看
一,RPM安装DNS
=========================================================================
[root@nyist3 root]# mount /mnt/cdrom
[root@nyist3 root]# cd /mnt/cdrom/RedHat/RPMS
[root@nyist3 RPMS]# rpm -ivh bind-9.2.1-16.i386.rpm
warning: bind-9.2.1-16.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:bind ########################################### [100%]
[root@nyist3 RPMS]# rpm -ivh bind-utils-9.2.1-16.i386.rpm
warning: bind-utils-9.2.1-16.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
package bind-utils-9.2.1-16 is already installed
[root@nyist3 RPMS]# rpm -ivh redhat-config-bind-1.9.0-13.noarch.rpm
warning: redhat-config-bind-1.9.0-13.noarch.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:redhat-config-bind ########################################### [100%]
弹出光盘,安装第二张关盘
[root@nyist3 RPMS]# cd ;eject
[root@nyist3 root]# mount /mnt/cdrom
[root@nyist3 root]# cd /mnt/cdrom/RedHat/RPMS
[root@nyist3 RPMS]# rpm -ivh ca
caching-nameserver-7.2-7.noarch.rpm cadaver-0.20.5-6.i386.rpm
[root@nyist3 RPMS]# rpm -ivh caching-nameserver-7.2-7.noarch.rpm
warning: caching-nameserver-7.2-7.noarch.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:caching-nameserver ########################################### [100%]
[root@nyist3 RPMS]# cd ;eject
=========================================================================
二,查看配置文件
查看根DNS服务器文件
=====================================
[root@nyist3 named]# more named.ca
; This file holds the information on root name servers needed to
; initialize cache of Internet domain name servers
; (e.g. reference this file in the "cache . <file>"
; configuration file of BIND domain name servers).
;
; This file is made available by InterNIC
; under anonymous FTP as
; file /domain/named.cache
; on server FTP.INTERNIC.NET
;
; last update: Nov 5, 2002
; related version of root zone: 2002110501
;
;
; formerly NS.INTERNIC.NET
;
. 3600000 IN NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
;
; formerly NS1.ISI.EDU
;
. 3600000 NS B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107
;
; formerly C.PSI.NET
;
. 3600000 NS C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
;
; formerly TERP.UMD.EDU
;
. 3600000 NS D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
;
; formerly NS.NASA.GOV
;
. 3600000 NS E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
;
; formerly NS.ISC.ORG
;
. 3600000 NS F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
;
; formerly NS.NIC.DDN.MIL
;
. 3600000 NS G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
;
; formerly AOS.ARL.ARMY.MIL
;
. 3600000 NS H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53
;
; formerly NIC.NORDU.NET
;
. 3600000 NS I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
;
; operated by VeriSign, Inc.
;
. 3600000 NS J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30
;
; housed in LINX, operated by RIPE NCC
;
. 3600000 NS K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129
;
; operated by IANA
;
. 3600000 NS L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12
;
; housed in Japan, operated by WIDE
;
. 3600000 NS M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33
; End of File
不需要做出修改的
=====================================
/etc/name.conf
[root@nyist3 root]# more /etc/named.conf
// generated by named-bootconf.pl

options {
directory "/var/named";
/*
* 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 "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};

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

include "/etc/rndc.key";
========================================
要对其进行修改,修改过的文件
========
// generated by named-bootconf.pl

options {
directory "/var/named";
/*
* 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 "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};

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

zone "6.255.10.in-addr.arpa" IN {
type master;
file "fanxiang.local";
allow-update { none; };
};
=====================================
备份配置文件,然后做出修改
============
root@nyist3 named]# cp localhost.zone /root/localhost.zone
[root@nyist3 named]# cp named.local /root/named.local
======================================================
配置文件 /var/named/localhost.zone 正向配置文件
========
[root@nyist3 named]# more localhost.zone
$TTL 86400
$ORIGIN localhost.
@ 1D IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

1D IN NS @
1D IN A 127.0.0.1
==================
反向配置文件
==================
[root@nyist3 named]# more named.local
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.

1 IN PTR localhost.
====================修改过的正向配置文件============
$TTL 86400
$ORIGIN changlinhost.
@ 1D IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

1D IN NS @
1D IN A 10.255.6.12
1D IN A 10.255.6.19
======================================================
===================修改过反向配置文件=================
$TTL 86400
@ IN SOA changlinhost. root.changlinhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.

12 IN PTR localhost.
19 IN PTR www.changlin.com.
=====================================================
三,启动DNS服务并验证服务是不是启动
[root@nyist3 named]# service named start
[root@nyist3 named]# pstree |grep named
|-named
[root@nyist3 named]# rndc status
number of zones: 6
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
server is up and running
===========================
测试成功,DNS设置成功
查看缓存地址命令
===========================
[root@nyist3 named]# rndc dumpdb
[root@nyist3 named]# cat /var/named/named_dump.db
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: