GB | BIG5
|
| 首頁 > 編程技術 > C/C++ > 正文 |
 |
| Unix編程/應用問答中文版 ---7.DNS相關問題 |
| 本文出自:http://www.nsfocus.com 維護:小四 (2002-10-25 06:02:00) |
7.1 如何進行DNS區傳輸
7.2 如何獲知權威名字服務器
7.3 如何配置DNS的委托解析
7.4 如何獲知BIND的版本號
7.5 Solaris/FreeBSD/Linux如何指定域名解析的順序
--------------------------------------------------------------------------
7. DNS相關問題
7.1 如何進行DNS區傳輸
A: scz <scz@nsfocus.com>
用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 <scz@nsfocus.com>
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 <helmlein@hotmail.com>
dig @<victim_ip> txt chaos version.bind
或者
nslookup
server <victim_ip>
set query=txt
set class=chaos
version.bind
但是這個返回結果可以通過/etc/named.conf自己設置,並不可靠。如果你正在運
行BIND 8,可以執行
/usr/sbin/ndc status
A: backend <backend@nsfocus.com>
#!/bin/sh
# bv (Bind Version) script
# written by backend@nsfocus.com
USAGE="Usage: $0 <address>"
if [ $# -ne 1 ]; then
echo $USAGE
exit
fi
if [ ! -f /usr/bin/dig ]; then
echo -en "\\033[1;31mCan't find \"dig\" program.\\033[0;39m\n\n"
exit
fi
VER=`/usr/bin/dig @$1 version.bind chaos txt | grep "VERSION.BIND"`
if [ "x$VER" = "x" ]; then
echo -en "\\033[1;31mSorry. Can't get BIND version.\\033[0;39m\n\n"
else
echo -en "BIND version of \\033[1;33m$1\\033[0;39m = "
echo -en "\\033[1;33m"
echo $VER | awk '{print $5;}'
echo -en "\\033[0;39m\n"
fi
A: deepin <deepin@nsfocus.com>
很多主機沒有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 \\033[1;33m$1\\033[0;39m = " `echo $VER | awk
'{print $4,$5,$6;}'` "\\033[0;39m\n"
else
echo -en "\\033[1;31mSorry. Can't get BIND version.\\033[0;39m\n\n"
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.fanqiang.com)
進入【UNIX論壇】
|
|
| 相關文章 |
Unix編程/應用問答中文版 ---6./etc/system可調資源限制 (2002-10-24 06:02:00) Unix編程/應用問答中文版 ---5.塊設備相關問題 (2002-10-23 06:02:00) Unix編程/應用問答中文版 ---4.系統資源相關問題 (2002-10-22 06:02:00) Unix編程/應用問答中文版 ---3.-lelf、-lkvm、-lkstat相關問題 (2002-10-21 06:02:01) Unix編程/應用問答中文版 ---2.堆棧相關問題 (2002-10-18 06:02:00) Unix編程/應用問答中文版 ---1.系統管理配置問題 (2002-10-17 06:02:00) Unix編程/應用問答中文版 ---0.簡介 Unix/C傳奇問題 (2002-10-16 06:02:01)
|
|
|
|
 |
★ 樊強制作 歡迎分享 ★ |