首页 > 代码库 > 路由重分命令 redistribute ospf 1和 redistribute ospf 1 metric x的区别

路由重分命令 redistribute ospf 1和 redistribute ospf 1 metric x的区别

 redistribute ospf 1和 redistribute ospf 1 metric x  这两条命令看着基本都是相同的,都是把ospf路由重分布;在对端端的路由器看到路由信息不一样呢?
拓扑如下

R1 OSPF配置:
router ospf 1
 log-adjacency-changes
 network 1.1.1.0 0.0.0.255 area 0
 network 192.168.1.0 0.0.0.255 area 0


R2 OSPF配置:
router ospf 1
 log-adjacency-changes
 network 2.2.2.0 0.0.0.255 area 1
 network 192.168.2.0 0.0.0.255 area 1


R3 OSPF/RIP配置:

router ospf 1
 log-adjacency-changes
 redistribute rip metric 2 subnets
 network 192.168.1.0 0.0.0.255 area 0
 network 192.168.2.0 0.0.0.255 area 1
!
router rip
 version 2
 redistribute ospf 1
 network 3.0.0.0
 network 192.168.3.0
 no auto-summary
!

R4 RIP配置:

router rip
 version 2
 network 4.0.0.0
 network 192.168.3.0
 no auto-summary



R4的路由学习:
R4#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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

     3.0.0.0/24 is subnetted, 1 subnets
R       3.3.3.0 [120/1] via 192.168.3.3, 00:00:20, Ethernet0/3
     4.0.0.0/24 is subnetted, 1 subnets
C       4.4.4.0 is directly connected, Loopback4
R    192.168.1.0/24 [120/1] via 192.168.3.3, 00:00:20, Ethernet0/3
R    192.168.2.0/24 [120/1] via 192.168.3.3, 00:00:20, Ethernet0/3

C    192.168.3.0/24 is directly connected, Ethernet0/3


比较奇怪的是:R4上能够学习OSPF重分到RIP中的物理接口的路由信息而学习不到loopback的路由信息。

如果把R3上的ospf重分布到RIP中的路由增加metric x 之后 R4就能够学习到loopback的路由信息

R4的路由信息:
R4#show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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

     1.0.0.0/32 is subnetted, 1 subnets
R       1.1.1.1 [120/1] via 192.168.3.3, 00:00:12, Ethernet0/3
     2.0.0.0/32 is subnetted, 1 subnets
R       2.2.2.2 [120/1] via 192.168.3.3, 00:00:12, Ethernet0/3

     3.0.0.0/24 is subnetted, 1 subnets
R       3.3.3.0 [120/1] via 192.168.3.3, 00:00:12, Ethernet0/3
     4.0.0.0/24 is subnetted, 1 subnets
C       4.4.4.0 is directly connected, Loopback4
R    192.168.1.0/24 [120/1] via 192.168.3.3, 00:00:12, Ethernet0/3
R    192.168.2.0/24 [120/1] via 192.168.3.3, 00:00:13, Ethernet0/3
C    192.168.3.0/24 is directly connected, Ethernet0/3

请各位看官,谁能够解释一下 redistribute ospf 1和redistribute ospf 1 metric x
的区别?

个人理解:

如果后面的metric值不配置的话表示带的其他相应参数的默认值,如果想对默认值修改才会带相应的参数并予以赋值。

如rip路由重分布到OSPF路由当中:redistribute rip subnets 默认是外部的路由的metric是20, OSPF external type 默认是E2


或许有另外一种情况是模拟器的IOS的问题,请各位大大们解释一下。


路由重分命令 redistribute ospf 1和 redistribute ospf 1 metric x的区别