一键收藏,随时查看,分享好友!
OSPF区域配置:

 

 
在路由器R1上的配置:
R1(config)#in f0/0
R1(config-if)#no sh
R1(config-if)#ip add 192.168.20.1 255.255.255.0

 

R1(config-if)#in loop 10
R1(config-if)#no sh
R1(config-if)#ip add 192.168.10.1 255.255.255.0

 

 

R1(config)#router ospf 10
R1(config-router)#router-id 1.1.1.1
R1(config-router)#net 192.168.10.0 0.0.0.255 area 0
R1(config-router)#net 192.168.20.0 0.0.0.255 area 0
R1(config-router)#exit
R1(config)#exit

 

在路由器R2上的配置:
R2(config)#in f0/0
R2(config-if)#no sh
R2(config-if)#ip add 192.168.20.2 255.255.255.0

 

R2(config)#in f1/0
R2(config-if)#no sh
R2(config-if)#ip add 192.168.30.1 255.255.255.0

 

 

R2(config-if)#router ospf 10
R2(config-router)#router-id 2.2.2.2
R2(config-router)#net 192.168.20.0 0.0.0.255 are 0
R2(config-router)#net 192.168.30.0 0.0.0.255 are 10

 

在路由器R3上的配置:
R3(config)#in f0/0
R3(config-if)#no sh
R3(config-if)#ip add 192.168.30.2 255.255.255.0

 

R3(config-if)#in f1/0
R3(config-if)#no sh
R3(config-if)#ip add 192.168.40.1 255.255.255.0

 

 

R3(config)#router os 10
R3(config-router)#router-id 3.3.3.3
R3(config-router)#net 192.168.30.0 0.0.0.255 are 10
R3(config-router)#net 192.168.40.0 0.0.0.255 are 10

 

在路由器R4上的配置:
R4(config)#in f0/0
R4(config-if)#no sh
R4(config-if)#ip add 192.168.40.2 255.255.255.0
R4(config-if #ex

 

R4(config)#in f1/0
R4(config-if)#no sh
R4(config-if)#ip add 192.168.50.1 255.255.255.0

 

 

\R4(config-if)#router ospf 10
R4(config-router)#router-id 4.4.4.4
R4(config-router)#net 192.168.40.0 0.0.0.255 are 10

 

 

R4(config-router)#router rip
R4(config-router)#ver 2
R4(config-router)#no au
R4(config-router)#net 192.168.50.0

 

 

OSPF协议中重发布 RIP协议,使OSPF协议中有RIP协议中的路由条目

 

R4(config-router)#router ospf 10
R4(config-router)#redistribute rip subnets

 

 

RIP协议中重发布OSPF协议,使RIP协议中有OSPF协议中的路由条目

 

R4(config-router)#router rip
R4(config-router)#redistribute ospf 10 metric 5

 

在路由器R5上的配置:
R5(config)#in f0/0
R5(config-if)#no sh
R5(config-if)#ip add 192.168.50.2 255.255.255.0

 

R5(config-if)#in loop 10
R5(config-if)#no sh
R5(config-if)#ip add 192.168.60.1 255.255.255.0

 

 

R5(config-if)#router rip
R5(config-router)#ver 2
R5(config-router)#no au
R5(config-router)#net 192.168.50.0
R5(config-router)#net 192.168.60.0

 

R1路由器上查询路由表信息
R1#show ip rou
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 IA 192.168.30.0/24 [110/2] via 192.168.20.2, 00:21:42, FastEthernet0/0
O E2 192.168.60.0/24 [110/20] via 192.168.20.2, 00:07:11, FastEthernet0/0
C    192.168.10.0/24 is directly connected, Loopback10
O IA 192.168.40.0/24 [110/3] via 192.168.20.2, 00:17:03, FastEthernet0/0
C    192.168.20.0/24 is directly connected, FastEthernet0/0
O E2 192.168.50.0/24 [110/20] via 192.168.20.2, 00:11:19, FastEthernet0/0
  

 

R1路由器上验证连通性
R1#ping 192.168.60.1

 

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.60.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 348/540/704 ms

 

 

 

 

R5路由器上查询路由表信息
R5#show ip rou
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    192.168.30.0/24 [120/5] via 192.168.50.1, 00:00:12, FastEthernet0/0
C    192.168.60.0/24 is directly connected, Loopback10
     192.168.10.0/32 is subnetted, 1 subnets
R       192.168.10.1 [120/5] via 192.168.50.1, 00:00:12, FastEthernet0/0
R    192.168.40.0/24 [120/5] via 192.168.50.1, 00:00:12, FastEthernet0/0
R    192.168.20.0/24 [120/5] via 192.168.50.1, 00:00:12, FastEthernet0/0
C    192.168.50.0/24 is directly connected, FastEthernet0/0

 

 

 

 

R1路由器上验证连通性
R5#ping 192.168.10.1

 

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 308/442/768 ms