最近都是在郁闷中度过,原因只有一个,rip和ospf之间的路由重发布实验始终没有做成功,今天终于大功告成。不敢独享。部分配置好下,希望对热爱网络技术,初认网络技术的朋友有所帮助。
此实验有5个路由器,成一条线排开,router4是一个分界点,它的左边的路由器上运行的都是rip v2的版的协议,而右边则是运行的是ospf 10 的路由协议。
这是router4上的配置:
Router#show running-config
Building configuration...
Current configuration : 656 bytes
!
version 12.2
no service password-encryption
!
hostname Router
!
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Serial1/0
 no ip address
 shutdown
!
interface Serial1/1
 ip address 10.0.0.2 255.0.0.0
!
interface Serial1/2
 ip address 172.16.0.1 255.255.0.0
 clock rate 64000
!
interface Serial1/3
 no ip address
 shutdown
!
router ospf 10
 log-adjacency-changes
 redistribute rip subnets
 network 172.16.0.0 0.0.255.255 area 0
!
router rip
 version 2
 redistribute ospf 10  metric 2
 network 10.0.0.0
 no auto-summary
!
ip classless
!
!
!
!
!
line con 0
line vty 0 4
 login
!
!
end
在router4上配置我个人觉得应注意以下几点:第一,要理解路由重以布语句的意思,如:redistribute rip subnets 此命令是在route ospf 10 命令下的,就应该理解为把rip发布为进程号为10的ospf。而redistribute ospf 10  metric 2 是在#route rip-->#version2下的就是说把进程号为10的ospf发布成rip。在这里应说明的是在发布成为rip协议时要匹配metric,在发布达为ospf时应匹配subnets。
第二,在运行rip的接口上要关闭自动汇总
其它的都是些小问题。
接下来我们来看看router4的路由:
Router#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
R    1.0.0.0/8 [120/2] via 10.0.0.1, 00:00:04, Serial1/1
R    2.0.0.0/8 [120/1] via 10.0.0.1, 00:00:04, Serial1/1
C    10.0.0.0/8 is directly connected, Serial1/1
O    30.0.0.0/8 [110/1562] via 172.16.0.2, 00:49:07, Serial1/2
C    172.16.0.0/16 is directly connected, Serial1/2
O    192.168.0.0/24 [110/1563] via 172.16.0.2, 00:49:07, Serial1/2
在router2上的路由表如下:
Router#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
C    1.0.0.0/8 is directly connected, FastEthernet0/0
C    2.0.0.0/8 is directly connected, Serial1/0
R    10.0.0.0/8 [120/1] via 2.0.0.2, 00:00:11, Serial1/0
R    30.0.0.0/8 [120/2] via 2.0.0.2, 00:00:11, Serial1/0
R    172.16.0.0/16 [120/2] via 2.0.0.2, 00:00:11, Serial1/0
R    192.168.0.0/24 [120/2] via 2.0.0.2, 00:00:11, Serial1/0
这里的最后两条路由是路由重发布后能学习到的。
来看看touter6中的路由表:
Router#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
O E2 1.0.0.0/8 [110/1562] via 30.0.0.1, 00:49:30, Serial1/0
O E2 2.0.0.0/8 [110/1562] via 30.0.0.1, 00:49:30, Serial1/0
O E2 10.0.0.0/8 [110/1562] via 30.0.0.1, 00:49:30, Serial1/0
C    30.0.0.0/8 is directly connected, Serial1/0
O    172.16.0.0/16 [110/1562] via 30.0.0.1, 01:01:05, Serial1/0
C    192.168.0.0/24 is directly connected, FastEthernet0/0
我们来做下测试,从pc0到pc1:
PC>ping 192.168.0.2
Pinging 192.168.0.2 with 32 bytes of data:
Reply from 192.168.0.2: bytes=32 time=156ms TTL=123
Reply from 192.168.0.2: bytes=32 time=172ms TTL=123
Reply from 192.168.0.2: bytes=32 time=172ms TTL=123
Reply from 192.168.0.2: bytes=32 time=172ms TTL=123
Ping statistics for 192.168.0.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 156ms, Maximum = 172ms, Average = 168ms
PC>
实验成功!!!!!!!!!!