分享

专用Cisco路由器的替代品 Zebra二

 todaytomo 2007-01-05
 生成的 ripd.conf 配置文件如下所示:

  清单 7. 生成的 /etc/zebra/ripd.conf 文件

  !

  ! Zebra configuration saved from vty

  !  2003/08/19 13:50:30

  !

  hostname speedmetal-rip

  password zebra

  enable password zebra

  !

  interface lo

  !

  interface eth0

  !

  interface eth1

  !

  interface dummy0

  !

  router rip

  network 10.0.0.0/8

  network 192.168.0.0/16

  !

  line vty

  !

  在 Cisco 路由器上安装配置 RIP 路由

  我们将两个 Cisco 路由器称为 "A" 和 "B",为了简化这两个路由器的配置,我们只配置了一些让路由器能正常运行的基本设置,包括设置接口的 IP 地址、环回地址,以及用于串口通信的串口时钟频率。

  清单 8. 配置路由器 A

  Router#config terminal

  Router(config)#hostname RouterA

  RouterA(config)#int s0/0

  RouterA(config-if)#ip address 192.168.0.1 255.255.255.252

  RouterA(config-if)#no shut

  RouterA(config-if)# interface fastEthernet 0/0

  RouterA(config-if)#ip address 192.168.2.2 255.255.255.252

  RouterA(config-if)#no shut

  RouterA(config-if)#int loopback 0

  RouterA(config-if)#ip address 10.0.0.1 255.255.255.0

  RouterA(config-if)#end

  RouterA#write

  类似地,我们配置好路由器 "B"。

  清单 9. 配置路由器 B

  Router#configure terminal

  Router(config)#hostname RouterB

  RouterB(config)#int s0/0

  RouterB(config-if)#ip address 192.168.0.2 255.255.255.252

  RouterB(config-if)#no shut

  RouterB(config-if)#int fastEthernet0/0

  RouterB(config-if)#ip address 192.168.1.2 255.255.255.252

  RouterB(config-if)#no shut

  RouterB(config-if)#int loopback 0

  RouterB(config-if)#ip address 10.0.1.1 255.255.255.0

  RouterB(config-router)#end

  RouterB#write

  在 3620 路由器上配置 RIP 与 Zebra 中的命令极其类似。我们通过控制台线缆访问两台3620,执行如下命令:

  清单 10. 在路由器 A 上完成 RIP 所需的配置

  RouterA#conf t

  Enter configuration commands, one per line. End with CNTL/Z.

  RouterA(config)#router rip

  RouterA(config-router)#network 10.0.0.0

  RouterA(config-router)#network 192.168.0.0

  RouterA(config-router)#network 192.168.2.0

  RouterA(config-router)#version 2

  RouterA(config-router)#end

  RouterA#write

  然后是路由器 B:

  清单 11. 在路由器 B 上完成 RIP 所需的配置

  RouterB#conf t

  Enter configuration commands, one per line. End with CNTL/Z.

  RouterB(config)#router rip

  RouterB(config-router)#network 10.0.1.0

  RouterB(config-router)#network 192.168.0.0

  RouterB(config-router)#network 192.168.1.0

  RouterB(config-router)#version 2

  RouterB(config-router)#end

  RouterB#write

  router rip 命令启动配置 RIP 的过程。network 命令告诉路由器哪些是 RIP 要传播的网段。

  RIP 传播路由

  现在 Cisco 路由器和 Zebra 都已经配置好,我们接下来检验传播的路由。在 MRLG 中,我们选择 "show ip route" 然后点击 "Execute"。生成如下报告:

  清单 12. Zebra 反映的 RIP 路由

  Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,

  B - BGP, > - selected route, * - FIB route

  R>* 10.0.0.0/24 [120/2] via 192.168.2.2, eth0, 00:11:05

  R>* 10.0.1.0/24 [120/2] via 192.168.1.2, eth1, 00:02:08

  C>* 10.0.2.0/24 is directly connected, dummy0

  K * 127.0.0.0/8 is directly connected, lo

  C>* 127.0.0.0/8 is directly connected, lo

  R>* 192.168.0.0/30 [120/2] via 192.168.2.2, eth0, 00:11:05

  C>* 192.168.1.0/30 is directly connected, eth1

  C>* 192.168.2.0/30 is directly connected, eth0

  通过 RIP 得到的路由用一个 R 来标记。

  要注意的是,通过路由器 A 和路由器 B 的广播,Zebra 现在知道了 10.0.0.0/24 和 10.0.1.0/24 两个网段。测试时,我们从 ThinkPad Zebra 路由器上 ping 10.0.0.1 和 10.0.1.1,并从两个路由器上 ping 10.0.2.1(ThinkPad 的虚拟网络接口)。

  为了测试路由的 failover,我们把连接网段 10.0.0.0/24 的路由器 A 上的网络连接断开。经过总计约两分钟的过期时间以后,Zebra 得到了另一个可达 10.0.0.0/24 的路由,这个新的路由是通过路由器 B 得到的。注意在下面的清单中,Zebra 通过 192.168.1.2 到达 10.0.0.0/24,而不是先前的路径。

  清单 13. Zebra 反映的 RIP 路由

  Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,

  B - BGP, > - selected route, * - FIB route

  R>* 10.0.0.0/24 [120/3] via 192.168.1.2, eth0, 00:00:26

  R>* 10.0.1.0/24 [120/2] via 192.168.1.2, eth1, 00:06:02

  C>* 10.0.2.0/24 is directly connected, dummy0

  K * 127.0.0.0/8 is directly connected, lo

  C>* 127.0.0.0/8 is directly connected, lo

  R>* 192.168.0.0/30 [120/2] via 192.168.1.2, eth1, 00:00:26

  C>* 192.168.1.0/30 is directly connected, eth1

  C>* 192.168.2.0/30 is directly connected, eth0

  为什么总的过期时间大于两分钟?RIP 默认的过期时间是 30 秒,但是 RIP 协议指定了在确认一个路由已经失效之前要进行 3 次重试(共 90 秒),并且还要有一段时间来清空无效的路由(还需要 240 秒)。众所周知,RIP 协议对连接失败反应迟钝,这一点在这里得到了明确的论证。

  这里是在 failover 发生之前路由器 A 的路由表的输出。

  清单 14. Failover 之前路由器 A 的路由表

  RouterA#show ip route

  Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

  D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

  N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

  E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

  i - 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 - ODR

  P - periodic downloaded static route

  Gateway of last resort is not set

  10.0.0.0/24 is subnetted, 3 subnets

  R    10.0.2.0 [120/1] via 192.168.2.1, 00:00:11, FastEthernet0/0

  C    10.0.0.0 is directly connected, Loopback0

  R    10.0.1.0 [120/1] via 192.168.0.2, 00:00:18, Serial0/0

  192.168.0.0/30 is subnetted, 1 subnets

  C    192.168.0.0 is directly connected, Serial0/0

  192.168.1.0/30 is subnetted, 1 subnets

  R    192.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/0

  192.168.2.0/30 is subnetted, 1 subnets

  C    192.168.2.0 is directly connected, FastEthernet0/0

  failover 之后:

  清单 15. Failover 之后路由器 A 的路由表

  RouterA#show ip route

  Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

  D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

  N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

  E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

  i - 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 - ODR

  P - periodic downloaded static route

  Gateway of last resort is not set

  10.0.0.0/24 is subnetted, 3 subnets

  R    10.0.2.0 [120/2] via 192.168.0.2, 00:00:09, Serial0/0

  C    10.0.0.0 is directly connected, Loopback0

  R    10.0.1.0 [120/1] via 192.168.0.2, 00:00:09, Serial0/0

  192.168.0.0/30 is subnetted, 1 subnets

  C    192.168.0.0 is directly connected, Serial0/0

  192.168.1.0/30 is subnetted, 1 subnets

  R    192.168.1.0 [120/1] via 192.168.0.2, 00:00:09, Serial0/0

  192.168.2.0/30 is subnetted, 1 subnets

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多