在Linux下安装bind服务,在Linux系统下安装DNS服务器BIND

BIND是一种开源的DNS(Domain Name System)协议的实现,包含对域名的查询和响应所需的所有软件。它是互联网上最广泛使用的一种DNS服务器,下面讲解在linux系统下如何安装DNS服务器bind。

1.从http://www.isc.org/products/BIND/bind9.html下载bind9的源文件。目前版本为9 .23,源文件为bind-9.2.3.tar.gz。

2.将源文件bind-9.2.3.tar.gz置于/usr/local/src目录下。

3.解压缩源文件bind-9.2.3.tar.gz

# tar -xzvf bind-9.2.3.tar.gz -C /usr/local/src

4.进入安装目录

# cd bind-9.2.3

5.配置、编译

# ./configure

# make

6.安装

# make install

7.生成的可执行文件位于/usr/local/sbin目录下。最重要的可执行文件为named和rndc。

8.创建链接

# ln -s /usr/local/sbin/rndc /usr/sbin/rndc

# ln -s /usr/local/sbin/named /usr/sbin/named

9.创建rndc.conf配置文件。

# /usr/local/sbin/rndc-confgen > /etc/rndc.conf

# cat /etc/rndc.conf

输出为:

# Start of rndc.conf

key "rndc-key" {

algorithm hmac-md5;

secret "y9xvvfQjdWv9f/Fo7wquBg==";

};

options {

default-key "rndc-key";

default-server 127.0.0.1;

default-port 953;

};

# End of rndc.conf

# Use with the following in named.conf, adjusting the allow list as needed:

# key "rndc-key" {

# algorithm hmac-md5;

# secret "y9xvvfQjdWv9f/Fo7wquBg==";

# };

#

# controls {

# inet 127.0.0.1 port 953

# allow { 127.0.0.1; } keys { "rndc-key"; };

# };

# End of named.conf

10.创建rndc.key文件。将rndc.conf文件中注释部分拷贝生成如下文件:

# vi /etc/rndc.key

key "rndc-key" {

algorithm hmac-md5;

secret "y9xvvfQjdWv9f/Fo7wquBg==";

};

controls {

inet 127.0.0.1 port 953

allow { 127.0.0.1; } keys { "rndc-key"; };

};

检查rndc是否正常工作:

#/usr/local/sbin/named -g

Jan 11 11:56:45.075 starting BIND 9.2.3 -g

Jan 11 11:56:45.076 using 1 CPU

Jan 11 11:56:45.079 loading configuration from '/etc/named.conf'

......

#/usr/local/sbin/rndc status

11.创建named.conf配置文件。

# vi /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

//

zone "." IN {

type hint;

file "named.root";

};

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 "domain1.net" IN { //新加domain1.net的域

type master;

file "domain1.net.zone";

allow-update { none; };

};

zone "252.177.61.in-addr.arpa" IN { //新加域的反向解析

type master;

file "named.61.177.252";

allow-update { none; };

};

include "/etc/rndc.key";

12.创建/var/named目录

# mkdir /var/named

# cd /var/named

13.匿名登录到ftp站点FTP.RS.INTERNIC.NET,获取/domain目录下的named.root文件和named.ca文件,将该文件置于/var/named目录下。

14.创建localhost.zone文件

# vi /var/named/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

15.创建named.local文件

# vi 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.

16.创建domain1.net.zone文件

# vi ycmail.net.zone

$TTL 86400

@ IN SOA localhost. root.localhost. (

2003061800 ; Serial

28800 ; Refresh

14400 ; Retry

3600000 ; Expire

86400 ) ; Minimum

IN NS localhost.

mail IN A 61.177.252.34

www IN CNAME mail

17.创建named.61.177.252文件

# vi named.61.177.252

$TTL 86400

@ IN SOA localhost. root.localhost. (

2003061800 ; Serial

28800 ; Refresh

14400 ; Retry

3600000 ; Expire

86400 ) ; Minimum

IN NS localhost.

34 IN PTR mail.domain1.net.

18.创建启动脚本

# vi /etc/rc.d/init.d/named

#!/bin/sh

#

# named This shell script takes care of starting and stopping

# named (BIND DNS server).

#

# chkconfig: 345 55 45

# description: named (BIND) is a Domain Name Server (DNS)

# that is used to resolve host names to IP addresses.

# probe: true

# Source function library.

. /etc/rc.d/init.d/functions

# Source networking configuration.

. /etc/sysconfig/network

# Check that networking is up.

[ $ = "no" ] && exit 0

[ -f /usr/sbin/named ] || exit 0

[ -f /etc/named.conf ] || exit 0

# See how we were called.

case "" in

start)

# Start daemons.

echo -n "Starting named: "

daemon named

echo

touch /var/lock/subsys/named

;;

stop)

# Stop daemons.

echo -n "Shutting down named: "

killproc named

rm -f /var/lock/subsys/named

echo

;;

status)

/usr/sbin/rndc status

exit $?

;;

restart)

stop

start

exit $?

;;

reload)

/usr/sbin/rndc reload

exit $?

;;

probe)

# named knows how to reload intelligently; we don't want linuxconf

# to offer to restart every time

/usr/sbin/rndc reload >/dev/null 2>&1 || echo start

exit 0

;;

*)

echo "Usage: named "

exit 1

esac

exit 0

19.将/etc/rc.d/init.d/named变成可执行文件。

# chmod 755 /etc/rc.d/init.d/named

20.创建启动脚本symbollink

# ln -s /etc/rc.d/init.d/named /etc/rc.d/rc0.d/K45named

# ln -s /etc/rc.d/init.d/named /etc/rc.d/rc1.d/K45named

# ln -s /etc/rc.d/init.d/named /etc/rc.d/rc2.d/K45named

# ln -s /etc/rc.d/init.d/named /etc/rc.d/rc3.d/S55named

# ln -s /etc/rc.d/init.d/named /etc/rc.d/rc4.d/S55named

# ln -s /etc/rc.d/init.d/named /etc/rc.d/rc5.d/S55named

# ln -s /etc/rc.d/init.d/named /etc/rc.d/rc6.d/K45named

21.启动bind9

# /etc/rc.d/init.d/named start

停止bind9

# /etc/rc.d/init.d/named stop

查看状态

# /etc/rc.d/init.d/named status

22.检查配置文件及域文件

# /usr/local/sbin/named-checkconf

# /usr/local/sbin/named-checkzone domain1.net /var/named/domain1.net.zone0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
DNS解析BIND 9(适用于WINDOWS桌面系统) 完全改进: Security Fixes Treat an all zero netmask as invalid when generating the localnets acl to workaround bug on Windows platform. [CVE-2013-6230] [RT #34687] Fix crashes when serving some NSEC3 signed zones. memcpy was incorrectly called with overlapping ranges, resulting in malformed names being generated on some platforms. This could cause INSIST failures. (CVE 2014-0591) [RT #35120] Features Changes Add the ability to specify ndots to "nslookup". [RT #34711] Introduce a new tool "dnssec-importkey" to allow externally-generated DNSKEY to be imported into the DNSKEY management framework. [RT #34698] Check that EDNS subnet client options are well formed. [RT #34718] "named" now preserves the capitalization of names when responding to queries. [RT #34737] Include a comment in .nzf files (used for adding new zones via "rndc"), giving the name of the associated view. [RT #34765] Use separate rate limiting queues for refresh and notify requests. [RT #30589] Adjust when a master server is deemed unreachable to be less aggressive. [RT #27075] Create delegations for all "children" of empty zones except "forward first". [RT #34826] Changed the name of "isc-config.sh" developers script (for outputting compiler and linker flags) to "bind9-config". [RT #23825] Add "dig" option to keep the TCP socket open between successive queries (+[no]keepopen). [RT #34918] Add dns_client_createx2() function to DNS Client API to provide a way to specify the local address for use when sending update packets. [RT #34811] "named-checkconf -z" now checks zones of type hint as well as master. [RT #35046] Update config.guess and config.sub to add support for ppc64le (powerpc 64-bit Little Endian). [RT #35060] Update the Windows build system to support feature selection and WIN64 builds. This is a work in progress. [RT #34160] Add "dnssec-signzone -Q" switch to drop signatures from keys that are still published but no longer active. [RT #34990] Add a more detailed "not found" message to "rndc" commands which specify a zone name. [RT #35059] named will now warn when a zone's configured "key-directory" does not exist or is not a directory. [RT #35108] Added improvements to statistics channel XSL stylesheet: the stylesheet can now be cached by the browser; section headers are omitted from the stats display when there is no data in those sections to be displayed; counters are now right-justified for easier readability. (Only available with ./configure --enable-newstats.) [RT #35117] "named-checkconf" can now obscure shared secrets when printing by specifying '-x'. [RT #34465] "named" can now accept integer timestamps in RRSIG records. [RT #35185] The export-library API call for loading "resolv.conf", irs_resconf_load(), has been modified to return ISC_R_FILENOTFOUND when the file does not exist and initializes the resconf structure as if the file had existed and configured with nameservers at the localhost addresses (127.0.0.1 and ::1). [RT #35194] Bug Fixes Treat type 65533 (KEYDATA) as opaque except when used in a key zone. [RT #34238] Fix "host" and "nslookup" so don't need dot after the domain by checking ndots when searching. Only continue searching on NXDOMAIN responses. [RT #34711] Handle changes to sig-validity-interval settings better. [RT #34625] Fix bug where journal filename string could be set incorrectly, causing garbage in log messages. [RT #34738] Address a race condition when shutting down a zone. [RT #34750] Address race condition with manual notify requests. [RT #34806] Fix nslookup crash where some readline clones don't accept NULL pointers when calling add_history. [RT #34842] Fix Linux compilation issue when libcap-devel is installed. [RT #34838] Fix installation on Solaris -- don't add explicit make dependencies/rules for python programs as make won't use the implicit rules. [RT #34835] Fix hanging server with inline-signed zones by addressing lock order reversal deadlock with inline zones. [RT #34856] Fix "host" failure if a UDP query timed out. [RT #34870] Address bugs in dns_rdata_fromstruct and dns_rdata_tostruct for WKS and ISDN types. [RT #34910] Updated OpenSSL PKCS#11 patches to fix active list locking and other bugs. [RT #34855] Fix a potential hang with failure to release lock on error in receive_secure_db. #34944] Fix cast in lex.c which could see 0xff treated as EOF. This fixes issue with potential bad data in a database used by DLZ or SDB. [RT #34993] Fix build issue on newer FreeBSD needing -lhx509 for GSSAPI build. [RT #35001] Address read after free in server side of lwres_getrrsetbyname. [RT #29075] Fix "nsupdate" memory leak if "realm" was used multiple times. [RT #35073] Fix "dig" for cleaning up TCP sockets still waiting on connect(). [RT #35074] Fix "dnssec-importkey" so imported key won't overwrite an existing non-imported private key. Fix issue where queries covered by a disabled Response Policy Zone (query type was '*') are answered with TTL of 0. [RT #35026] Fix "nsupdate" memory leak if "realm" was used multiple times. [RT #35073] Fix "dig" for cleaning up TCP sockets still waiting on connect(). [RT #35074] Fix issue with "rndc retransfer" with inline-signing replacing NSEC3 with NSEC records. [RT #34745] Fix issue with "rndc refresh" failing to sign slave zones using inline-signing. [RT #35105] Fix potential hang (detected by our inline-signing system test) with null pointer dereference in libdns zone_xfrdone. [RT #35042] Address bug in libdns loadnode function that could return a freed node on out of memory. [RT #35106] Fixed a bug causing an insecure delegation from one "static-stub" zone to another to fail with a broken trust chain. [RT #35081] Fixed problem where iterative responses could be discarded when the "query-source" port for an upstream query was the same as the listener port (53). [RT #34925] Fix crashes in RBTDB implementation. Two calls to dns_db_getoriginnode were fatal if there was no data at the node. [RT #35080] Fix a possible race and crash in the socket_search() function in dispatch.c. [RT #35107] Fix "dig" so it can handle AXFR style IXFR responses which span multiple messages. [RT #35137] Fix a "host" tool problem with converting UTF-8 textname to IDN encoding by handling "." as a search list element when IDN support is enabled. [RT #35133] Fix "queryperf" to prevent a possible integer overflow when printing results. [RT #35182] Prevent a theoretically possible race and crash when obtaining a socket in dispatch.c [RT #35128] Use built-in versions of strptime() and timegm() on all platforms to avoid portability issues. [RT #35183] Fix a bug which could cause a crash when running "rndc reconfig" or "rndc reload" after configuration is changed from regular zones to automatic empty zones. [RT #35177]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值