在划分的三个区域和主区域中的每台路由器都开启OSPF进程,并指定接口所属区域
网络拓扑图如下:
首先配置路由器的接口IP地址:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 8
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 13.0.0.1 8
[R1-GigabitEthernet0/0/1]quit
[R1]int LoopBack 0
[R1-LoopBack0]ip add 1.0.0.1 8
[R1-LoopBack0]quit
[R1-LoopBack1]ip add 172.16.0.1 24
[R1-LoopBack1]quit
R2、R3同理按照网络拓扑图配置
接着配置各个路由器接口的ospf:
[R1]ospf
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]net 12.0.0.0 0.255.255.255
[R1-ospf-1-area-0.0.0.0]net 13.0.0.0 0.255.255.255
[R1-ospf-1-area-0.0.0.0]quit
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]net 172.16.0.1 0.0.0.0
[R1-ospf-1-area-0.0.0.1]net 1.0.0.1 0.0.0.0
[R1-ospf-1-area-0.0.0.1]quit
R2、R3同理按照网络拓扑图配置
查看配置好的ospf接口:
[R1]dis ospf interface
OSPF Process 1 with Router ID 12.0.0.1
Interfaces
Area: 0.0.0.0 (MPLS TE not enabled)
IP Address Type State Cost Pri DR BDR
12.0.0.1 Broadcast DR 1 1 12.0.0.1 12.0.0.2
13.0.0.1 Broadcast DR 1 1 13.0.0.1 13.0.0.2
Area: 0.0.0.1 (MPLS TE not enabled)
IP Address Type State Cost Pri DR BDR
1.0.0.1 P2P P-2-P 0 1 0.0.0.0 0.0.0.0
172.16.0.1 P2P P-2-P 0 1 0.0.0.0 0.0.0.0
[R2]dis ospf interface
OSPF Process 1 with Router ID 12.0.0.2
Interfaces
Area: 0.0.0.0 (MPLS TE not enabled)
IP Address Type State Cost Pri DR BDR
12.0.0.2 Broadcast BDR 1 1 12.0.0.1 12.0.0.2
23.0.0.1 Broadcast DR 1 1 23.0.0.1 23.0.0.2
Area: 0.0.0.2 (MPLS TE not enabled)
IP Address Type State Cost Pri DR BDR
2.0.0.1 P2P P-2-P 0 1 0.0.0.0 0.0.0.0
10.0.0.1 P2P P-2-P 0 1 0.0.0.0 0.0.0.0
[R3]dis ospf interface
OSPF Process 1 with Router ID 13.0.0.2
Interfaces
Area: 0.0.0.0 (MPLS TE not enabled)
IP Address Type State Cost Pri DR BDR
13.0.0.2 Broadcast BDR 1 1 13.0.0.1 13.0.0.2
23.0.0.2 Broadcast BDR 1 1 23.0.0.1 23.0.0.2
Area: 0.0.0.3 (MPLS TE not enabled)
IP Address Type State Cost Pri DR BDR
3.0.0.1 P2P P-2-P 0 1 0.0.0.0 0.0.0.0
192.168.0.1 P2P P-2-P 0 1 0.0.0.0 0.0.0.0
最后检查路由表、并测试全网互通。
这里以R1去ping通R3为例“