[attach]732[/attach] 实验环境说明: 1.将路由器R5的Fa0/0端口的ip设为:192.168.4.5/24;S1/1端口的ip设为:192.168.3.5/24 2.将路由器R1的 S1/1端口的ip设为:192.168.3.1/24;S1/2端口的ip设为:192.168.2.1/24 3.将路由器R2的S1/2端口的ip设为:192.168.2.2/24;Fa0/0端口的ip设为:192.168.1.2/24 前言:我们都知道,OSPF的网络类型有:广播型(也称多路访问)、点到点、点到多点、非广播多路访问(NBMA),除了非广播型多点访问类型以外的其它类型都会自动选择DR和BDR,这样才会形成邻居,它们之间才可以互相通信。而我们今天要演示的OSPF在NBMA中的实现,就是要克服这种非广播型多路访问中无法自动选出DR和BDR而无法发现邻居。没有邻居的路由器之间是无法通信的。我们的解决思路主要有:1、手工为相应的端口指定邻居;2、改变相应端口的网络类型。下面请看我们的详细配置过程: 配置过程清单: 交换机SW1的配置: 分别将Fa1/11、Fa1/14端口设置为全双工模式: SW1(config)#int fa1/11 SW1(config-if)#speed 100 SW1(config-if)#duplex full SW1(config-if)#no shut SW1(config-if)#exit SW1(config)#int fa1/14 SW1(config-if)#speed 100 SW1(config-if)#duplex full SW1(config-if)#no shut SW1(config-if)#exit 路由器R2的配置清单: 1、分别为路由器R2的S1/2、Fa0/0端口设置iP: R2(config)#int s1/2 R2(config-if)#ip add 192.168.2.2 255.255.255.0 R2(config-if)#no shut R2(config)#int fa0/0 R2(config-if)#speed 100 R2(config-if)#duplex full R2(config-if)#ip add 192.168.1.2 255.255.255.0 R2(config-if)#no shut R2(config-if)#exit 2、在路由器R2上配置OSPF: R2(config)#router ospf 100 R2(config-router)#router-id 2.2.2.2 R2(config-router)#network R2(config-router)#network 192.168.2.2 0.0.0.0 a 0 R2(config-router)#network 192.168.1.2 0.0.0.0 a 0 R2(config-router)#exit 路由器R1的配置清单: 1、为路由器R1的S1/1端口设置ip并封装桢中继: R1(config)#int s1/1 R1(config-if)#ip add 192.168.3.1 255.255.255.0 R1(config-if)#encapsulation frame-relay R1(config-if)#frame-relay map ip 192.168.3.5 105 br R1(config-if)#no frame-relay inverse-arp R1(config-if)#no shut 2、为路由器R1的S1/2端口设置ip: R1(config)#int s1/2 R1(config-if)#ip add 192.168.2.1 255.255.255.0 R1(config-if)#no shut 3、在路由器R1上配置OSPF: R1(config)#router ospf 100 R1(config-router)#router-id 1.1.1.1 R1(config-router)#network 192.168.3.1 0.0.0.0 a 0 R1(config-router)#network 192.168.2.1 0.0.0.0 a 0 R1(config-router)#exit 路由器R5的配置清单: 1、为路由器R5的S1/1端口配置ip并封装桢中继: R5(config)#int s1/1 R5(config-if)#ip add 192.168.3.5 255.255.255.0 R5(config-if)#encapsulation frame-relay R5(config-if)#frame-relay map ip 192.168.3.1 501 br R5(config-if)#no frame-relay inverse-arp R5(config-if)#no shut R5(config-if)#exit 2、为路由器R5的Fa0/0端口配置ip并设为全双工模式: R5(config)#int fa0/0 R5(config-if)#speed 100 R5(config-if)#duplex full R5(config-if)#ip add 192.168.4.5 255.255.255.0 R5(config-if)#no shut R5(config-if)#exit 3、在路由器R5上配置OSPF: R5(config)#router ospf 100 R5(config-router)#router-id 5.5.5.5 R5(config-router)#network 192.168.4.5 0.0.0.0 a 0 R5(config-router)#network 192.168.3.5 0.0.0.0 a 0 R5(config-router)#exit 以上为正常的配置过程,如果我们来通过#show ip ospf nei命令来看看R1、R5的邻居表,你会发现它们的邻居表中根本没有对方,也就是说,它们之间根本没有发现邻居,这时它们之间是无法互相通信。在前面我们已经说过,非广播型多路访问是不会自动选出DR和BDR的,需要我们手工来指定。这时我们就有了两种思路:1改变R1 、R5之间的网络类型,将它们改变为点对多点(point-to-mu);2、手工为它们指定邻居。请看下面的配置,这就是关键所在: A:改变网络类型实现OSPF在桢中继可以发现邻居: 1、改变R1的S1/1的网络类型为“点对多点”: R1(config)#int s1/1 R1(config-if)#ip ospf network point-to-mu R1(config-if)#no shut 2、改变R5的S1/1的网络类型为“点对多点”: R5(config)#int s1/1 R5(config-if)#ip ospf network point-to-mu R5(config-if)#no shut 这时,我们使用#show ip ospf nei命令来查看R1的邻居表: R1#show ip ospf nei Neighbor ID Pri State Dead Time Address Interface 5.5.5.5 0 FULL/ - 00:01:47 192.168.3.5 Serial1/1 2.2.2.2 0 FULL/ - 00:00:33 192.168.2.2 Serial1/2 看到了吧,路由器R1的邻居表里面已经有了R5和R2,这时,我们再用ping命令来验证一下,我们用R1来pingR5: R1#ping 192.168.4.5 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.4.5, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 44/73/112 ms 成功了!同样的道理,R5我们就不再验证了,您看明白了吗? B:手工为R1、R5指定邻居:(//后面为注释) R1(config)#router ospf 100 R1(config)#nei 192.168.3.5 //指定R5是R1的邻居,这里写对方的ip R5(config)#router ospf 100 R5(config)#nei 192.168.3.1 //指定R1是R5的邻居,这里写对方的ip 转载地址:http://www.net130.com/CMS/Pub/Te ... 006_12_14_33073.htm