应用场景描述:
公司总部位于北京,在上海.广州拥有分公司,现将3个地方的办公司网络用OSPF连接起来
使用到的相关知识点:
1:router ospf 进程号
Network 网络号 反码 area 区域号
Aera 区域号 stub (no-summary )
2:router ospf 进程号
Redistribute rip metric 1—16777214 metric-type 1/2 subnets
3:router rip
Redistribute ospf 进程号metric 0—16
4.sh ip route
5. sh ip ospf neighbor
步骤:
R1配置命令:
ena
conf t
host r1
int e0/0
ip add 2.1.1 .2 255.255.255.0
no sh
exit
int loopback 0
ip add 1.1.1 .1 255.255.255.0
exit
router rip
network 2.0.0 .0
network 1.0.0 .0
exit
exit
R2的配置:
ena
conf t
host r2
int e0/0
ip add 2.1.1 .1 255.255.255.0
no sh
exit
int e0/1
ip add 192.168.1.1 255.255.255.0
no sh
exit
int loopback 0
ip add 192.168.64.1 255.255.255.0
exit
router rip
network 2.0.0 .0
redistribute ospf 1 metric 14
exit
router ospf 1
network 192.168.64.0 0.0.0 .255 area 1
network 192.168.1.0 0.0.0 .255 area 0
redistribute rip metric 999 metric-type 1 subnets
exit
exit
R3的配置:
ena
conf t
host r3
int e0/0
ip add 192.168.1.3 255.255.255.0
no sh
exit
int e0/1
ip add 192.168.24.1 255.255.255.252
no sh
exit
int loop 0
ip add 3.1.1 .1 255.255.255.0
exit
router ospf 1
network 192.168.1.0 0.0.0 .255 area 0
network 192.168.24.0 0.0.0 .3 area 51
network 3.1.1 .0 0.255.255.255 area 0
area 51 stub no-summary
exit
exit
R4的配置:
ena
conf t
host r4
int e0/0
ip add 192.168.24.2 255.255.255.252
no sh
exit
router ospf 1
network 192.168.24.0 0.0.0 .3 area 51
area 51 stub
exit
exit
验证:
r1#sh 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/24 is subnetted, 1 subnets
C 1.1.1 .0 is directly connected, Loopback0
2.0.0 .0/24 is subnetted, 1 subnets
C 2.1.1 .0 is directly connected, Ethernet0/0
R 3.0.0 .0/8 [120/14] via 2.1.1.1, 00:00:13, Ethernet0/0
R 192.168.24.0/24 [120/14] vi a 2.1.1 .1, 00:00:13, Ethernet0/0
R 192.168.64.0/24 [120/14] vi a 2.1.1 .1, 00:00:13, Ethernet0/0
R 192.168.1.0/24 [120/14] vi a 2.1.1 .1, 00:00:13, Ethernet0/0********************************************************
r2#sh 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 1.0.0 .0/8 [120/1] via 2.1.1.2, 00:00:01, Ethernet0/0
2.0.0 .0/24 is subnetted, 1 subnets
C 2.1.1 .0 is directly connected, Ethernet0/0
3.0.0 .0/32 is subnetted, 1 subnets
O 3.1.1 .1 [110/11] via 192.168.1.3, 00:02:43, Ethernet0/1
192.168.24.0/30 is subnetted, 1 subnets
O IA 192.168.24.0 [110/20] via 192.168.1.3, 00:02:43, Ethernet0/1
C 192.168.64.0/24 is directly connected, Loopback0
C 192.168.1.0/24 is directly connected, Ethernet0/1********************************************************
r3#sh 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/8 is variably subnetted, 2 subnets, 2 masks
Ethernet0/0
O E1 1.0.0 .0/8 [110/1009] via 192.168.1.1, 01:24:00, Ethernet0/0
2.0.0 .0/24 is subnetted, 1 subnets
O E1 2.1.1 .0 [110/1009] via 192.168.1.1, 01:24:00, Ethernet0/0
33.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
3.0.0 .0/24 is subnetted, 1 subnets
C 3.1.1 .0 is directly connected, Loopback0
192.168.24.0/30 is subnetted, 1 subnets
C 192.168.24.0 is directly connected, Ethernet0/1
192.168.64.0/32 is subnetted, 1 subnets
O IA 192.168.64.1 [110/11] via 192.168.1.1, 01:24:02, Ethernet0/0
C 192.168.1.0/24 is directly connected, Ethernet0/0
*****************************************************
r4#sh 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 192.168.24.1 to network 0.0.0 .0
192.168.24.0/30 is subnetted, 1 subnets
C 192.168.24.0 is directly connected, Ethernet0/0
O*I A 0.0.0 .0/0 [110/11] via 192.168.24.1, 01:24:41, Ethernet0/0
**********************************************
总结:
设置末梢区域,必须两边都设置。设置完全末梢区域,只需要在ABR上设置,但需要确保另一个已经是stub了。