需求:RIP和OSPF之間在R2上作雙向重發布,能夠相互學習到對方的路由。
配置:
router ospf 1
router-id 2.2.2.2
log-adjacency-changes
redistribute rip subnets
network 2.2.2.2 0.0.0.0 area 0
network 12.1.1.2 0.0.0.0 area 0
router rip
version 2
redistribute ospf 1 metric 1
network 23.0.0.0
no auto-summary
驗證:
R1
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 12.1.1.2, 00:03:32, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
O E2 3.3.3.0 [110/20] via 12.1.1.2, 00:00:23, Serial1/0
23.0.0.0/24 is subnetted, 1 subnets
O E2 23.1.1.0 [110/20] via 12.1.1.2, 00:00:52, Serial1/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
R3#show ip 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 23.1.1.1, 00:00:24, Serial1/0
2.0.0.0/24 is subnetted, 1 subnets
R 2.2.2.0 [120/1] via 23.1.1.1, 00:00:24, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/0
12.0.0.0/24 is subnetted, 1 subnets
R 12.1.1.0 [120/1] via 23.1.1.1, 00:00:24, Serial1/0
思考與總結:
1.redistribute rip subnets,將RIP網絡路由重分發到OSPF網絡中,subnets命令可以確保RIP網絡中的無類子網路由能夠正確的被髮布。
2.其他路由協議重分發到OSPF協議中時,默認度量值爲20(BGP除外,他的度量值是1),ospf的度量值爲成本。