简单的路由重分布实验(rip和ospf重分布)
1、网络拓扑,R1,R2,R3相连
Router1 S0/0 <----> Router2 S0/0
Router2 S0/1 <----> Router3 S0/1
2、具体配置
R1配置
R1>en
R1#config te
R1#config terminal
R1(config)#interface serial 0/0
R1(config-if)#ip add 14.0.0.1 255.255.255.252 //s0/0接口地址
R1(config-if)#clock rate 64000
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#interface loopback 0
R1(config-if)#ip add 10.0.0.1 255.255.255.255 //R1环回口接口地址
R1(config-if)#no shut
R1(config)#router rip // 启用RIP协议
R1(config-router)#version 2
R1(config-router)#network 10.0.0.1 //RIP宣告
R1(config-router)#network 14.0.0.1
R1(config-router)#exit
R2的配置
R2>en
R2#config terminal
R2(config)#interface serial 0/0
R2(config-if)#ip add 14.0.0.2 255.255.255.252 //R2 s0/0接口地址
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#interface serial 0/1
R2(config-if)#ip add 15.0.0.1 255.255.255.252 //R2 s0/1接口地址
R2(config-if)#clock rate 64000
R2(config-if)#no shut
R2(config)#interface loopback 0
R2(config-if)#ip add 12.0.0.1 255.255.255.255 //R2 环回口接口地址
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#router rip //启用RIP
R2(config-router)#version 2
R2(config-router)#network 14.0.0.2 //宣告RIP
R2(config-router)#exit
R2(config)#router ospf 100 //启用OSPF
R2(config-router)#network 12.0.0.1 0.0.0.0 area 0 //宣告OSPF
R2(config-router)#network 15.0.0.1 0.0.0.0 area 0
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#redistribute ospf 100 metric 1 //将OSPF重分布到RIP中
R2(config-router)#exit
R2(config)#router ospf 100
R2(config-router)#redistribute rip subnets //将RIP重分布到OSPF中
R3的配置
R3>en
R3#config terminal
R3(config)#interface serial 0/1
R3(config-if)#ip add 15.0.0.2 255.255.255.252 //R3 s0/1接口地址
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#interface loopback 0
R3(config-if)#ip add 13.0.0.1 255.255.255.255 //R3 环回口地址
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#router ospf 100 //启用OSPF
R3(config-router)#network 13.0.0.1 0.0.0.0 area 0 //宣告OSPF
R3(config-router)#network 15.0.0.2 0.0.0.0 area 0
3、show查看路由信息
R1#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
10.0.0.0/32 is subnetted, 1 subnets
C 10.0.0.1 is directly connected, Loopback0
R 12.0.0.0/8 [120/1] via 14.0.0.2, 00:00:13, Serial0/0
R 13.0.0.0/8 [120/1] via 14.0.0.2, 00:00:13, Serial0/0
14.0.0.0/30 is subnetted, 1 subnets
C 14.0.0.0 is directly connected, Serial0/0
R 15.0.0.0/8 [120/1] via 14.0.0.2, 00:00:13, Serial0/0
R2#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
R 10.0.0.0/8 [120/1] via 14.0.0.1, 00:00:12, Serial0/0
12.0.0.0/32 is subnetted, 1 subnets
C 12.0.0.1 is directly connected, Loopback0
13.0.0.0/32 is subnetted, 1 subnets
O 13.0.0.1 [110/65] via 15.0.0.2, 00:30:31, Serial0/1
14.0.0.0/30 is subnetted, 1 subnets
C 14.0.0.0 is directly connected, Serial0/0
15.0.0.0/30 is subnetted, 1 subnets
C 15.0.0.0 is directly connected, Serial0/1
R3#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
O E1 10.0.0.0/8 [110/164] via 15.0.0.1, 00:30:14, Serial0/1
12.0.0.0/32 is subnetted, 1 subnets
O 12.0.0.1 [110/65] via 15.0.0.1, 00:30:51, Serial0/1
13.0.0.0/32 is subnetted, 1 subnets
C 13.0.0.1 is directly connected, Loopback0
14.0.0.0/30 is subnetted, 1 subnets
O E1 14.0.0.0 [110/164] via 15.0.0.1, 00:26:55, Serial0/1
15.0.0.0/30 is subnetted, 1 subnets
C 15.0.0.0 is directly connected, Serial0/1