| 您的位置:首页 > 文档 > 编程技术 > |
文章分类热门文章 |
Unix编程/应用问答中文版 ---7.DNS相关问题创建:2005-10-26 16:54:03 作者:Unlinux 来自: http://www.Unlinux.com 本文出自:http://www.nsfocus.com 维护:小四 7.1 如何进行DNS区传输 7.2 如何获知权威名字服务器 7.3 如何配置DNS的委托解析 7.4 如何获知BIND的版本号 7.5 Solaris/FreeBSD/Linux如何指定域名解析的顺序 -------------------------------------------------------------------------- 7. DNS相关问题 7.1 如何进行DNS区传输 A: scz 用nslookup是最普遍适用的 nslookup > server ns.tsinghua.edu.cn > set type=axfr > ls tsinghua.edu.cn [> tsinghua.txt] (方括号里的可选) 有些系统提供了dig命令 dig @ns.tsinghua.edu.cn axfr tsinghua.edu.cn A: lgwu 有些系统提供了host命令,这个命令不太保险 host -l net.tsinghua.edu.cn (后面指定域) host -l ncic.ac.cn 7.2 如何获知权威名字服务器 A: scz nslookup > set query=ns > ncic.ac.cn (获知管辖该域的权威名字服务器) Authoritative answers can be found from: gatekeeper.ncic.ac.cn internet address = 159.226.41.188 > server gatekeeper.ncic.ac.cn > set type=axfr (准备区传输) > ls ncic.ac.cn > ncic.txt 7.3 如何配置DNS的委托解析 Q: 我想把子域DNS解析下放到下面去,在我这里如何配置 A: zhangql@bbs.tsinghua.edu.cn 子域 IN NS <负责子域DNS解析的IP> 7.4 如何获知BIND的版本号 Q: 如何识别当前运行的bind是什么版本 A: M. Zuber dig @ txt chaos version.bind 或者 nslookup server set query=txt set class=chaos version.bind 但是这个返回结果可以通过/etc/named.conf自己设置,并不可靠。如果你正在运 行BIND 8,可以执行 /usr/sbin/ndc status A: backend #!/bin/sh # bv (Bind Version) script # written by backend@nsfocus.com USAGE="Usage: $0 " if [ $# -ne 1 ]; then echo $USAGE exit fi if [ ! -f /usr/bin/dig ]; then echo -en " 33[1;31mCan't find "dig" program. 33[0;39mnn" exit fi VER=`/usr/bin/dig @$1 version.bind chaos txt | grep "VERSION.BIND"` if [ "x$VER" = "x" ]; then echo -en " 33[1;31mSorry. Can't get BIND version. 33[0;39mnn" else echo -en "BIND version of 33[1;33m$1 33[0;39m = " echo -en " 33[1;33m" echo $VER | awk '{print $5;}' echo -en " 33[0;39mn" fi A: deepin 很多主机没有dig,最方便的办法是 nslookup -q=txt -class=chaos version.bind IP-addr 如果要美观一点,所以可以用这样的一个小脚本 #!/bin/sh if [ $# = 0 ];then echo "useage: $0 IP-Addr."; exit 1;fi VER=`nslookup -q=txt -class=chaos version.bind $1 | grep "VERSION.BIND"` if [ $? = 0 ];then echo -en "BIND version of 33[1;33m$1 33[0;39m = " `echo $VER | awk '{print $4,$5,$6;}'` " 33[0;39mn" else echo -en " 33[1;31mSorry. Can't get BIND version. 33[0;39mnn" fi 命令行上直接指定IP,会进行反向域名解析,有可能失败,进入nslookup之后server 指定IP,则无此问题。 7.5 Solaris/FreeBSD/Linux如何指定域名解析的顺序 Q: 如何在Solaris中使/etc/resolv.conf的设置生效 A: cp /etc/nsswitch.dns /etc/nsswitch.conf 或者 vi /etc/nsswitch.conf hosts: files dns Q: FreeBSD中有类似Solaris的/etc/nsswitch.conf的文件吗 A: /etc/host.conf -------------------------------------------------------------------------- # First try the /etc/hosts file hosts # Now try the nameserver next. # 如果不希望做反向域名解析,则注释掉下面这行 # bind # If you have YP/NIS configured, uncomment the next line # nis -------------------------------------------------------------------------- Q: Linux中有类似Solaris的/etc/nsswitch.conf的文件吗 D: /etc/host.conf -------------------------------------------------------------------------- order hosts, bind, nis multi on -------------------------------------------------------------------------- D: rai@SMTH Unix 2001-11-28 09:42 改了/etc/host.conf还是不行,后来试了一下/etc/nsswitch.conf就可以了,Linux 也有这个文件的,必须保证下一行中有dns -------------------------------------------------------------------------- # hosts: db files nisplus nis dns hosts: files nisplus nis dns -------------------------------------------------------------------------- 转载自:http://www.unlinux.com/doc/program/20051026/2442.html 【评论】 【加入收藏夹】 【大 中 小】 【打印】 【关闭】 ※ 相关链接
|