根据上图搭建拓扑如下
在172.16.0.0/16的网段下规划地址
R1的IP地址及环回
[R1]interface s4/0/0
[R1-Serial4/0/0]ip address 172.16.0.1 30
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 172.16.1.1 24
R2的IP地址及环回
[R2]interface LoopBack 0
[R2-LoopBack0]ip address 172.16.2.1 24
[R2]interface s4/0/0
[R2-Serial4/0/0]ip address 172.16.0.2 30
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip address 172.16.0.129 25
R3的IP地址及环回
[R3]interface LoopBack 0
[R3-LoopBack0]ip address 172.16.3.1 24
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]ip address 172.16.0.130 25
[R3]interface s4/0/0
[R3-Serial4/0/0]ip address 172.16.0.5 30
R4的IP地址及环回
[R4]interface s4/0/0
[R4-Serial4/0/0]ip address 172.16.0.6 30
[R4]interface g0/0/0
[R4-GigabitEthernet0/0/0]ip address 172.16.0.131 25
[R4]interface LoopBack 0
[R4-LoopBack0]ip address 172.16.4.1 24
R5的IP地址及环回
[R5]interface LoopBack 0
[R5-LoopBack0]ip address 172.16.5.1 24
[R5]interface s4/0/1
[R5-Serial4/0/1]ip address 172.16.0.10 30
[R5]interface g0/0/0
[R5-GigabitEthernet0/0/0]ip address 172.16.0.132 25
R1配路由
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]network 172.16.0.0 0.0.255.255
R2配路由
[R2]ospf 1 rou
[R2]ospf 1 router-id 2.2.2.2
R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]net
[R2-ospf-1-area-0.0.0.1]network 172.16.0.2 0.0.0.0
[R2-ospf-1-area-0.0.0.1]net
[R2-ospf-1-area-0.0.0.1]network 172.16.2.1 0.0.0.0
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 172.16.0.129 0.0.0.0
R3配路由
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 172.16.0.130 0.0.0.0
[R3-ospf-1]area 2
[R3-ospf-1-area-0.0.0.2]network 172.16.0.5 0.0.0.0
[R3-ospf-1-area-0.0.0.2]network 172.16.3.1 0.0.0.0
R4配路由
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 172.16.0.131 0.0.0.0
[R4-ospf-1]area 2
[R4-ospf-1-area-0.0.0.2]net
[R4-ospf-1-area-0.0.0.2]network 172.16.0.6 0.0.0.0
[R4-ospf-1-area-0.0.0.2]network 172.16.0.9 0.0.0.0
[R4-ospf-1-area-0.0.0.2]network 172.16.4.1 0.0.0.0
R5配路由
[R5]ospf router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 172.16.0.132 0.0.0.0
[R5-ospf-1]area 2
[R5-ospf-1-area-0.0.0.2]network 172.16.0.10 0.0.0.0
R3存在环回100 IP为100.1.1.1/24 不能宣告ospf
[R3]interface LoopBack 100
[R3-LoopBack100]ip address 100.1.1.1 24
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]default-route-advertise always
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]ospf dr-priority 0