小型公司 --- 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
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:
小型公司 --- OSPF 不連續區域進行通信配置