1 专用Cisco路由器的替代品Zebra( 五 )



清单 14. Failover 之前路由器 A 的路由表
RouterA#show ip routeCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area* - candidate default, U - per-user static route, o - ODRP - periodic downloaded static routeGateway of last resort is not set10.0.0.0/24 is subnetted, 3 subnetsR10.0.2.0 [120/1] via 192.168.2.1, 00:00:11, FastEthernet0/0C10.0.0.0 is directly connected, Loopback0R10.0.1.0 [120/1] via 192.168.0.2, 00:00:18, Serial0/0192.168.0.0/30 is subnetted, 1 subnetsC192.168.0.0 is directly connected, Serial0/0192.168.1.0/30 is subnetted, 1 subnetsR192.168.1.0 [120/1] via 192.168.0.2, 00:00:18, Serial0/0[120/1] via 192.168.2.1, 00:00:11, FastEthernet0/0192.168.2.0/30 is subnetted, 1 subnetsC192.168.2.0 is directly connected, FastEthernet0/0failover 之后:
清单 15. Failover 之后路由器 A 的路由表
RouterA#show ip routeCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area* - candidate default, U - per-user static route, o - ODRP - periodic downloaded static routeGateway of last resort is not set10.0.0.0/24 is subnetted, 3 subnetsR10.0.2.0 [120/2] via 192.168.0.2, 00:00:09, Serial0/0C10.0.0.0 is directly connected, Loopback0R10.0.1.0 [120/1] via 192.168.0.2, 00:00:09, Serial0/0192.168.0.0/30 is subnetted, 1 subnetsC192.168.0.0 is directly connected, Serial0/0192.168.1.0/30 is subnetted, 1 subnetsR192.168.1.0 [120/1] via 192.168.0.2, 00:00:09, Serial0/0192.168.2.0/30 is subnetted, 1 subnetsR192.168.2.0 [120/2] via 192.168.0.2, 00:00:10, Serial0/0使用 Zebra 配置 OSPF 路由
完成 RIP 的配置后,我们开始配置 OSPF 路由 。尽管 OSPF 和 RIP 可以同时使用,不过为了配置的简化,我们现在只使用 OSPF 。我们只需要把 ripd 服务停掉,就可以在 Zebra 中将 RIP 禁用 。
# service ripd stop
和前面一样,我们从 OSPF 的一个基本的配置文件开始,这次是 ospfd.conf,文件所在目录仍是 /etc/zebra 。
清单 16. 一个基本的 /etc/zebra/ospfd.conf 文件
hostname speedmetal-ospfpassword zebraenable password zebra
然后,我们启动 OSPF 服务:
# service ospfd start
对 OSPF 的配置比 RIP 简单:基本上我们仅仅需要告诉 OSPF 去广播所有它知道的路由 。
配置 OSPF 的端口是 2604 。
下面是我们配置 OSPF 的会话 。

清单 17. OSPF 配置会话
[root@speedmetal zebra]# telnet 127.0.0.1 2604User Access VerificationPassword: zebraspeedmetal-ospf> enablePassword: zebraspeedmetal-ospf# configure terminalspeedmetal-ospf(config)# router ospfspeedmetal-ospf(config-router)# network 0.0.0.0/0 area 0speedmetal-ospf(config-router)# endspeedmetal-ospf# writeConfiguration saved to /etc/zebra/ospfd.confspeedmetal-ospf# show run Current configuration:!hostname speedmetal-ospfpassword zebraenable password zebra!!router ospf network 0.0.0.0/0 area 0!line vty!endspeedmetal-ospf#ospfd.conf 配置文件的修改结果如下:
清单 18. Zebra 修改后的 /etc/zebra/ospfd.conf 文件
!! Zebra configuration saved from vty!2003/08/19 14:22:17!hostname speedmetal-ospfpassword zebraenable password zebra!!!interface lo!interface eth0!interface eth1!interface dummy0!router ospf network 0.0.0.0/0 area 0!line vty!在 Cisco 路由器上配置 OSPF
我们用以下命令来移除 RIP 协议并添加 OSPF 协议:

推荐阅读