拓扑图:
R1:
int lo0
ip add 1.1.1.1 255.255.255.0
ip ospf network point-to-point
int s0/0/0
ip add 192.168.12.1 255.255.255.0
no shut
router ospf 1
router-id 1.1.1.1
network 1.1.1.0 0.0.0.255 area 1
network 192.168.12.0 0.0.0.255 area 1
area 1 stub //把区域1配置为末节区域
R2:
int lo0
ip add 2.2.2.2 255.255.255.0
ip ospf network point-to-point
int s0/0/0
ip add 192.168.12.2 255.255.255.0
no shut
int s0/0/1
ip add 192.168.23.2 255.255.255.0
no shut
router ospf 1
router-id 2.2.2.2
network 192.168.23.0 0.0.0.255 area 0
network 192.168.12.0 0.0.0.255 area 1
redistribute connected subnets //将直连路由重发布到ospf区域
area 1 stub
R3:
int lo0
ip add 3.3.3.3 255.255.255.0
ip ospf network point-to-point
int s0/0/1
ip add 192.168.23.3 255.255.255.0
no shut
int s0/0/0
ip add 192.168.34.3 255.255.255.0
no shut
router ospf 1
router-id 3.3.3.3
network 192.168.23.0 0.0.0.255 area 0
network 3.3.3.0 0.0.0.255 area 0
network 192.168.34.0 0.0.0.255 area 2
area 2 stub no-summary //将区域2配置为完全末节区域
"no-summary"阻止区域间的路由进入末节区域,所以叫做完全末节。只需在ABR上启用本参数即可
R4:
int lo0
ip add 4.4.4.4 255.255.255.0
ip ospf network point-to-point
int s0/0/0
ip add 192.168.34.4 255.255.255.0
no shut
router ospf 1
router-id 4.4.4.4
network 192.168.34.0 0.0.0.255 area 2
network 4.4.4.0 0.0.0.255 area 2
area 2 stub
末节和完全末节区域需要满足如下条件
1.区域只有一个出口
2.区域不需要作为虚链路的过渡区
3.区域内没有ASBR
4.区域不是主干区域
末节区域不接受类型5的LSA,也就是外部路由,末节区域1的ABR R2自动向该区域内传播0.0.0.0/0的默认路由,末节区域可以接受区域间路由
完全末节区域不接受外部路由和区域间路由,只有区域内的路由和一条由ABR向该区域注入的默认路由