﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-烂漫时空-文章分类-网络学习</title><link>http://www.blogjava.net/net/category/6160.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 27 Feb 2007 12:37:34 GMT</lastBuildDate><pubDate>Tue, 27 Feb 2007 12:37:34 GMT</pubDate><ttl>60</ttl><item><title> VMware Workstation 装不上FreeBSD</title><link>http://www.blogjava.net/net/articles/27124.html</link><dc:creator>烂漫时空</dc:creator><author>烂漫时空</author><pubDate>Sun, 08 Jan 2006 03:40:00 GMT</pubDate><guid>http://www.blogjava.net/net/articles/27124.html</guid><wfw:comment>http://www.blogjava.net/net/comments/27124.html</wfw:comment><comments>http://www.blogjava.net/net/articles/27124.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/net/comments/commentRss/27124.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/net/services/trackbacks/27124.html</trackback:ping><description><![CDATA[<SPAN class=postbody><FONT face=Tahoma size=2>老是出现这个问题 <BR><BR>*** VMware Workstation internal monitor error *** <BR>NOT_IMPLEMENTED at 400d82 (6030) <BR><BR>Code: 00400d82-0000178e-93a8ffa6-d4a5a3a7-96fc829f-fbe2f3aa-b3e7fe <BR><BR>Please report this problem by selecting menu item Help &gt; VMware on the Web &gt; Request Support, or by going to the Web page "http://www.vmware.com/info?id=8&amp;sn=M1ER8%2dHRW45%2dN0HFP%2d4U0JM&amp;logFile=F%3a%5cProgram%20Files%5cVMware%5cMy%20Virtual%20Machines%5cFreeBSD%5cvmware%2elog&amp;coreLocation=F%3a%5cProgram%20Files%5cVMware%5cMy%20Virtual%20Machines%5cFreeBSD%5cvmware%2dcore%2egz". Please provide us with the log file (F:\Program Files\VMware\My Virtual Machines\FreeBSD\vmware.log) and the core file (F:\Program Files\VMware\My Virtual Machines\FreeBSD\vmware-core.gz). <BR>If the problem is repeatable, please select 'Run with debugging information' in the Options panel of the configuration editor. Then reproduce the incident and file it according to the instructions. <BR><BR>请高手指点一下，再现急等待回复</FONT></SPAN><img src ="http://www.blogjava.net/net/aggbug/27124.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/net/" target="_blank">烂漫时空</a> 2006-01-08 11:40 <a href="http://www.blogjava.net/net/articles/27124.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Zebra基本配置 </title><link>http://www.blogjava.net/net/articles/25756.html</link><dc:creator>烂漫时空</dc:creator><author>烂漫时空</author><pubDate>Wed, 28 Dec 2005 09:25:00 GMT</pubDate><guid>http://www.blogjava.net/net/articles/25756.html</guid><wfw:comment>http://www.blogjava.net/net/comments/25756.html</wfw:comment><comments>http://www.blogjava.net/net/articles/25756.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/net/comments/commentRss/25756.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/net/services/trackbacks/25756.html</trackback:ping><description><![CDATA[<DIV dir=ltr style="TEXT-ALIGN: left"><FONT face="Courier New" size=2><FONT color=#000000><STRONG>前言</STRONG><BR><BR>Zebra是一个路由软件包，提供基于TCP/IP路由服务，支持RIPv1, RIPv2, RIPng, OSPFv2, OSPFv3, BGP- 4,<BR>和 BGP-4+等众多路由协议。Zebra还支持BGP特性路由反射器（Route Reflector）。除了传统的 IPv4路由协议，Zebra也支持IPv6路由协议。如果运行的SNMP守护进程（需要ucd-snmp）支持SMUX协 议，Zebra还能支持路由协议MIBs。<BR><BR>由以上可见，Zebra的确是一个很不错的路由系统，但比起真正的路由器就简直是小儿科，所以网络高手 就当这文章是小孩子过家家吧，而对于象我这样的初学者（特别是没有真实设备或足够设备进行实验） 也不失为一个学习和熟悉路由配置、路由协议的好工具。我没有实际的配置经验，对路由的技术细节也 不是十分清晰，完全是在扔破砖头。希望路由高手指正概念错误。<BR><BR>安装<BR><BR>Zebra目前最新的版本是0.92a，它的安装非常简单，我们只需从</FONT></FONT><A href="http://www.zebra.org%20下载&nbsp;zebra-/" target=_blank><FONT face="Courier New" color=#000000 size=2>http://www.zebra.org 下载<BR>&nbsp;zebra-</FONT></A><FONT face="Courier New" size=2><FONT color=#000000>0.92a.tar.gz，然后执行以下命令安装（本文环境是RedHat7.2）：<BR><BR>shell&gt; tar xzf zebra-0.92a.tar.gz<BR>shell&gt; cd zebra-0.92a<BR>shell&gt; ./configure<BR>shell&gt; make<BR>shell&gt; make install<BR><BR>这样Zebra就安装好了，安装的执行文件：<BR><BR>shell&gt; ls /usr/local/sbin<BR>bgpd&nbsp; ospfd&nbsp; ripd&nbsp; zebra<BR><BR><STRONG>配置文件：</STRONG><BR><BR>shell&gt; ls /usr/local/etc<BR>bgpd.conf.sample&nbsp;&nbsp; ospfd.conf.sample&nbsp; zebra.conf.sample<BR>bgpd.conf.sample2&nbsp; ripd.conf.sample<BR><BR><STRONG>运行</STRONG><BR><BR>编译安装完Zebra后，可以看到有4个可执行文件和5个配置样本文件，我们就使用它的配置样本文件：<BR><BR>shell&gt; cd /usr/local/etc<BR>shell&gt; cp zebra.conf.sample zebra.conf<BR><BR>Zebra的各进程有各自的终端接口或VTY，如果我们需要给连接到它们的端口设置别名的话，在/etc/ services<BR><BR><STRONG>文件添加如下内容：</STRONG><BR><BR>zebrasrv&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2600/tcp&nbsp;&nbsp; # zebra service<BR>zebra&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2601/tcp&nbsp;&nbsp; # zebra vty<BR>ripd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2602/tcp&nbsp;&nbsp; # RIPd vty<BR>ripngd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2603/tcp&nbsp;&nbsp; # RIPngd vty<BR>ospfd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2604/tcp&nbsp;&nbsp; # OSPFd vty<BR>bgpd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2605/tcp&nbsp;&nbsp; # BGPd vty<BR>ospf6d&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2606/tcp&nbsp;&nbsp; # OSPF6d vty<BR><BR>然后就可以启动Zebra了：<BR><BR>shell&gt; zebra -d<BR><BR>这样，Zebra就以守护进程启动了，其它的参数请参考zebra -h。<BR><BR>基本路由配置命令<BR><BR><STRONG>直接用telnet连接：</STRONG><BR><BR>shell&gt; telnet localhost 2601<BR>Trying 127.0.0.1...<BR>Connected to localhost.<BR>Escape character is '^]'.<BR><BR>Hello, this is zebra (version 0.92a).<BR>Copyright 1996-2001 Kunihiro Ishiguro.<BR><BR><BR>User Access Verification<BR><BR>Password:<BR><BR>Zebra会提示输入口令，我们通过/usr/local/etc/zebra.conf可以看到口令是zebra，enable口令也是zebra。<BR><BR>输 入口令zebra，得到路由器用户模式提示符：<BR><BR>Router&gt;<BR><BR>进入特权模式：<BR><BR>Router&gt; en<BR>Password:<BR>Router#<BR><BR>输入一个问号，看看Zebra提供了多少路由命令：<BR><BR>Router# ?<BR>&nbsp; configure&nbsp; Configuration from vty interface<BR>&nbsp; copy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Copy configuration<BR>&nbsp; debug&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debugging functions (see also 'undebug')<BR>&nbsp; disable&nbsp;&nbsp;&nbsp; Turn off privileged mode command<BR>&nbsp; end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End current mode and change to enable mode.<BR>&nbsp; exit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit current mode and down to previous mode<BR>&nbsp; help&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Description of the interactive help system<BR>&nbsp; list&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Print command list<BR>&nbsp; no&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Negate a command or set its defaults<BR>&nbsp; quit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit current mode and down to previous mode<BR>&nbsp; show&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Show running system information<BR>&nbsp; terminal&nbsp;&nbsp; Set terminal line parameters<BR>&nbsp; who&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Display who is on vty<BR>&nbsp; write&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write running configuration to memory, network, or terminal<BR><BR>提供的命令很少，实际路由器好多命令都没有，我们只能用有限的命令投入到无限的实验中去。<BR><BR>Router# sh run<BR><BR>Current configuration:<BR>!<BR>hostname Router<BR>password zebra<BR>enable password zebra<BR>!<BR>interface lo<BR>!<BR>interface eth0<BR>!<BR>line vty<BR>!<BR>end<BR><BR>Zebra把操作系统的网络接口当做路由器的接口，所以在做比较复杂的路由实验，会需要比较多的网卡。<BR><BR>进入全局模式，尽可能把实际可用的配置命令都实验一遍：<BR><BR>Router# conf t<BR>Router(config)#<BR><BR>自己取一个路由器名字：<BR><BR>Router(config)# hostname r1<BR>r1(config)#<BR><BR>Zebra比较简单，登陆口令不是在line下修改，而是直接在全局模式下用password修改<BR><BR>r1(config)# password {password}<BR><BR>Zebra不支持enable secret {password}这种MD5加密口令，只能使用enable password {password}来修改 <BR><BR>enable口令：<BR><BR>r1# conf t<BR>r1(config)# enable password {password}<BR><BR>在路由器配置中加密所有的口令：<BR><BR>r1(config)# service password-encryption<BR><BR></FONT><FONT color=#000000><STRONG>回到特权模式：<BR></STRONG><BR>r1(config)# exit<BR>r1# sh run<BR><BR>Current configuration:<BR>!<BR>hostname r1<BR>password 8 alA5.vcyMAwXQ<BR>enable password 8 ksbxOFN8xcFMc<BR>service password-encryption<BR>!<BR>interface lo<BR>!<BR>interface eth0<BR>!<BR>line vty<BR>!<BR>end<BR><BR>我们看到刚才的明文密码都进行加密了，给我们的实验机也提高安全性。Zebra有一点比较恶心，如果我 们先设置了service password-encryption，然后再修改口令，sh run就发现口令又都是明文的了，但是由于有<BR>service password-encryption，所以就无法登陆了。<BR><BR>去掉会话超时，免得10分钟没有动作，就把我们给踢了。但是在实际的路由器配置中，为安全起见我们 最好还是设上会话超时。<BR><BR>r1# conf t<BR>r1(config)# line vty<BR>r1(config-line)# exec-timeout 0 0<BR><BR>设置日志记录，Zebra可以把日志记录到标准输出、syslog、以及指定输出文件：<BR><BR>r1(config-line)# exit<BR>r1(config)# log stdout<BR>r1(config)# no log stdout<BR>r1(config)# log syslog<BR>r1(config)# no log syslog<BR>r1(config)# log file /usr/local/etc/zebra.log<BR><BR>配置接口IP地址：<BR><BR>r1(config)# int lo<BR>r1(config-if)# ip address 127.0.0.1/8<BR>r1(config-if)# exit<BR>r1(config)# int eth0<BR>r1(config-if)# ip address 192.168.5.121/24<BR><BR>Zebra比较奇怪，不能使用ip address 192.168.5.121 255.255.255.0这种形式设置IP。测试一下，就设置成和Linux中使用的一样。<BR><BR>保存我们刚才的配置：<BR><BR>r1(config-if)# exit<BR>r1(config)# exit<BR>r1# copy run start<BR>Configuration saved to /usr/local/etc/zebra.conf<BR>r1#<BR><BR><BR><STRONG>2、用Zebra做简单的RIP实验</STRONG><BR><BR>RIP是应用较早、使用较普遍的IGP，适用于小型同类网络，是典型的距离向量(distance-vector)协 议。RIP通过广播UDP报文来交换路由信息，每30秒发送一次路由信息更新。RIP提供跳跃计数(hop count)作为尺度来衡量路由距，跳跃计数是一个包到达目标所必须经过的路由器的数目。如果到相同 目标有二个不等速或不同带宽的路由器，但跳跃计数相同，则RIP认为两个路由是等距离的。RIP最多支 持的跳数为15，即在源和目的网间所要经过的最多路由器的数目为15，跳数16表示不可达。RIPv2支持 验证、密钥管理、路由汇总、无类域间路由(CIDR)和变长子网掩码(VLSMs)。<BR><BR>Zebra支持RIPv2，使用ripd程序实现RIP路由功能，但ripd程序需要在zebra程序读取接口信息，所以zebra 一定要在ripd之前启动。由于条件所限，下面的RIP实验是在两台单网卡的RedHat7.2下做的，所以只是 最简单的演示。<BR><BR>按照上面基本配置的方法初始化第一台机器：<BR><BR>shell_1&gt; cd /usr/local/etc<BR>shell_1&gt; cp zebra.conf.sample zebra.conf<BR>shell_1&gt; cp ripd.conf.sample ripd.conf<BR>shell_1&gt; zebra -d<BR><BR>进入zebra设置IP<BR><BR>shell_1&gt; telnet localhost 2601<BR>Password:<BR>Router&gt; en<BR>Password:<BR>Router# conf t<BR>Router(config)# hostname r1<BR>r1(config)# int eth0<BR>r1(config-if)# ip address 192.168.5.121/24<BR>r1(config-if)# ctrl+z<BR>r1# copy run start<BR><BR>进入第一台机器的rip设置<BR><BR>shell_1&gt; ripd -d<BR>shell_1&gt; telnet localhost 2602<BR>Password:<BR>ripd&gt; en<BR>ripd# conf t<BR>ripd(config)# hostname r1_ripd !改个名字好辨认<BR>r1_ripd(config)# router rip !启动rip<BR>r1_ripd(config-router)# network 192.168.5.0/24 !RIPv1是有类别路由协议，RIPv2是无类别路由协议，<BR>Zebra 默认支持RIPv2，指定网络需要子网掩码。<BR><BR>r1的RIP简单配置这样就可用了，下面来检验一下：<BR><BR>r1_ripd# sh ip protocols<BR>Routing Protocol is "rip"<BR>&nbsp; Sending updates every 30 seconds with +/-50%, next due in 3 seconds<BR>&nbsp; Timeout after 180 seconds, garbage collect after 120 seconds<BR>&nbsp; Outgoing update filter list for all interface is not set<BR>&nbsp; Incoming update filter list for all interface is not set<BR>&nbsp; Default redistribution metric is 1<BR>&nbsp; Redistributing:<BR>&nbsp; Default version control: send version 2, receive version 2<BR>&nbsp;&nbsp;&nbsp; Interface&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Send&nbsp; Recv&nbsp;&nbsp; Key-chain<BR>&nbsp;&nbsp;&nbsp; eth0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp; 2<BR>&nbsp; Routing for Networks:<BR>&nbsp;&nbsp;&nbsp; 192.168.5.0/24<BR>&nbsp; Routing Information Sources:<BR>&nbsp;&nbsp;&nbsp; Gateway&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BadPackets BadRoutes&nbsp; Distance Last Update<BR>&nbsp; Distance: (default is 120)<BR><BR>我们看到RIP已经起来了，是RIPv2。<BR><BR>r1_ripd# sh ip rip<BR>Codes: R - RIP, C - connected, O - OSPF, B - BGP<BR><BR>&nbsp;&nbsp; Network&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next Hop&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Metric From&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Time<BR><BR>由于就两个接口直连，没有其它网络，所以sh ip rip看不到什么。<BR><BR>Zebra对log处理可能有些问题，使用log stdout不能显示各种debug信息，所以只能记录到文件，在shell下 用tail命令查看。<BR><BR>r1_ripd# debug rip events<BR>r1_ripd# debug rip packet<BR>r1_ripd(config)# log file /usr/local/etc/ripd.log<BR><BR>然后我们在shell下查看debug信息<BR><BR>shell_1&gt; tail -f /usr/local/etc/ripd.log<BR>--------------------------------8&lt;---------------------------------------<BR>2002/04/28 22:17:44 RIP: update timer fire!<BR>2002/04/28 22:17:44 RIP: SEND UPDATE to eth0 ifindex 2<BR>2002/04/28 22:17:44 RIP: multicast announce on eth0<BR>2002/04/28 22:17:44 RIP: update routes on interface eth0 ifindex 2<BR>2002/04/28 22:18:23 RIP: update timer fire!<BR>2002/04/28 22:18:23 RIP: SEND UPDATE to eth0 ifindex 2<BR>2002/04/28 22:18:23 RIP: multicast announce on eth0<BR>2002/04/28 22:18:23 RIP: update routes on interface eth0 ifindex 2<BR>2002/04/28 22:19:04 RIP: update timer fire!<BR>2002/04/28 22:19:04 RIP: SEND UPDATE to eth0 ifindex 2<BR>2002/04/28 22:19:04 RIP: multicast announce on eth0<BR>2002/04/28 22:19:04 RIP: update routes on interface eth0 ifindex 2<BR>--------------------------------8&lt;---------------------------------------<BR><BR>RIP每隔30秒发送一次更新，在sh ip prot可以看到Sending updates every 30 seconds with +/-50%第二台机器的设置<BR><BR>前面的初始化和第一台一样，不过这里名字设成r2便于辨认，IP设成了192.168.5.123/24。<BR><BR>进入第二台机器的rip设置<BR><BR>shell_2&gt; ripd -d<BR>shell_2&gt; telnet localhost 2602<BR>Password:<BR>ripd&gt; en<BR>ripd# conf t<BR>ripd(config)# hostname r2_ripd<BR>r2_ripd(config)# router rip<BR>r2_ripd(config-router)# network 192.168.5.0/24<BR><BR>执行完network命令，我们看到第一台机器的tail -f /usr/local/etc/ripd.log输出下面的信息：<BR><BR>--------------------------------8&lt;---------------------------------------<BR>2002/04/28 22:19:15 RIP: RECV packet from 192.168.5.123 port 520 on eth0<BR>2002/04/28 22:19:15 RIP: RECV REQUEST version 2 packet size 24<BR>2002/04/28 22:19:15 RIP:&nbsp;&nbsp; 0.0.0.0/0 -&gt; 0.0.0.0 family 0 tag 0 metric 16<BR>2002/04/28 22:19:15 RIP: update routes to neighbor 192.168.5.123<BR>2002/04/28 22:19:35 RIP: update timer fire!<BR>2002/04/28 22:19:35 RIP: SEND UPDATE to eth0 ifindex 2<BR>2002/04/28 22:19:35 RIP: multicast announce on eth0<BR>2002/04/28 22:19:35 RIP: update routes on interface eth0 ifindex 2<BR>--------------------------------8&lt;---------------------------------------<BR><BR>r1通过UDP广播接收到192.168.5.123的更新包，并且把192.168.5.123设为neighbor。<BR><BR>保存一下配置<BR><BR>r1_ripd# copy run start<BR>Configuration saved to /usr/local/etc/ripd.conf<BR>r2_ripd# copy run start<BR>Configuration saved to /usr/local/etc/ripd.conf<BR><BR>Zebra还支持很多RIP功能，如果Filtering RIP Routes, RIP route-map, RIP Authentication等，有条件有时间 的话可以做更复杂的实验。<BR><BR>3、用Zebra做OSPF实验<BR><BR>OSPF（开放最短路径优先）路由协议是一项链路状态型技术，是目前IGP中应用最广、性能最优的一个 协议，解决了RIP不能解决的大型、可扩展的网络需求而写的，适用于大规模的网络。<BR><BR>Zebra支持OSPFv2和OSPFv3（用于IPv6的OSPF，CISCO还未对其封装），由于条件所限，下面的OSPF实 验同样是在两台单网卡的RedHat7.2下做的。<BR>Zebra使用ospfd程序实现OSPF路由功能，但ospfd需要从zebra程序获得接口信息，所以zebra程序必须在 ospfd程序之前运行。ospfd不支持多个OSPF进程，我们不能指定OSPF进程号。<BR><BR>初始化第一台机器：<BR><BR>shell_1&gt; cd /usr/local/etc<BR>shell_1&gt; cp zebra.conf.sample zebra.conf<BR>shell_1&gt; cp ospfd.conf.sample ospfd.conf<BR>shell_1&gt; zebra -d<BR><BR>进入zebra设置IP<BR><BR>shell_1&gt; telnet localhost 2601<BR>Password:<BR>Router&gt; en<BR>Password:<BR>Router# conf t<BR>Router(config)# hostname r1<BR>r1(config)# int eth0<BR>r1(config-if)# ip address 192.168.5.121/24<BR>r1(config-if)# ctrl+z<BR>r1# copy run start<BR><BR>进入第一台机器的ospf设置<BR><BR>shell_1&gt; ospfd -d<BR>shell_1&gt; telnet localhost 2604<BR>Password:<BR>ospfd&gt; en<BR>ospfd# conf t<BR>ospfd(config)# hostname r1_ospfd !改个名字好辨认<BR>r1_ospfd(config)# router ospf !启动ospf<BR>r1_ospfd(config-router)# ospf router-id 192.168.5.121 !设置router-id<BR>r1_ospfd(config-router)# network 192.168.5.0/24 area 0<BR>!最关键的，来标识路由器上哪些IP网络号是OSPF的一部分，对于每个网络，我们必须标识该网络所属 的区域。由于我们只有两台机器，当然只有一个网络，所以只需执行一个network命令就够了。<BR><BR>对于我们的小网络，ospf就算配好了，下面来检验一下：<BR><BR>r1_ospfd(config-router)# ctrl+z<BR>r1_ospfd# sh ip ospf route<BR>============ OSPF network routing table ============<BR>N&nbsp;&nbsp;&nbsp; 192.168.5.0/24&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [10] area: 0.0.0.0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; directly attached to eth0<BR><BR>============ OSPF router routing table =============<BR><BR>============ OSPF external routing table ===========<BR><BR>r1_ospfd# sh ip ospf database<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OSPF Router with ID (192.168.5.121)<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Router Link States (Area 0.0.0.0)<BR><BR>Link ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ADV Router&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Age&nbsp; Seq#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CkSum&nbsp; Link count<BR>192.168.5.121&nbsp;&nbsp; 192.168.5.121&nbsp;&nbsp;&nbsp; 126 0x80000002 0x8584 1<BR><BR>r1_ospfd# sh ip ospf int eth0<BR>eth0 is up, line protocol is up<BR><BR>&nbsp; Internet Address 192.168.5.121/24, Area 0.0.0.0<BR>&nbsp; Router ID 192.168.5.121, Network Type BROADCAST, Cost: 10<BR>&nbsp; Transmit Delay is 1 sec, State DR, Priority 1<BR>&nbsp; Designated Router (ID) 192.168.5.121, Interface Address 192.168.5.121<BR>&nbsp; No backup designated router on this network<BR>&nbsp; Timer intarvals configured, Hello 10, Dead 40, Wait 40, Retransmit 5<BR>&nbsp;&nbsp;&nbsp; Hello due in 00:00:07<BR>&nbsp; Neighbor Count is 0, Adjacent neighbor count is 0<BR><BR>由于网络里没有其它的路由器，r1就把自己选为DR（指定路由器）了。Zebra对log处理可能有些问题，使用log stdout不能显示各种debug信息，所以只能记录到文件，在shell下用tail命令查看。而且debug命令和实际路由器也有不同。<BR><BR>r1_ospfd# debug ospf event<BR>r1_ospfd(config)# log file /usr/local/etc/ospfd.log<BR><BR>然后我们在shell下查看debug信息<BR><BR>shell_1&gt; tail -f /usr/local/etc/ospfd.log<BR>--------------------------------8&lt;---------------------------------------<BR>2002/04/28 14:24:27 OSPF: make_hello: options: 2, int: eth0:192.168.5.121<BR>2002/04/28 14:24:37 OSPF: make_hello: options: 2, int: eth0:192.168.5.121<BR>2002/04/28 14:24:47 OSPF: make_hello: options: 2, int: eth0:192.168.5.121<BR>2002/04/28 14:24:57 OSPF: make_hello: options: 2, int: eth0:192.168.5.121<BR>2002/04/28 14:25:07 OSPF: make_hello: options: 2, int: eth0:192.168.5.121<BR>--------------------------------8&lt;---------------------------------------<BR><BR>我们错过了最开始的信息，看到路由器每隔10秒发送一个hello数据包。hello数据包通过多目组播地址224.0.0.5被发送出去，如果我们打开debug ospf packet all就能很清楚的看到。<BR><BR>第二台机器的设置<BR><BR>前面的初始化和第一台一样，不过这里名字设成r2便于辨认，IP设成了192.168.5.123/24。<BR><BR>进入第二台机器的ospf设置<BR><BR>shell_2&gt; ospfd -d<BR>shell_2&gt; telnet localhost 2604<BR>Password:<BR>ospfd&gt; en<BR>ospfd# conf t<BR>ospfd(config)# hostname r2_ospfd<BR>r2_ospfd(config)# router ospf<BR>r2_ospfd(config-router)# ospf router-id 192.168.5.123<BR>r2_ospfd(config-router)# network 192.168.5.0/24 area 0<BR><BR>执行完network命令，我们看到第一台机器的tail -f /usr/local/etc/ospfd.log输出下面的信息：<BR><BR>--------------------------------8&lt;---------------------------------------<BR>2002/04/28 14:25:51 OSPF: Packet 192.168.5.123 [Hello:RECV]: Options *|*|-|-|-|-|E|*<BR>2002/04/28 14:25:51 OSPF: NSM[eth0:192.168.5.121:0.0.0.0]: start<BR>2002/04/28 14:25:52 OSPF: make_hello: options: 2, int: eth0:192.168.5.121<BR>2002/04/28 14:25:52 OSPF: couldn't find any VL to associate the packet with<BR>2002/04/28 14:25:52 OSPF: DR-Election[1st]: Backup 192.168.5.123<BR>2002/04/28 14:25:52 OSPF: DR-Election[1st]: DR&nbsp;&nbsp;&nbsp;&nbsp; 192.168.5.121<BR>2002/04/28 14:25:52 OSPF: Packet[DD]: Negotiation done (Slave).<BR>--------------------------------8&lt;---------------------------------------<BR><BR>r1收到r2(192.168.5.123)发过来的hello数据包，交换信息后选举DR，由于本身192.168.5.121是DR了，所以 <BR><BR>只选举了BDR就好了。这时在r1上就能看到r2了。<BR><BR>r1_ospfd# sh ip ospf neig<BR><BR>Neighbor ID&nbsp;&nbsp;&nbsp;&nbsp; Pri&nbsp;&nbsp; State&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dead Time&nbsp;&nbsp; Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Interface&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RXmtL <BR><BR>RqstL DBsmL<BR>192.168.5.123&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp; Full/Backup&nbsp;&nbsp;&nbsp;&nbsp; 00:00:37&nbsp;&nbsp;&nbsp; 192.168.5.123&nbsp;&nbsp; eth0:192.168.5.121&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; <BR><BR>&nbsp;&nbsp; 0<BR><BR>检验其它信息<BR><BR>r1_ospfd# sh ip ospf database<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OSPF Router with ID (192.168.5.121)<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Router Link States (Area 0.0.0.0)<BR><BR>Link ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ADV Router&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Age&nbsp; Seq#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CkSum&nbsp; Link count<BR>192.168.5.121&nbsp;&nbsp; 192.168.5.121&nbsp;&nbsp; 1259 0x80000008 0x534e 1<BR>192.168.5.123&nbsp;&nbsp; 192.168.5.123&nbsp;&nbsp; 1265 0x80000006 0x534a 1<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Net Link States (Area 0.0.0.0)<BR><BR>Link ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ADV Router&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Age&nbsp; Seq#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CkSum<BR>192.168.5.123&nbsp;&nbsp; 192.168.5.123&nbsp;&nbsp; 1265 0x80000001 0x5a5a<BR><BR>r1_ospfd# sh ip ospf int eth0<BR>eth0 is up, line protocol is up<BR><BR>&nbsp; Internet Address 192.168.5.121/24, Area 0.0.0.0<BR>&nbsp; Router ID 192.168.5.121, Network Type BROADCAST, Cost: 10<BR>&nbsp; Transmit Delay is 1 sec, State DR, Priority 1<BR>&nbsp; Designated Router (ID) 192.168.5.121, Interface Address 192.168.5.121<BR>&nbsp; Backup Designated Router (ID) 192.168.5.123, Interface Address 192.168.5.123<BR>&nbsp; Timer intarvals configured, Hello 10, Dead 40, Wait 40, Retransmit 5<BR>&nbsp;&nbsp;&nbsp; Hello due in 00:00:01<BR>&nbsp; Neighbor Count is 1, Adjacent neighbor count is 1<BR><BR>和前面的输出信息相比，发生了很多变化，两台路由器已经相互识别了。OSPF不象RIP一样，每隔30秒 给所有的邻居广播一次完整的路由表，而是通过IP多目组播地址224.0.0.5每隔10秒发送一个很小的hello 数据包来维护邻居关系，当链路发生变化的时候，才重新计算。<BR><BR>拔掉两台机器连接的网线，看ospfd.log的记录：<BR><BR>--------------------------------8&lt;---------------------------------------<BR>2002/04/28 16:25:53 OSPF: make_hello: options: 2, int: eth0:192.168.5.121<BR>2002/04/28 16:25:57 OSPF: Packet 192.168.5.123 [Hello:RECV]: Options *|*|-|-|-|-|E|*<BR>2002/04/28 16:26:03 OSPF: make_hello: options: 2, int: eth0:192.168.5.121<BR>2002/04/28 16:26:13 OSPF: make_hello: options: 2, int: eth0:192.168.5.121<BR>2002/04/28 16:26:23 OSPF: make_hello: options: 2, int: eth0:192.168.5.121<BR>2002/04/28 16:26:33 OSPF: make_hello: options: 2, int: eth0:192.168.5.121<BR>2002/04/28 16:26:37 OSPF: ospf_check_abr_status(): Start<BR>2002/04/28 16:26:37 OSPF: ospf_check_abr_status(): looked through areas<BR>2002/04/28 16:26:37 OSPF: ospf_check_abr_status(): bb_configured: 1<BR>2002/04/28 16:26:37 OSPF: ospf_check_abr_status(): bb_act_attached: 1<BR>2002/04/28 16:26:37 OSPF: ospf_check_abr_status(): areas_configured: 1<BR>2002/04/28 16:26:37 OSPF: ospf_check_abr_status(): areas_act_attached: 1<BR>2002/04/28 16:26:37 OSPF: nsm_change_status(): scheduling new router-LSA origination<BR>2002/04/28 16:26:37 OSPF: DR-Election[1nd]: Backup 0.0.0.0<BR>2002/04/28 16:26:37 OSPF: DR-Election[1nd]: DR&nbsp;&nbsp;&nbsp;&nbsp; 192.168.5.121<BR>2002/04/28 16:26:37 OSPF: ospf_check_abr_status(): Start<BR>2002/04/28 16:26:37 OSPF: ospf_check_abr_status(): looked through areas<BR>2002/04/28 16:26:37 OSPF: ospf_check_abr_status(): bb_configured: 1<BR>2002/04/28 16:26:37 OSPF: ospf_check_abr_status(): bb_act_attached: 1<BR>2002/04/28 16:26:37 OSPF: ospf_check_abr_status(): areas_configured: 1<BR>2002/04/28 16:26:37 OSPF: ospf_check_abr_status(): areas_act_attached: 1<BR>2002/04/28 16:26:37 OSPF: Timer[router-LSA]: (router-LSA Refresh expire)<BR>2002/04/28 16:26:37 OSPF: counting fully adjacent virtual neighbors in area 0.0.0.0<BR>2002/04/28 16:26:37 OSPF: there are 0 of them<BR>2002/04/28 16:26:37 OSPF: SPF: calculation timer scheduled<BR>2002/04/28 16:26:37 OSPF: SPF: calculation timer delay = 5<BR>2002/04/28 16:26:37 OSPF: ospf_flood_through_interface(): considering int eth0:192.168.5.121<BR>2002/04/28 16:26:37 OSPF: ospf_flood_through_interface(): considering nbr 192.168.5.121<BR>2002/04/28 16:26:42 OSPF: SPF: Timer (SPF calculation expire)<BR>2002/04/28 16:26:42 OSPF: ospf_spf_calculate: Start<BR>2002/04/28 16:26:42 OSPF: ospf_spf_calculate: running Dijkstra for area 0.0.0.0<BR>2002/04/28 16:26:42 OSPF: SPF Result: 0 [R] 192.168.5.121<BR>2002/04/28 16:26:42 OSPF: ========== OSPF routing table ==========<BR>2002/04/28 16:26:42 OSPF: ========================================<BR>2002/04/28 16:26:42 OSPF: ospf_process_stub():processing stubs for area 0.0.0.0<BR>2002/04/28 16:26:42 OSPF: ospf_process_stub():processing router LSA, id: 192.168.5.121<BR>2002/04/28 16:26:42 OSPF: ospf_process_stub(): we have 1 links to process<BR>2002/04/28 16:26:42 OSPF: ospf_intra_add_stub(): Start<BR>2002/04/28 16:26:42 OSPF: ospf_intra_add_stub(): processing route to 192.168.5.0/24<BR>2002/04/28 16:26:42 OSPF: ospf_intra_add_stub(): calculated cost is 0 + 10 = 10<BR>2002/04/28 16:26:42 OSPF: ospf_intra_add_stub(): installing new route<BR>2002/04/28 16:26:42 OSPF: ospf_intra_add_stub(): this network is on this router<BR>2002/04/28 16:26:42 OSPF: ospf_intra_add_stub(): the interface is eth0:192.168.5.121<BR>2002/04/28 16:26:42 OSPF: ospf_intra_add_stub(): Stop<BR>2002/04/28 16:26:42 OSPF: children of V:<BR>2002/04/28 16:26:42 OSPF: ospf_spf_calculate: Stop<BR>2002/04/28 16:26:42 OSPF: ospf_ia_routing():start<BR>2002/04/28 16:26:42 OSPF: ospf_ia_routing():not ABR, considering all areas<BR>2002/04/28 16:26:42 OSPF: Pruning unreachable networks<BR>2002/04/28 16:26:42 OSPF: Pruning unreachable routers<BR>2002/04/28 16:26:42 OSPF: Route: Router Routing Table free<BR>2002/04/28 16:26:42 OSPF: SPF: calculation complete<BR>--------------------------------8&lt;---------------------------------------<BR><BR>我们看到r1生成一个LSA包，通知其它路由器，由于网络里只有自己了，又选自己为DR。r2也是一样。 我们再插上网线，查看ospfd.log：<BR><BR>--------------------------------8&lt;---------------------------------------<BR>2002/04/28 16:52:08 OSPF: Packet 192.168.5.123 [Hello:RECV]: Options *|*|-|-|-|-|E|*<BR>2002/04/28 16:52:08 OSPF: NSM[eth0:192.168.5.121:0.0.0.0]: start<BR>2002/04/28 16:52:08 OSPF: DR-Election[1st]: Backup 192.168.5.123<BR>2002/04/28 16:52:08 OSPF: DR-Election[1st]: DR&nbsp;&nbsp;&nbsp;&nbsp; 192.168.5.121<BR>2002/04/28 16:52:08 OSPF: DR-Election[1st]: Backup 0.0.0.0<BR>2002/04/28 16:52:08 OSPF: DR-Election[1st]: DR&nbsp;&nbsp;&nbsp;&nbsp; 192.168.5.123<BR>2002/04/28 16:52:08 OSPF: DR-Election[2nd]: Backup 192.168.5.121<BR>2002/04/28 16:52:08 OSPF: DR-Election[2nd]: DR&nbsp;&nbsp;&nbsp;&nbsp; 192.168.5.123<BR>--------------------------------8&lt;---------------------------------------<BR><BR>由于拔了网线，r1和r2都把自己选为DR，一个网络只能有一个DR，所以恢复连接后它们重新进行了DR选 举，由于192.168.5.123的router id大，所以它被选为DR。<BR><BR>保存一下配置<BR><BR>r1_ospfd# copy run start<BR>Configuration saved to /usr/local/etc/ospfd.conf<BR>r2_ospfd# copy run start<BR>Configuration saved to /usr/local/etc/ospfd.conf<BR><BR>以上只是演示了最简单的OSPF的配置，而OSPF在大型网络才广泛的使用，配置也复杂多很多。即使是 Zebra，也还可用做复杂的多的OSPF实验。<BR><BR>4、用Zebra做BGP实验<BR><BR>RIP和OSPF都是内部网关协议（IGP），BGP属于外部网关协议（EGP）。BGP广泛用于Internet以连接 ISP，并将企业与ISP互连。<BR><BR>当BGP的影响被完全了解，并且至少下列情况之一存在时，在AS中使用BGP才是最恰当的：<BR>&nbsp; 1 AS允许数据包穿过它到达其它自治系统（例如，某个服务提供商）。<BR>&nbsp; 2 AS有到其它自治系统的多条连接。<BR>&nbsp; 3 必须对进入和离开AS的数据流进行控制。<BR><BR>对于互连的自治系统来说，BGP并不总是恰当的解决方案，如果有如下情况中的一个或多个时，不要使 用BGP：<BR>&nbsp; 1 只有到Internet或另一AS的单一连接。<BR>&nbsp; 2 无需考虑路由策略或路由选择。<BR>&nbsp; 3 路由器缺乏经常性的BGP更新的内存或处理器。<BR>&nbsp; 4 对路由过滤和BGP路径选择过程的了解十分有限。<BR>&nbsp; 5 在自治系统间的带宽较低。<BR>在这些情况下，应该使用静态路由。<BR><BR>Zebra支持BGP-4和BGP-4+，下面实验只是演示BGP的基本命令，以及debug的一些信息。一个比较复杂 的用Zebra做BGP实验见</FONT><A href="http://www.unixreview.com/print/documentID=15977"><FONT color=#000000>http://www.unixreview.com/print/documentID=15977</FONT></A><FONT color=#000000>，有条件可以做一下。<BR><BR>Zebra使用bgpd程序实现BGP路由功能，但bgpd需要从zebra程序获得接口信息，所以zebra程序必须在 bgpd程序之前运行。<BR><BR>初始化第一台机器：<BR><BR>shell_1&gt; cd /usr/local/etc<BR>shell_1&gt; cp zebra.conf.sample zebra.conf<BR>shell_1&gt; cp bgpd.conf.sample bgpd.conf<BR>shell_1&gt; zebra -d<BR><BR>还有一个bgpd.conf.sample2配置样例是用于IPv6的。<BR><BR>进入zebra设置IP<BR><BR>shell_1&gt; telnet localhost 2601<BR>Password:<BR>Router&gt; en<BR>Password:<BR>Router# conf t<BR>Router(config)# hostname r1<BR>r1(config)# int eth0<BR>r1(config-if)# ip address 192.168.5.121/24<BR>r1(config-if)# ctrl+z<BR>r1# copy run start<BR><BR>进入第一台机器的bgp设置<BR><BR>shell_1&gt; bgpd -d<BR><BR>启动bgpd，我们看到TCP端口179已经打开。两台BGP路由器相互间建立一条TCP连接，交换消息以打开 和确认连接参数。这两台路由器被称为对等路由器，或者邻居。<BR><BR>shell_1&gt; telnet localhost 2605<BR>Password:<BR>bgpd&gt; en<BR>bgpd# conf t<BR>bgpd(config)# hostname r1_bgpd<BR>r1_bgpd(config)# router bgp 7675<BR><BR>配置样例里已经指定了AS为7675，我们懒的改就拿来用。AS是一个16bit的数字，其范围从1到 65535。RFC 1930给出了AS编号使用指南。从64512到65535的AS编号范围是留作私用的，类似私有IP。<BR><BR>r1_bgpd(config-router)# network 192.168.5.0/24<BR>r1_bgpd(config-router)# neighbor 192.168.5.121 remote-as 7676<BR><BR>查看bgp信息：<BR><BR>r1_bgpd# sh ip bgp<BR>BGP table version is 0, local router ID is 192.168.5.123<BR>Status codes: s suppressed, d damped, h history, * valid, &gt; best, i - internal<BR>Origin codes: i - IGP, e - EGP, ? - incomplete<BR><BR>&nbsp;&nbsp; Network&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next Hop&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Metric LocPrf Weight Path<BR>*&gt; 192.168.5.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.0.0.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 32768 i<BR><BR>Total number of prefixes 1<BR><BR>把log记录到文件：<BR><BR>r1_bgpd# conf t<BR>r1_bgpd(config)# log file /usr/local/etc/bgpd.log<BR><BR>打开debug选项：<BR><BR>r1_bgpd(config)# exit<BR>r1_bgpd debug bgp events<BR>r1_bgpd debug bgp keepalives<BR>r1_bgpd debug bgp updates<BR><BR>然后在shell下用tail查看log记录：<BR><BR>shell_1&gt; tail -f /usr/local/etc/bgpd.log<BR>--------------------------------8&lt;---------------------------------------<BR>2002/04/29 19:13:08 BGP: 192.168.5.121 [Event] Connect start to 192.168.5.121 fd 10<BR>2002/04/29 19:13:11 BGP: 192.168.5.121 [Event] Connect failed (Operation now in progress)<BR>--------------------------------8&lt;---------------------------------------<BR><BR>r1不能连接邻居192.168.5.121。<BR><BR>第二台机器的设置<BR><BR>前面的初始化和第一台一样，不过这里名字设成r2便于辨认，IP设成了192.168.5.123/24。<BR><BR>进入第二台机器的bgp设置<BR><BR>shell_2&gt; bgpd -d<BR>shell_2&gt; telnet localhost 2605<BR>Password:<BR>bgpd&gt; en<BR>bgpd# conf t<BR>bgpd(config)# hostname r2_bgpd<BR><BR>AS要设成不一样，所以修改一下：<BR><BR>r2_bgpd(config)# no router bgp 7675<BR>r2_bgpd(config)# router bgp 7676<BR>r2_bgpd(config-router)# network 192.168.5.0/24<BR>r2_bgpd(config-router)# neighbor 192.168.5.123 remote-as 7675<BR><BR>这时第一台机器的log出现如下信息：<BR><BR>--------------------------------8&lt;---------------------------------------<BR>2002/04/29 19:16:35 BGP: [Event] BGP connection from host 192.168.5.121<BR>2002/04/29 19:16:35 BGP: [Event] Make dummy peer structure until read Open packet<BR>2002/04/29 19:16:35 BGP: 192.168.5.121 [Event] Transfer temporary BGP peer to existing one<BR>2002/04/29 19:16:35 BGP: 192.168.5.121 [Event] Accepting BGP peer delete<BR>2002/04/29 19:16:35 BGP: 192.168.5.121 send UPDATE 192.168.5.0/24 nexthop 192.168.5.123, origin <BR><BR>i, path<BR>2002/04/29 19:16:35 BGP: 192.168.5.121 rcvd UPDATE w/ attr: nexthop 192.168.5.121, origin i, path <BR><BR>7676<BR>2002/04/29 19:16:35 BGP: 192.168.5.121 rcvd 192.168.5.0/24<BR>--------------------------------8&lt;---------------------------------------<BR><BR>两台bgp已经互连了。再看一下第一台机器的bgp信息：<BR><BR>r1_bgpd# sh ip bgp<BR>BGP table version is 0, local router ID is 192.168.5.123<BR>Status codes: s suppressed, d damped, h history, * valid, &gt; best, i - internal<BR>Origin codes: i - IGP, e - EGP, ? - incomplete<BR><BR>&nbsp;&nbsp; Network&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next Hop&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Metric LocPrf Weight Path<BR>*&nbsp; 192.168.5.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 192.168.5.121&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 7676 i<BR>*&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.0.0.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 32768 i<BR><BR>Total number of prefixes 1<BR><BR>r1_bgpd# sh ip bgp neighbors<BR>BGP neighbor is 192.168.5.121, remote AS 7676, local AS 7675, external link<BR>&nbsp; BGP version 4, remote router ID 192.168.5.121<BR>&nbsp; BGP state = Established, up for 00:01:13<BR>&nbsp; Last read 00:00:13, hold time is 180, keepalive interval is 60 seconds<BR>&nbsp; Neighbor capabilities:<BR>&nbsp;&nbsp;&nbsp; Route refresh: advertised and received (old and new)<BR>&nbsp;&nbsp;&nbsp; Address family IPv4 Unicast: advertised and received<BR>&nbsp; Received 98 messages, 0 notifications, 0 in queue<BR>&nbsp; Sent 103 messages, 0 notifications, 0 in queue<BR>&nbsp; Route refresh request: received 0, sent 0<BR>&nbsp; Minimum time between advertisement runs is 0 seconds<BR><BR>For address family: IPv4 Unicast<BR>&nbsp; Community attribute sent to this neighbor (both)<BR>&nbsp; 1 accepted prefixes<BR><BR>&nbsp; Connections established 2; dropped 1<BR>Local host: 192.168.5.123, Local port: 179<BR>Foreign host: 192.168.5.121, Foreign port: 1029<BR>Nexthop: 192.168.5.123<BR>Read thread: on&nbsp; Write thread: off<BR><BR>Zebra还支持很多BGP的特性，请参考GNU Zebra Manual，有条件的可以做一下那些实验。<BR><BR>Zebra的Mailing List比较活跃，有许多人在那里讨论Zebra的开发和配置等等，有问题的话，在那里应该 能得到解答。<BR><BR><STRONG>Reference</STRONG><BR><BR>GNU Zebra Manual<BR>http://www.pointless.net/~jasper/zebra-html/zebra_toc.html#SEC_Contents<BR><BR>组建可扩展的Cisco网络<BR></FONT><A href="http://www.unixreview.com/print/documentID=15977"><FONT color=#000000>http://www.unixreview.com/print/documentID=15977</FONT></A></FONT></DIV><img src ="http://www.blogjava.net/net/aggbug/25756.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/net/" target="_blank">烂漫时空</a> 2005-12-28 17:25 <a href="http://www.blogjava.net/net/articles/25756.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DNS Bind安装与配置</title><link>http://www.blogjava.net/net/articles/24583.html</link><dc:creator>烂漫时空</dc:creator><author>烂漫时空</author><pubDate>Mon, 19 Dec 2005 03:05:00 GMT</pubDate><guid>http://www.blogjava.net/net/articles/24583.html</guid><wfw:comment>http://www.blogjava.net/net/comments/24583.html</wfw:comment><comments>http://www.blogjava.net/net/articles/24583.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/net/comments/commentRss/24583.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/net/services/trackbacks/24583.html</trackback:ping><description><![CDATA[<P><FONT color=#000000><STRONG><BR><FONT size=2>一.、Bind 简介。</FONT></STRONG></FONT></P>
<P><FONT color=#000000 size=2>&nbsp;&nbsp;&nbsp; Bind是一款开放源码的DNS服务器软件，Bind由美国加州大学Berkeley分校开发和维护的，全名为Berkeley Internet Name Domain它是目</FONT></P>
<P><FONT color=#000000 size=2>前世界上使用最为广泛的DNS服务器软件，支持各种unix平台和windows平台。本文将介绍它在Red hat Linux 9中最基本的安装和配置。</FONT></P>
<P><FONT color=#000000 size=2><STRONG>二.、软件的相关资源。</STRONG></FONT></P>
<P><FONT color=#000000 size=2>官方网站：</FONT><A href="http://www.bind.com/"><FONT color=#000000 size=2>http://www.bind.com/</FONT></A><FONT color=#000000 size=2> </FONT></P>
<P><FONT color=#000000 size=2>源码软件包：Bind 是开源的软件，可以去其官方网站下载。</FONT><A href="http://www.isc.org/index.pl/sw/bind/"><FONT color=#000000 size=2>http://www.isc.org/index.pl/sw/bind/</FONT></A><FONT color=#000000 size=2> ，目前最新版本为bind-9.3.1。</FONT></P>
<P><FONT color=#000000 size=2>帮助文档：</FONT><A href="http://www.isc.org/index.pl/sw/bind/"><FONT color=#000000 size=2>http://www.isc.org/index.pl/sw/bind/</FONT></A><FONT color=#000000 size=2> 有该软件比较全面的帮助文档。</FONT></P>
<P><FONT color=#000000 size=2>FAQ：</FONT><A href="http://www.isc.org/index.pl/sw/bind/"><FONT color=#000000 size=2>http://www.isc.org/index.pl/sw/bind/</FONT></A><FONT color=#000000 size=2> 回答了该软件的常见问题。</FONT></P>
<P><FONT color=#000000 size=2>配置文件样例：</FONT><A href="http://www.bind.com/bind.html"><FONT color=#000000 size=2>http://www.bind.com/bind.html</FONT></A><FONT color=#000000 size=2> 一些比较标准的配置文件样例。</FONT></P>
<P><FONT color=#000000 size=2><STRONG>三.、软件的安装。</STRONG></FONT></P>
<P><FONT color=#000000 size=2>1.安装</FONT></P>
<P><FONT color=#000000 size=2>由其官方网站中下载其源码软件包bind-9.3.1. tar.gz。接下来我将对安装过程的一些重要步骤，给出其解释：<BR>[root@localhost root]#tar xzvf bind-9.3.1. tar.gz<BR>[root@localhost root]#cd bind-9.3.1<BR>[root@localhost bind-9.3.1]#./configure <BR>[root@localhost bind-9.3.1]#make<BR>[root@localhost bind-9.3.1]#make install<BR>tar xzvf bind-9.3.1.tar.gz 解压缩软件包。 </FONT></P>
<P><FONT color=#000000 size=2>/configure 针对机器作安装的检查和设置，大部分的工作是由机器自动完成的，但是用户可以通过一些参数来完成一定的设置，其常用选项有</FONT></P>
<P><FONT color=#000000 size=2>： </FONT></P>
<P><FONT color=#000000 size=2>/configure --help 察看参数设置帮助。 </FONT></P>
<P><FONT color=#000000 size=2>--prefix= 指定软件安装目录（默认/usr/local/）。 </FONT></P>
<P><FONT color=#000000 size=2>--enable-ipv6 支持ipv6。 </FONT></P>
<P><FONT color=#000000 size=2>可以设置的参数很多，可以通过 -help察看需要的，一般情况下，默认设置就可以了。 </FONT></P>
<P><FONT color=#000000 size=2></FONT>&nbsp;</P>
<P><FONT color=#000000 size=2>默认情况下，安装过程是不会建立配置文件和一些默认的域名解析的，不过并不妨碍，可以从下载一些标准的配置文件（</FONT><A href="http://www.bind.com/"><FONT color=#000000 size=2>http://www.bind.com</FONT></A></P>
<P><FONT color=#000000 size=2>/bind.html），也可以使用本文所提供的样例文件。 </FONT></P>
<P><FONT color=#000000 size=2></FONT>&nbsp;</P>
<P><FONT color=#000000 size=2>默认情况下，安装的deamon为/usr/local/sbin/named </FONT></P>
<P><FONT color=#000000 size=2>默认的主配置文件，/etc/named.conf（须手动建立）。 </FONT></P>
<P><FONT color=#000000 size=2></FONT>&nbsp;</P>
<P><FONT color=#000000 size=2>2.启动：</FONT></P>
<P><FONT color=#000000 size=2>[root@localhost root]# /usr/local/sbin/named -g</FONT></P>
<P><FONT color=#000000 size=2>/usr/local/sbin/named默认情况是一个后台deamon ,-g选项表示前台运行，并将调试信息打印到标准输出，这在我们安装调试阶段是非常有帮</FONT></P>
<P><FONT color=#000000 size=2>助的。 </FONT></P>
<P><FONT color=#000000 size=2>如果建立了配置文件和域名解析文件（关于怎样建立将在下面的部分讲到），ps aux 应该可以查到named 的进程，或netstat -an 也可以看到</FONT></P>
<P><FONT color=#000000 size=2>53端口的服务已经起来了。（DNS默认端口为53） </FONT></P>
<P><FONT color=#000000 size=2>如果要设置开机自启动DNS server，只需在/etc/rc.d/rc.local中加入一行 </FONT></P>
<P><FONT color=#000000 size=2>/usr/local/sbin/named </FONT></P>
<P><FONT color=#000000 size=2>#!/bin/sh<BR>#<BR># This script will be executed *after* all the other init scripts.<BR># You can put your own initialization stuff in here if you don't<BR># want to do the full Sys V style init stuff.<BR>touch /var/lock/subsys/local</FONT></P>
<P><FONT color=#000000 size=2>/usr/local/sbin/named</FONT></P>
<P><FONT color=#000000 size=2></FONT>&nbsp;</P>
<P><FONT color=#000000 size=2><STRONG>四.软件的配置。</STRONG></FONT></P>
<P><FONT color=#000000 size=2>1.主配置文件</FONT></P>
<P><FONT color=#000000 size=2>默认安装主配置文件的位置为</FONT></P>
<P><FONT color=#000000 size=2>/etc/named.conf</FONT></P>
<P><FONT color=#000000 size=2>下面逐步分析一个比较基础的配置文件：（注：named配置文件采用和c语言相同的注释符号）。</FONT></P>
<P><FONT color=#000000 size=2>(1) log options</FONT></P>
<P><BR><FONT color=#000000 size=2>/*<BR>* log option<BR>*/<BR>logging { <BR>channel default_syslog { syslog local2; severity error; };<BR>channel audit_log { file "/var/log/named.log"; severity error; print-time yes; };<BR>category default { default_syslog; }; <BR>category general { default_syslog; }; <BR>category security { audit_log; default_syslog; }; <BR>category config { default_syslog; }; <BR>category resolver { audit_log; }; <BR>category xfer-in { audit_log; }; <BR>category xfer-out { audit_log; }; <BR>category notify { audit_log; }; <BR>category client { audit_log; }; <BR>category network { audit_log; }; <BR>category update { audit_log; }; <BR>category queries { audit_log; }; <BR>category lame-servers { audit_log; };<BR>};</FONT></P>
<P><FONT color=#000000 size=2>这一部分是日志的设置，其中最主要的是 </FONT></P>
<P><FONT color=#000000 size=2>file "/var/log/named.log" 这一句指定了日志文件的位置，要正常启动named，必须要保证这一文件是存在的，并且named 进程对它有读写权</FONT></P>
<P><FONT color=#000000 size=2>限。 </FONT></P>
<P><FONT color=#000000 size=2>(2) options </FONT></P>
<P><FONT color=#000000 size=2>options {<BR>directory "/etc/namedb";</FONT></P>
<P><FONT color=#000000 size=2>&nbsp;&nbsp;&nbsp; listen-on-v6 { any; };</FONT></P>
<P><FONT color=#000000 size=2>// If you've got a DNS server around at your upstream provider, enter<BR>// its IP address here, and enable the line below.&nbsp; This will make you<BR>// benefit from its cache, thus reduce overall DNS traffic in the Internet.</FONT></P>
<P><FONT color=#000000 size=2>forwarders {<BR>your.upper.DNS.address;<BR>};</FONT></P>
<P><FONT color=#000000 size=2>/*<BR>* If there is a firewall between you and nameservers you want<BR>* to talk to, you might need to uncomment the query-source<BR>* directive below.&nbsp; Previous versions of BIND always asked<BR>* questions using port 53, but BIND 8.1 uses an unprivileged<BR>* port by default.<BR>*/<BR>// query-source address * port 53;</FONT></P>
<P><FONT color=#000000 size=2>/*<BR>* If running in a sandbox, you may have to specify a different<BR>* location for the dumpfile.<BR>*/<BR>dump-file "/etc/named_dump.db";<BR>};</FONT></P>
<P><FONT color=#000000 size=2>这一部分是一些基本的配置项： </FONT></P>
<P><FONT color=#000000 size=2>directory "/etc/namedb"; 指定域名解析等文件的存放目录（须手动建立）； </FONT></P>
<P><FONT color=#000000 size=2>listen-on-v6 { any; }; 支持ipv6的请求； </FONT></P>
<P><FONT color=#000000 size=2>forwarders { </FONT></P>
<P><FONT color=#000000 size=2>your.upper.DNS.address; </FONT></P>
<P><FONT color=#000000 size=2>}; 指定前向DNS，当本机无法解析的域名，就会被转发至前向DNS进行解析。 </FONT></P>
<P><FONT color=#000000 size=2>dump-file "/etc/named_dump.db"; 指定named_dump.db文件的位置。 </FONT></P>
<P><FONT color=#000000 size=2>(3) 线索域和回环域 </FONT></P>
<P><FONT color=#000000 size=2>指定线索域和本地回环域，这一部分使用一些标准的例子就可以。 </FONT></P>
<P><FONT color=#000000 size=2>file "named.root"; 指定该域的解析文件，其目录为options中directory "/etc/namedb";指定的。在本例中为/etc/namdb。 </FONT></P>
<P><FONT color=#000000 size=2>(4)自定义域 <BR>zone "test.com" {<BR>type master;<BR>file "zone.test ";<BR>};</FONT></P>
<P><FONT color=#000000 size=2>zone "0.168.192.in-addr.arpa" {<BR>type master;<BR>file "zone. test.rev";<BR>};<BR>zone "4.0.0.f.0.5.2.0.1.0.0.2.IP6.ARPA" { <BR>type master;<BR>allow-transfer { any;};<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; allow-query { any; }; <BR>file "ipv6.rev";<BR>};</FONT></P>
<P><FONT color=#000000 size=2>zone "lowerlevelzone.test.com" {<BR>type slave;<BR>masters {<BR>192.168.1.1;<BR>};<BR>};</FONT></P>
<P><FONT color=#000000 size=2>这一部分是配置文件中我们需要重点关心的部分： </FONT></P>
<P><FONT color=#000000 size=2>zone "test.com" { </FONT></P>
<P><FONT color=#000000 size=2>type master; </FONT></P>
<P><FONT color=#000000 size=2>file "zone.test "; </FONT></P>
<P><FONT color=#000000 size=2>}; 设定test.com域; </FONT></P>
<P><FONT color=#000000 size=2>type master 指明该域主要由本机解析; </FONT></P>
<P><FONT color=#000000 size=2>file "zone.test "指定其解析文件为zong.test，目录为options中设定的目录本例中为/etc/named。 </FONT></P>
<P><FONT color=#000000 size=2>zone "0.168.192.in-addr.arpa" { </FONT></P>
<P><FONT color=#000000 size=2>type master; </FONT></P>
<P><FONT color=#000000 size=2>file "zone. test.rev"; </FONT></P>
<P><FONT color=#000000 size=2>}; 指定ipv4地址逆向解析 </FONT></P>
<P><FONT color=#000000 size=2>type master 指明该域主要由本机解析; </FONT></P>
<P><FONT color=#000000 size=2>file "zone.test.rev "指定其解析文件为zong.test.rev，目录为options中设定的目录本例中为/etc/named。 </FONT></P>
<P><FONT color=#000000 size=2>zone "4.0.0.f.0.5.2.0.1.0.0.2.IP6.ARPA" { </FONT></P>
<P><FONT color=#000000 size=2>type master; </FONT></P>
<P><FONT color=#000000 size=2>allow-transfer { any;}; </FONT></P>
<P><FONT color=#000000 size=2>allow-query { any; }; </FONT></P>
<P><FONT color=#000000 size=2>file "ipv6.rev"; </FONT></P>
<P><FONT color=#000000 size=2>};指定ipv4地址逆向解析 </FONT></P>
<P><FONT color=#000000 size=2>type master 指明该域主要由本机解析; </FONT></P>
<P><FONT color=#000000 size=2>file " ipv6.rev "指定其解析文件为ipv6.rev，目录为options中设定的目录本例中为/etc/named。 </FONT></P>
<P><FONT color=#000000 size=2>zone "lowerlevelzone.test.com" { </FONT></P>
<P><FONT color=#000000 size=2>type slave; </FONT></P>
<P><FONT color=#000000 size=2>masters { </FONT></P>
<P><FONT color=#000000 size=2>192.168.1.1; </FONT></P>
<P><FONT color=#000000 size=2>}; </FONT></P>
<P><FONT color=#000000 size=2>}; 设定lowerlevelzone.test.com域; </FONT></P>
<P><FONT color=#000000 size=2>type slave 指明该域主要由低一级的域名服务器解析; </FONT></P>
<P><FONT color=#000000 size=2>masters { </FONT></P>
<P><FONT color=#000000 size=2>192.168.1.1; </FONT></P>
<P><FONT color=#000000 size=2>}; 指定低一级的域名服务器ip地址。 </FONT></P>
<P><FONT color=#000000 size=2></FONT>&nbsp;</P>
<P><FONT color=#000000 size=2>到此我们就初步建立了一个标准的named 的主配置文件，接下来建立对应的域名解析或逆向解析文件。 </FONT></P>
<P><FONT color=#000000 size=2>2.域名解析和IP地址逆向解析文件：</FONT></P>
<P><FONT color=#000000 size=2>(1) 域名解析：</FONT></P>
<P><FONT color=#000000 size=2>/etc/namedb/zone.test</FONT></P>
<P><FONT color=#000000 size=2>; From: @(#)localhost.rev 5.1 (Berkeley) 6/30/90<BR>; $FreeBSD: src/etc/namedb/PROTO.localhost.rev,v 1.6 2000/01/10 15:31:40 peter Exp $<BR>;<BR>; This file is automatically edited by the `make-localhost' script in<BR>; the /etc/namedb directory.<BR>;<BR>@ IN SOA ns.test.com. root.test.com.(<BR>2005030116; Serial<BR>3600 ; Refresh<BR>900 ; Retry<BR>3600000 ; Expire<BR>3600 ) ; Minimum<BR>IN NS ns.test.com<BR>;</FONT></P>
<P><FONT color=#000000 size=2>ns IN A 192.168.0.1<BR>www6 IN AAAA 2001:250:f004::10<BR>www IN A 192.168.0.2</FONT></P>
<P><FONT size=2><FONT color=#000000>本文件前半部分是一些默认的参数设置，只需把域名改成对应得你要设置的域就行，其余的不用过分深究，如果读者有兴趣可以查阅相关的手</FONT><FONT color=#000000>册文档。 </FONT></FONT></P>
<P><FONT size=2><FONT color=#ff0000>（注意，IN NS ns.test.com.; 这一条必须有，来指定本域的域名服务器 ；</FONT><FONT color=#000000><FONT color=#ff0000>域名必须以"."结尾。）</FONT> </FONT></FONT></P>
<P><FONT color=#000000 size=2>本文件的第二部分（倒数三行），指定了该域上的主机： </FONT></P>
<P><FONT color=#000000 size=2>ns IN A 192.168.0.1 </FONT></P>
<P><FONT color=#000000 size=2>ns 为主机名，A 代表地址类型为IPV4地址，192.168.0.1 是实际ip地址，这一条记录的含义是ns.test.com 的ip地址为 192.168.0.1 </FONT></P>
<P><FONT color=#000000 size=2>www6 IN AAAA 2001:250:f004::10 </FONT></P>
<P><FONT color=#000000 size=2>www6 为主机名，AAAA代表地址类型为IPV6地址，2001:250:f004::10 是其IPV6地址，这条记录的含义是www6.test.com </FONT></P>
<P><FONT color=#000000 size=2>的ip地址是2001:250:f004::10 。 </FONT></P>
<P><FONT color=#000000 size=2>(2)IP地址逆向解析： </FONT></P>
<P><FONT color=#000000 size=2>ipv4 逆向解析： </FONT></P>
<P><FONT color=#000000 size=2>/etc/namedb/zone.test.rev </FONT></P>
<P><FONT color=#000000 size=2>; From: @(#)localhost.rev 5.1 (Berkeley) 6/30/90<BR>; $FreeBSD: src/etc/namedb/PROTO.localhost.rev,v 1.6 2000/01/10 15:31:40 peter Exp $<BR>;<BR>; This file is automatically edited by the `make-localhost' script in<BR>; the /etc/namedb directory.<BR>;<BR>@ IN SOA ns.test.com. root.test.com.(<BR>2005030116; Serial<BR>3600 ; Refresh<BR>900 ; Retry<BR>3600000 ; Expire<BR>3600 ) ; Minimum<BR>IN NS ns.test.com<BR>;</FONT></P>
<P><FONT color=#000000 size=2>1 IN PTR ns.test.com.<BR>2 IN PTR </FONT><A href="http://www.test.com/"><FONT color=#000000 size=2>www.test.com</FONT></A><FONT color=#000000 size=2>.</FONT></P>
<P><FONT color=#000000 size=2>ipv6 逆向解析： </FONT></P>
<P><FONT color=#000000 size=2>/etc/namedb/zone.test.rev </FONT></P>
<P><FONT color=#000000 size=2>; From: @(#)localhost.rev 5.1 (Berkeley) 6/30/90<BR>; $FreeBSD: src/etc/namedb/PROTO.localhost.rev,v 1.6 2000/01/10 15:31:40 peter Exp $<BR>;<BR>; This file is automatically edited by the `make-localhost' script in<BR>; the /etc/namedb directory.<BR>;<BR>@ IN SOA ns.test.com. root.test.com.(<BR>2005030116; Serial<BR>3600 ; Refresh<BR>900 ; Retry<BR>3600000 ; Expire<BR>3600 ) ; Minimum<BR>IN NS ns.test.com<BR>;</FONT></P>
<P><FONT color=#000000 size=2>10.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 IN www6.test.com.</FONT></P>
<P><FONT color=#000000 size=2>这里 </FONT></P>
<P><FONT color=#000000 size=2>10.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 IN www6.test.com. </FONT></P>
<P><FONT color=#000000 size=2>与主配置文件/etc/named.conf中的 </FONT></P>
<P><FONT color=#000000 size=2>zone "4.0.0.f.0.5.2.0.1.0.0.2.IP6.ARPA" </FONT></P>
<P><FONT color=#000000 size=2>"10.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0" + "4.0.0.f.0.5.2.0.1.0.0.2" 刚好组成点分的32位16进制逆序ipv6地址。 </FONT></P>
<P><FONT color=#000000 size=2>实际上，ip地址逆向解析由于缺乏统一的管理和相关的标准，这项服务的使用比较混乱，可以考虑不启动该服务。所以在这里只给出两个例子</FONT></P>
<P><FONT color=#000000 size=2>，就不过多解释了。 </FONT></P>
<P><FONT color=#000000><FONT size=2><STRONG>五.安装使用的一些经验：</STRONG> </FONT></FONT></P>
<P><FONT color=#000000 size=2>1.带调试信息的启动 </FONT></P>
<P><FONT color=#000000 size=2>named -g </FONT></P>
<P><FONT color=#000000 size=2>/usr/local/sbin/named默认情况是一个后台deamon ,-g选项表示前台运行，并将调试信息打印到标准输出，这在我们安装调试阶段是非常有帮</FONT></P>
<P><FONT color=#000000 size=2>助的。 </FONT></P>
<P><FONT color=#000000 size=2>2.客户端命令nslookup简介 </FONT></P>
<P><FONT color=#000000 size=2>windows ，linux 平台均支持此调试命令。 </FONT></P>
<P><FONT color=#000000 size=2>键入nslookup即进入与服务器交互状态，这时键入域名或ip地址就可以向服务器正向或逆向查询。 </FONT></P>
<P><FONT color=#000000 size=2>&gt;www.test.com 正向域名解析 </FONT></P>
<P><FONT color=#000000 size=2>&gt;192.168.0.1 逆向IP解析 </FONT></P>
<P><FONT color=#000000 size=2>&gt;set type=AAAA 设置查询地址类型为IPv6地址类型。 </FONT></P>
<P><FONT color=#000000 size=2>&gt;set type=A 设置查询地址类型为IPv4地址类型。 </FONT></P>
<P><FONT size=2><FONT color=#000000>&gt;exit 退出。 <BR><BR></FONT><FONT color=#000000>3.相关样例文档 </FONT></FONT></P>
<P><FONT color=#000000 size=2>点击下载 </FONT></P>
<P><FONT color=#000000><FONT size=2><STRONG>更多下载请进入&gt;&gt;&gt;</STRONG> </FONT></FONT></P>
<P><FONT color=#000000><BR><FONT size=2>参考资料： </FONT></FONT></P>
<P><FONT color=#0000ff size=2><STRONG>[1]：</STRONG></FONT><A href="http://www.bind.com/"><FONT color=#000000 size=2>http://www.bind.com/</FONT></A><FONT color=#000000 size=2> </FONT></P>
<P><FONT color=#0000ff size=2><STRONG>[2]：</STRONG></FONT><A href="http://www.isc.org/index.pl?/sw/bind/"><FONT color=#000000 size=2>http://www.isc.org/index.pl?/sw/bind/</FONT></A><FONT color=#000000 size=2> </FONT></P>
<P><FONT color=#000000><FONT size=2><STRONG><FONT color=#0000ff>[3]：</FONT></STRONG>ipv6.bupt.edu.cn <BR></FONT></FONT></P><img src ="http://www.blogjava.net/net/aggbug/24583.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/net/" target="_blank">烂漫时空</a> 2005-12-19 11:05 <a href="http://www.blogjava.net/net/articles/24583.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>