实验名称:OSPF 不连续区域进行通信配置; 实验目的:在不连续的区域间进行全网通信; 实验准备: 首先,准备六台路由器,三台PC机。
PC1:IP地址:100.1.1.1 子网掩码:255.255.255.0
PC2:IP地址:100.1.2.2 子网掩码:255.255.255.0
PC3:IP地址:100.1.3.3 子网掩码:255.255.255.0
R1:IP地址以及子网掩码、loopback 地址:
Gig0/0/0口:IP地址:192.168.12.1 子网掩码:255.255.255.0
Gig0/0/1口:IP地址:192.168.14.1 子网掩码:255.255.255.0
loopback 地址:10.10.1.1 子网掩码:255.255.255.0
R2:IP地址以及子网掩码、loopback 地址:
Gig0/0/1口:IP地址:192.168.12.2 子网掩码:255.255.255.0
Gig0/0/0口:IP地址:192.168.23.2 子网掩码:255.255.255.0
loopback 地址:10.10.2.2 子网掩码:255.255.255.0
R3:IP地址以及子网掩码、loopback 地址:
Gig0/0/0口:IP地址:192.168.43.3 子网掩码:255.255.255.0
Gig0/0/1口:IP地址:192.168.23.3 子网掩码:255.255.255.0
Gig0/0/2口:IP地址:192.168.35.3 子网掩码:255.255.255.0
loopback 地址:10.10.3.3 子网掩码:255.255.255.0
R4:IP地址以及子网掩码、loopback 地址:
Gig0/0/1口:IP地址:192.168.14.2 子网掩码:255.255.255.0
Gig0/0/2口:IP地址:100.1.1.254 子网掩码:255.255.255.0
Gig0/0/0口:IP地址:192.168.46.4 子网掩码:255.255.255.0
Gig4/0/0口:IP地址:192.168.43.4 子网掩码:255.255.255.0
loopback 地址:10.10.4.4 子网掩码:255.255.255.0
R5:IP地址以及子网掩码、loopback 地址:
Gig0/0/2口:IP地址:192.168.35.5 子网掩码:255.255.255.0
Gig0/0/1口:IP地址:100.3.3.254 子网掩码:255.255.255.0
loopback 地址:10.10.5.5 子网掩码:255.255.255.0
R6:IP地址以及子网掩码、loopback 地址:
Gig0/0/0口:IP地址:192.168.46.6 子网掩码:255.255.255.0
Gig0/0/1口:IP地址:100.2.2.254 子网掩码:255.255.255.0
loopback 地址:10.10.6.6 子网掩码:255.255.255.0
拓扑结构如下图所示:
首先为R1配置IP地址、子网掩码以及loopback地址:
[R1]interface GigabitEthernet 0/0/0 [R1-GigabitEthernet0/0/0]ip address 192.168.12.1 255.255.255.0 [R1-GigabitEthernet0/0/0]undo shutdown
[R1]interface GigabitEthernet 0/0/1 [R1-GigabitEthernet0/0/1]ip address 192.168.14.1 255.255.255.0 [R1-GigabitEthernet0/0/1]undo shutdown
[R1]interface LoopBack 0 [R1-LoopBack0]ip address 10.10.1.1 255.255.255.0
R2配置IP地址、子网掩码以及loopback地址:
[R2]interface GigabitEthernet 0/0/1 [R2-GigabitEthernet0/0/1]ip address 192.168.12.2 255.255.255.0 [R2-GigabitEthernet0/0/1]undo shutdown
[R2]interface GigabitEthernet 0/0/0 [R2-GigabitEthernet0/0/0]ip address 192.168.23.2 255.255.255.0 [R2-GigabitEthernet0/0/0]undo shutdown
[R2]interface LoopBack 0 [R2-LoopBack0]ip address 10.10.2.2 255.255.255.0
R3配置IP地址、子网掩码以及loopback地址:
[R3]interface GigabitEthernet 0/0/1 [R3-GigabitEthernet0/0/1]ip address 192.168.23.3 255.255.255.0 [R3-GigabitEthernet0/0/1]undo shutdown
[R3]interface GigabitEthernet 0/0/2 [R3-GigabitEthernet0/0/2]ip address 192.168.35.3 255.255.255.0 [R3-GigabitEthernet0/0/2]undo shutdown
[R3]interface LoopBack 0 [R3-LoopBack0]ip address 10.10.3.3 255.255.255.0
R4配置IP地址、子网掩码以及loopback地址:
[R4]interface GigabitEthernet 0/0/1 [R4-GigabitEthernet0/0/1]ip address 192.168.14.2 255.255.255.0 [R4-GigabitEthernet0/0/1]undo shutdown
[R4]interface GigabitEthernet 0/0/0 [R4-GigabitEthernet0/0/0]ip address 192.168.46.4 255.255.255.0 [R4-GigabitEthernet0/0/0]undo shutdown
[R4]interface GigabitEthernet 0/0/2 [R4-GigabitEthernet0/0/2]ip address 100.1.1.254 255.255.255.0 [R4-GigabitEthernet0/0/2]undo shutdown
[R4]interface GigabitEthernet 4/0/0 [R4-GigabitEthernet4/0/0]ip address 192.168.43.4 255.255.255.0 [R4-GigabitEthernet4/0/0]undo shutdown
[R4]interface LoopBack 0 [R4-LoopBack0]ip address 10.10.4.4 255.255.255.0
R5配置IP地址、子网掩码以及loopback地址:
[R5]interface GigabitEthernet 0/0/2 [R5-GigabitEthernet0/0/2]ip address 192.168.35.5 255.255.255.0 [R5-GigabitEthernet0/0/2]undo shutdown
[R5]interface GigabitEthernet 0/0/1 [R5-GigabitEthernet0/0/1]ip address 100.3.3.254 255.255.255.0 [R5-GigabitEthernet0/0/1]undo shutdown
[R5]interface LoopBack 0 [R5-LoopBack0]ip address 10.10.5.5 255.255.255.0
R6配置IP地址、子网掩码以及loopback地址:
[R6]interface GigabitEthernet 0/0/0 [R6-GigabitEthernet0/0/0]ip address 192.168.46.6 255.255.255.0 [R6-GigabitEthernet0/0/0]undo shutdown
[R6]interface GigabitEthernet 0/0/2 [R6-GigabitEthernet0/0/2]ip address 10.2.2.254 255.255.255.0 [R6-GigabitEthernet0/0/2]undo shutdown
[R6]interface LoopBack 0 [R6-LoopBack0]ip address 10.10.6.6 255.255.255.0
其次,分别为每一台路由器配置OSPF:
R1配置:
[R1]ospf router-id 1.1.1.1 [R1-ospf-1]area 0 [R1-ospf-1-area-0.0.0.0]network 192.168.12.1 0.0.0.0 [R1-ospf-1-area-0.0.0.0]network 10.10.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]area 14 [R1-ospf-1-area-0.0.0.14]network 192.168.14.1 0.0.0.0
R2配置:
[R2]ospf router-id 2.2.2.2 [R2-ospf-1]area 0 [R2-ospf-1-area-0.0.0.0]network 192.168.12.2 0.0.0.0 [R2-ospf-1-area-0.0.0.0]network 192.168.23.2 0.0.0.0 [R2-ospf-1-area-0.0.0.0]network 10.10.2.2 0.0.0.0
R3配置 :
[R3]ospf router-id 3.3.3.3 [R3-ospf-1]area 0 [R3-ospf-1-area-0.0.0.0]network 192.168.23.3 0.0.0.0 [R3-ospf-1-area-0.0.0.0]network 10.10.3.3 0.0.0.0 [R3-ospf-1-area-0.0.0.0]network 192.168.43.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]area 35 [R3-ospf-1-area-0.0.0.35]network 192.168.35.3 0.0.0.0
R4配置 :
[R4]ospf router-id 4.4.4.4 [R4-ospf-1]area 14 [R4-ospf-1-area-0.0.0.14]network 192.168.14.2 0.0.0.0 [R4-ospf-1-area-0.0.0.0]network 192.168.43.4 0.0.0.0 [R4-ospf-1-area-0.0.0.14]network 100.1.1.254 0.0.0.0 [R4-ospf-1-area-0.0.0.14]network 10.10.4.4 0.0.0.0
[R4-ospf-1-area-0.0.0.14]area 46
[R4-ospf-1-area-0.0.0.46]network 192.168.46.4 0.0.0.0
R5配置 :
[R5]ospf router-id 5.5.5.5 [R5-ospf-1]area 35 [R5-ospf-1-area-0.0.0.35]network 192.168.35.5 0.0.0.0 [R5-ospf-1-area-0.0.0.35]network 10.10.5.5 0.0.0.0 [R5-ospf-1-area-0.0.0.35]network 100.3.3.254 0.0.0.0
R6配置:
[R6]ospf router-id 6.6.6.6 [R6-ospf-1]area 46 [R6-ospf-1-area-0.0.0.46]network 192.168.46.6 0.0.0.0 [R6-ospf-1-area-0.0.0.46]network 10.10.6.6 0.0.0.0 [R6-ospf-1-area-0.0.0.46]network 100.2.2.254 0.0.0.0
在R1和R4上做NSSA 配置:
[R1]ospf 1 [R1-ospf-1]area 14 [R1-ospf-1-area-0.0.0.14]nssa
[R4]ospf 1 [R4-ospf-1]area 14 [R4-ospf-1-area-0.0.0.14]nssa
在R4和R5路由器上做重分发:
[R4]ospf [R4-ospf-1]import-route direct
[R5]ospf 1 [R5-ospf-1]import-route direct
验证: 如下图所示:
PC1 ping PC3: