如下拓扑;
在R1上:
配置接口:
1(config)#int s1/1
1(config-if)#ip add 192.168.1.1 255.255.255.0
1(config-if)#no shut
1(config-if)#exit
启动协议:
1(config)#router ospf 1
1(config-router)#net 192.168.1.0 0.0.0.255 area 1
末节区域配置:
1(config-router)#area 1 stub
在R2上:
配置接口:
2(config)#int s1/0
2(config-if)#ip add 192.168.1.2 255.255.255.0
2(config-if)#clock rate 56000
2(config-if)#no shut
2(config-if)#int s1/1
2(config-if)#ip add 192.168.2.1 255.255.255.0
2(config-if)#clock rate 56000
2(config-if)#no shut
2(config-if)#
启动协议:
2(config)#router ospf 1
2(config-router)#net 192.168.1.0 0.0.0.255 area 1
2(config-router)#net 192.168.2.0 0.0.0.255 area 0
末节区域配置:
2(config-router)#area 1 stub
2(config-router)#
在R3上:
配置接口:
3(config-if)#int s1/0
3(config-if)#ip add 192.168.2.2 255.255.255.0
3(config-if)#no shut
3(config-if)#int s1/2
3(config-if)#ip add 192.168.3.1 255.255.255.0
3(config-if)#no shut
启动协议:
3(config)#router ospf 1
3(config-router)#net 192.168.2.0 0.0.0.255 area 0
3(config-router)#net 192.168.3.0 0.0.0.255 area 2
配置完全末节区域:
3(config-router)#area 2 stub no-summary
在R7上:
配置接口:
7(config)#int s1/2
7(config-if)#ip add 192.168.3.2 255.255.255.0
7(config-if)#clock rate 56000
7(config-if)#no shut
7(config-if)#exit
启动协议:
7(config)#router ospf 1
7(config-router)#net 192.168.3.0 0.0.0.255 area 2
配置完全末节区域:
7(config-router)#area 2 stub no-summary
测试:
在R1上:
末节区域的路由表:接受AS内的LSA, AS外的路由不在接受
1#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 192.168.1.2 to network 0.0.0.0
C 192.168.1.0/24 is directly connected, Serial1/1
O IA 192.168.2.0/24 [110/128] via 192.168.1.2, 00:00:42, Serial1/1 可接受AS内的路由
O IA 192.168.3.0/24 [110/192] via 192.168.1.2, 00:00:42, Serial1/1 可接受AS内的路由
O*IA 0.0.0.0/0 [110/65] via 192.168.1.2, 00:00:42, Serial1/1 不在接受AS外的路由信息
在R7上:
完全末节区域:不接受AS内汇总路由信息(其它网络路由信息)
7#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 192.168.3.1 to network 0.0.0.0
C 192.168.3.0/24 is directly connected, Serial1/2 只剩下了直连网络路由
O*IA 0.0.0.0/0 [110/65] via 192.168.3.1, 00:00:32, Serial1/2
7#