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