阿骁 回复于:2003-01-13 10:12:55 |
如果你的dns配置好了,自动就会实现你要的功能啊! |
torrent 回复于:2003-01-13 10:16:55 |
不是吧,楼上;应该是使用FORWORD命令来实现。 |
戈壁-胡杨 回复于:2003-01-13 10:27:43 |
#vi/etc/named.conf options { directory "/var/named"; datasize 2098; forward only; forwarders { 99.11.33.44;#第二个解析主机 }; recursion no; transfers-in 10; transfers-per-ns 2; allow-transfer { 127.0.1.1/24; }; }; |
阿骁 回复于:2003-01-13 10:31:44 |
楼上的,如果使用了 forward 指令,那么dns收到用户的查询请求时并不在本机上进行查询解析,而是将查询请求转发到你指定的那台dns server上去! :) (不信,你可以查查bind 的用户手册!) |
laoxia 回复于:2003-01-13 10:42:57 |
[quote][b]下面引用由[u]阿骁[/u]在 [i]2003/01/13 10:31am[/i] 发表的内容:[/b] 楼上的,如果使用了 forward 指令,那么dns收到用户的查询请求时并不在本机上进行查询解析,而是将查询请求转发到你指定的那台dns server上去! :) (不信,你可以查查bind 的用户手册!) [/quote] 本域内的它还解析,超出本域的FORWARD到外边 |
阿骁 回复于:2003-01-13 10:49:03 |
[quote][b]下面引用由[u]laoxia[/u]在 [i]2003/01/13 10:42am[/i] 发表的内容:[/b] 本域内的它还解析,超出本域的FORWARD到外边 [/quote] 对的! |
hanclearcase/" target="_blank" >ccy 回复于:2003-01-13 10:59:17 |
是呀!是这样的!通过实践的!呵呵!阿骁知错了?^-^ |
阿骁 回复于:2003-01-13 11:01:40 |
呵呵 。。。 我是理解错了。 |
hrcxf 回复于:2003-01-13 11:30:56 |
A. 我们的机器环境: Solaris 8 sparc + Bind 8 (Solaris 8 附带) B. IP规划: domain: abc.com DNS Server: solaris8.abc.com 132.254.254.76 网段: 132.254.254.xxx umask 255.255.255.0 客户机器: RedHat 6.2 u2.abc.com 132.254.254.120 SCO unxi5.0.5 sco.abc.com 132.254.254.92 HP-UX 11.0 punk.abc.com 132.254.254.7 win98 kun.abc.com 132.254.254.70 C.配置文件 1.在Solaris8 上建立文件: (这个文件一般需要自己手工输入) /etc/named.conf // // BIND Version 8 configuration file. // options { directory "/etc/named.data"; //用户自己随便定义一个目录 dump-file "/etc/named.data/tmp/named_dump.db"; }; zone "abc.com" in { type master; file "db.abc.com"; }; zone "254.254.132.in-addr.arpa" in { type master; file "db.132.254.254"; }; zone "0.0.127.in-addr.arpa" in { type master; file "db.127.0.0"; }; zone "." in { type hint; file "db.cache"; }; // // // The following file contains real examples of how special BIND 8 // configurations can be created. These configurations will get // appended to the /etc/named.conf file after all of the standard // DNS entries are created. In most cases it will not be necessary // to add anything here, but if it is necessary, here are a couple // of examples. // // server 204.33.116.7 { // transfers 2; // }; // // topology { // 15/8; // 172.88/16; // }; // // 2.Solaris8 上注意修改这个文件/etc/nsswitch.conf # You must also set up the /etc/resolv.conf file for DNS name # server lookup. See resolv.conf(4). hosts: files dns #注意那个dns,必须有哦 3./etc/resolc.conf nameserver 132.254.254.76 #你的DNS server ip domain abc.com #默认的domain 4.编辑 /etc/named.data/127.0.0 @ IN SOA ns.abc.com. ben.abc.com. ( 2000091311 10800 3600 604800 864 00  ![]() IN NS ns.abc.com. IN NS u2.abc.com. 1 IN PTR localhost. 5.编辑 /etc/named.data/db.132.254.254 254.254.132.in-addr.arpa. IN SOA ns.abc.com. ben.abc.com. ( 2000091322 10800 3600 604800 86400  ![]() 254.254.132.in-addr.arpa. IN NS ns.abc.com. 254.254.132.in-addr.arpa. IN NS u2.abc.com. 76.254.254.132.in-addr.arpa. IN PTR solaris8.abc.com. 70.254.254.132.in-addr.arpa. IN PTR kun.abc.com. 77.254.254.132.in-addr.arpa. IN PTR punk.abc.com. 6.编辑 /etc/named.data/db.abc.com //From here.... abc.com.INSOA ns.abc.com. ben.abc.com. ( 2000091328 10800 3600 604800 86400  ![]() madebyunxiaid IN TXT "This map made by unixaid.net" //一个optional,可以不要 abc.com. IN NS ns.abc.com. abc.com. IN MX 20 solaris8.abc.com. localhost IN A 127.0.0.1 solaris8.abc.com. IN A 132.254.254.76 http://www.abc.com./ IN CNAME solaris8.abc.com. //CNAME代表这个是一个机器solaris8.abc.com的别名 kun.abc.com. IN A 132.254.254.70 linux.abc.com. IN CNAME U2.abc.com. ftp.abc.com. IN CNAME solaris8.abc.com. mail.abc.com. IN CNAME solaris8.abc.com. punk.abc.com. IN A 132.254.254.77 u2.abc.com. IN A 132.254.254.120 7.编辑 /etc/named.data/db.cache //From here.... ; 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 registration services ; under anonymous FTP as ; file /domain/named.root ; on server FTP.RS.INTERNIC.NET ; -OR- under Gopher at RS.INTERNIC.NET ; under menu InterNIC Registration Services (NSI) ; submenu InterNIC Registration Archives ; file named.root ; ; last update: Aug 22, 1997 ; related version of root zone: 1997082200 ; ; ; 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 ; ; temporarily housed at NSI (InterNIC) ; . 3600000 NS J.ROOT-SERVERS.NET. J.ROOT-SERVERS.NET. 3600000 A 198.41.0.10 ; ; housed in LINX, operated by RIPE NCC ; . 3600000 NS K.ROOT-SERVERS.NET. K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129 ; ; temporarily housed at ISI (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 D.ok,现在reboot你的机器 #init 6 E.测试你的配置 $/usr/sbin/nslookup Default Server: solaris8.abc.com Address: 132.254.254.76 > u2 Server: solaris8.abc.com Address: 132.254.254.76 Name: u2.abc.com Address: 132.254.254.120 > u2.abc.com Server: solaris8.abc.com Address: 132.254.254.76 Name: u2.abc.com Address: 132.254.254.120 >^D // Ctrl+D 退出nslookup $ F.客户机器上的设置: 1.RedHat 6.2 hostname: u2.abc.com IP: 132.254.254.120 编辑/etc/resolv.conf nameserver 132.254.254.76 domain abc.com 然后测试一下: bash$ nslookup Default Server: solaris8.abc.com Address: 132.254.254.76 > sco Server: solaris8.abc.com Address: 132.254.254.76 Name: dns.hp9000.com Address: 132.254.254.92 Aliases: sco.hp9000.com > punk Server: solaris8.abc.com Address: 132.254.254.76 Name: punk.abc.com Address: 132.254.254.77 >^D bash$ 2.win98 hostname: kun.abc.com IP: 132.254.254.70 tcp ip属性: add DNS: 132.254.254.76 后缀: abc.com reboot win9x 然后测试一下: C:>ping solaris8.abc.com G.几个补充说明 1.doamin: abc.com是我们自己Lan内虚拟的,你其实可以任意命名他 2.我们针对的是目前大家用的比较多的Bind 8.X版本,如果你的机器是: SCO 505 and below Solaris 2.6 and below HP-UX 11.x and below 那么你的随机器带来的Bind 是4.X的,这个版本的named启动文件是/etc/named.boot, 关于他的设置与/etc/named.conf大同小异。 3.不论你使用哪个发行版本的unix,DNS的设置与unix的关系并没有太大的关系 4.目前在网络上有许多基于GUi/WEB的DNS设置软件,如果你感觉自己实在太差,可以使用 这些软件. 5.如果系统启动后,你可以在syslog文件中查看named的日志 Solaris下在/var/adm/messages: ...... Nov 1 17:35:44 solaris8 named[168]: [ID 295310 daemon.notice] starting. in.named BIND 8.1.2 Wed Dec 22 00:01:15 PST 1999 Nov 1 17:35:44 solaris8 named[200]: [ID 295310 daemon.notice] Ready to answer queries. ...... 每次你修改了/etc/named.conf文件,必须reboot named!!! #ps -ef |grep named root 200 1 0 17:35:44 ? 0:00 /usr/sbin/in.named #kill -HUP 200 |
unix菜鸟 回复于:2003-01-13 13:00:23 |
谢谢老大们的指教,我这就去试. |
老鼠(Unix is my Friend) 回复于:2003-03-06 09:17:46 |
分两种,一种是recursive的,一种是non-recursive的。
DNS client发的是non-recursive的,发一个请求,等最后答案。 DNS server发的是recursive请求,每拿到一个中间答案,都要根据这个中间答案去找下一级答案,直到得到最终答案为止,再把最终答案转给client。 最终答案有两种,一是IP地址,一是“没有对应IP”。 用BIND,根据的就是这样的原理,问题中的“省力”方法根本不存在。 希望我的理解是正确的。 |
laoxia 回复于:2003-03-06 09:26:24 |
不是的老鼠,你说的情况对一个internet 上合法的DNS服务器而言是正确的,但楼主
的服务器是LAN上的,请问楼主是否如此? |
jacklions 回复于:2003-03-06 11:27:09 |
[quote:368c17a86c="laoxia"]不是的老鼠,你说的情况对一个internet 上合法的DNS服务器而言是正确的,但楼主
的服务器是LAN上的,请问楼主是否如此?[/quote:368c17a86c] 对LAN是一样的,只要DNS SERVER有外网出口,正确设置网关是可以的,做过实验的,可以。 不过,我对刚才上上面那位贴的中有IN SOA ns.abc.com. ben.abc.com.的ben是什么东东? |
laoxia 回复于:2003-03-06 11:34:41 |
我们是一个意思,可能我表答不清楚:)
ben.abc.com 这向表示如named daemon 出现错误信息,将要发邮件给ben@abc.com ( 没错,在zone file里的格式就是ben.abc.com) |
老鼠(Unix is my Friend) 回复于:2003-03-07 08:35:42 |
[quote:79e84a3401="laoxia"]不是的老鼠,你说的情况对一个internet 上合法的DNS服务器而言是正确的,但楼主
的服务器是LAN上的,请问楼主是否如此?[/quote:79e84a3401] 我所有的内网机器,全部用ISP的DNS server,内部网用hosts。 不好意思,惭愧惭愧。 |
坚持向左 回复于:2003-03-07 08:46:14 |
laoxiao 你说的“本域”是不是指该服务器上所有的区块?请指教。 |
laoxia 回复于:2003-03-07 09:08:03 |
我的意思是,从楼主描述看,他的这个DNS是内网的DNS,即只对内网的这个域abc.com是
authoritative的,而这个内网域是内部自己定义的,并非INTERNET上登记的。这是 这个DNS服务器的第一层的功能。当内部有机器想要解析如host1.abc.com时,这个DNS服 务器就给了authoritative 的答案。 当有机器需要如www.yahoo.com解析时,就不属于内网了,怎么办?可以用forwarder功 能,指向ISP的DNS,或你在外网的其他DNS服务器 forwarder { x.x.x.x;}; 内网DNS接受请求后,如发现不是内网的,可以就forward过去给外网的DNS去解析 |