ns1 IN A 192.168.25.188 ns2 IN A 192.168.25.168 abc IN A 192.168.25.188 www IN A 192.168.25.1 mail IN A 192.168.25.2 db IN A 192.168.25.3 ftp IN A 192.168.25.3 proxy IN A 192.168.25.4
2. 启动 DNS
2.1、创建启动文件 /etc/rc.d/init.d/named
#!/bin/sh #
# 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.
[ ${NETWORKING} = \
[ -f /usr/sbin/named ] || exit 0
[ -f /etc/named.conf ] || exit 0
# See how we were called. case \ start)
# Start daemons.
echo -n \ daemon named echo
touch /var/lock/subsys/named
;; stop)
# Stop daemons.
echo -n \ killproc named
rm -f /var/lock/subsys/named echo ;; status)
/usr/sbin/rndc status exit $? ;; restart)
/usr/sbin/rndc restart 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 \ exit 1 esac
exit 0
2.2、创建 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
2.3、启动/停止
$ tail -f /var/log/messages &
$ /etc/rc.d/init.d/named start //Start the name server
$ /etc/rc.d/init.d/named stop //Stop the name server
3. 测试 3.1. 检查
$ sbin/named-checkconf
$ sbin/named-checkzone zonename zonefilename
3.2. nslookup 测试
在LINUX 系统中,测试前必需编辑/etc/resolv.conf 文件: #cd /etc
#vi resolv.conf
search test.com
nameserver 192.168.25.188
然后再用 nslookup测试. # nslookup
Note: nslookup is deprecated and may be removed from future releases. Consider using the `dig' or `host' programs instead. Run nslookup with the `-sil[ent]' option to prevent this message from appearing. >
> set all
Default server: 192.168.25.188 Address: 192.168.25.188#53
Set options:
novc nodebug nod2 search recurse
timeout = 0 retry = 2 port = 53 querytype = A class = IN srchlist = test.com >
> ns1
Server: 192.168.25.188 Address: 192.168.25.188#53
Name: ns1.test.com Address: 192.168.25.188 >
> ns2
Server: 192.168.25.188 Address: 192.168.25.188#53
Name: ns2.test.com Address: 192.168.25.168 >
> www
Server: 192.168.25.188 Address: 192.168.25.188#53
Name: www.test.com Address: 192.168.25.1 >
Server: 192.168.25.188 Address: 192.168.25.188#53
Name: mail.test.com Address: 192.168.25.2 > > db
Server: 192.168.25.188 Address: 192.168.25.188#53
Name: db.test.com Address: 192.168.25.3 >
> ftp
Server: 192.168.25.188 Address: 192.168.25.188#53
Name: ftp.test.com Address: 192.168.25.4 >
> proxy
Server: 192.168.25.188 Address: 192.168.25.188#53
相关推荐: