rip and ospf redistribution

 

 

rip and ospf redistribution_第1张图片

 

   首先看路由器的基本配置情况:

RouterA:


interface Loopback0
 ip address 152.1.11.1 255.255.255.240
!
interface Ethernet0/0
 ip address 152.1.10.1 255.255.255.0
 half-duplex
!
interface Serial1/0
 ip address 152.1.1.1 255.255.255.252
 serial restart-delay 0
!

router ospf 1
 log-adjacency-changes
 network 152.1.1.0 0.0.0.3 area 1
 network 152.1.10.0 0.0.0.15 area 1

Router B:

interface Serial1/0
 ip address 152.1.1.2 255.255.255.252
 serial restart-delay 0
!        
interface Serial1/1
 ip address 152.1.1.5 255.255.255.252
 serial restart-delay 0

router ospf 1
 log-adjacency-changes
 network 152.1.1.0 0.0.0.3 area 1
 network 152.1.1.4 0.0.0.3 area 0

Router C:

interface Serial1/0
 ip address 152.1.1.6 255.255.255.252
 serial restart-delay 0
!        
interface Serial1/1
 ip address 152.1.2.1 255.255.255.0
 serial restart-delay 0
!

router ospf 1
 log-adjacency-changes
 redistribute rip
 network 152.1.1.4 0.0.0.3 area 0
!
router rip
 redistribute ospf 1 metric 2
 network 152.1.0.0
 

Router D :
interface Loopback0
 ip address 152.1.3.1 255.255.255.0
!
interface Loopback1
 ip address 172.16.2.1 255.255.255.0

!
interface Serial1/0
 ip address 152.1.2.2 255.255.255.0
 serial restart-delay 0
!

router rip
 network 152.1.0.0

配置完成后看了一下Router A 和Router D 的路由表如下:

RouterA#sh ip route
Gateway of last resort is not set

     152.1.0.0/16 is variably subnetted, 4 subnets, 3 masks
C       152.1.11.0/28 is directly connected, Loopback0
C       152.1.10.0/24 is directly connected, Ethernet0/0
C       152.1.1.0/30 is directly connected, Serial1/0
O IA    152.1.1.4/30 [110/128] via 152.1.1.2, 00:12:50, Serial1/0

RouterD#sh ip route
Gateway of last resort is not set

     152.1.0.0/24 is subnetted, 3 subnets
R       152.1.10.0 [120/2] via 152.1.2.1, 00:00:22, Serial1/0
C       152.1.3.0 is directly connected, Loopback0
C       152.1.2.0 is directly connected, Serial1/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.2.0 is directly connected, Loopback0

RouterA的路由表没有学到152.1.3.0/24的路由,说明RIP的redistribution 没有成功,因为RouterC的 redistribute rip命令没有添加subnets,这样,路由器C重分布进ospf的是16位掩码的,而了路由器D的为24位掩码。把subnets添加上
RouterC(config-router)#redistribute rip subnets后,我们再看一下RouterA的路由表:

RouterA#sh ip route
Gateway of last resort is not set

     152.1.0.0/16 is variably subnetted, 6 subnets, 3 masks
C       152.1.11.0/28 is directly connected, Loopback0
C       152.1.10.0/24 is directly connected, Ethernet0/0
C       152.1.1.0/30 is directly connected, Serial1/0
O E2    152.1.3.0/24 [110/20] via 152.1.1.2, 00:03:21, Serial1/0
O E2    152.1.2.0/24 [110/20] via 152.1.1.2, 00:03:20, Serial1/0
O IA    152.1.1.4/30 [110/128] via 152.1.1.2, 00:27:16, Serial1/0

现在路由器A已经能够正常学到路由,再看一下路由器D,它只学到了152.1.10.0/24的路由,这是因为rip是classful路由协议,只有subnets为24的才能穿过边界。用两种方法来解决这个问题,第一种方法:

RouterC(config)#ip route 152.1.11.0 255.255.255.0 s1/0
RouterC(config)#ip route 152.1.1.0 255.255.255.0 s1/0
RouterC(config)#router rip
RouterC(config-router)#redistribute static

看一下RouterD 的路由表已经能够学到发布的路由

RouterD#sh ip route
Gateway of last resort is not set

     152.1.0.0/24 is subnetted, 5 subnets
R       152.1.11.0 [120/1] via 152.1.2.1, 00:00:05, Serial1/0
R       152.1.10.0 [120/2] via 152.1.2.1, 00:00:05, Serial1/0
R       152.1.1.0 [120/1] via 152.1.2.1, 00:00:05, Serial1/0
C       152.1.3.0 is directly connected, Loopback0
C       152.1.2.0 is directly connected, Serial1/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.2.0 is directly connected, Loopback1

把配置清掉

RouterC(config)#no ip route 152.1.11.0 255.255.255.0 s1/0
RouterC(config)#no ip route 152.1.1.0 255.255.255.0 s1/0
RouterC(config)#router rip
RouterC(config-router)#no  redistribute static

第二种方法:

先把152.1.11.0 发布进ospf域中

RouterA(config)#router ospf 1
RouterA(config-router)#redistribute connected subnets
RouterA(config-router)#summary-address 152.1.11.0 255.255.255.0
看RouterD的路由表已经存在152.1.11.0/24的路由了

RouterD#sh ip route
Gateway of last resort is not set

     152.1.0.0/24 is subnetted, 4 subnets
R       152.1.11.0 [120/2] via 152.1.2.1, 00:00:03, Serial1/0
R       152.1.10.0 [120/2] via 152.1.2.1, 00:00:03, Serial1/0
C       152.1.3.0 is directly connected, Loopback0
C       152.1.2.0 is directly connected, Serial1/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.2.0 is directly connected, Loopback1

命令summary-address用在ASBR上。

在路由器B上

RouterB(config)#router ospf 1
RouterB(config-router)#area 1 range 152.1.1.0 255.255.255.0

看路由器D的路由表学到152.1.1.0/24的路由了

RouterD#sh ip route
Gateway of last resort is not set

     152.1.0.0/24 is subnetted, 5 subnets
R       152.1.11.0 [120/2] via 152.1.2.1, 00:00:25, Serial1/0
R       152.1.10.0 [120/2] via 152.1.2.1, 00:00:25, Serial1/0
R       152.1.1.0 [120/2] via 152.1.2.1, 00:00:25, Serial1/0
C       152.1.3.0 is directly connected, Loopback0
C       152.1.2.0 is directly connected, Serial1/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.2.0 is directly connected, Loopback1

 

 

 

 

 

你可能感兴趣的:(职场,路由,休闲)