1 OSPF 单区域配置
1.1 问题
1)企业内网存在多个部门,分别属于不同的网段
2)使用最佳的技术方案,实现灵活的网络设计,支持网络规模的扩展
3)如图,配置设备 IP 地址
4)确保 PC-1 和 PC-2 可以互通
1.2 方案
搭建实验环境,如图 - 1 所示。
图 - 1
1.3 步骤
实现此案例需要按照如下步骤进行。
1)配置终端设备 - PC1
地址:192.168.1.1
掩码:255.255.255.0
网关:192.168.1.254
2)配置终端设备 - PC2
地址:192.168.2.1
掩码:255.255.255.0
网关:192.168.2.254
3)配置网络设备 - R1
1. <Huawei>system-view
2. \[Huawei\]sysname R1
4. \[R1\]interface GigabitEthernet 0/0/2
5. \[R1-GigabitEthernet 0/0/2\] ip address 192.168.1.254 255.255.255.0
6. \[R1-GigabitEthernet 0/0/2\] quit
8. \[R1\]interface GigabitEthernet 0/0/0
9. \[R1-GigabitEthernet 0/0/0\] ip address 192.168.12.1 255.255.255.0
10. \[R1-GigabitEthernet 0/0/0\] quit
4)配置网络设备 - R2
1. <Huawei>system-view
2. \[Huawei\]sysname R2
4. \[R2\]interface gi0/0/0
5. \[R2-GigabitEthernet 0/0/0\] ip address 192.168.23.2 255.255.255.0
6. \[R2-GigabitEthernet 0/0/0\] quit
8. \[R2\]interface gi0/0/1
9. \[R2-GigabitEthernet 0/0/1\] ip address 192.168.12.2 255.255.255.0
10. \[R2-GigabitEthernet 0/0/1\] quit
5)配置网络设备 - R3
1. <Huawei>system-view
2. \[Huawei\]sysname R3
4. \[R3\]interface GigabitEthernet 0/0/2
5. \[R3-GigabitEthernet 0/0/2\] ip address 192.168.2.254 255.255.255.0
6. \[R3-GigabitEthernet 0/0/2\] quit
8. \[R3\]interface GigabitEthernet 0/0/1
9. \[R3-GigabitEthernet 0/0/1\] ip address 192.168.23.3 255.255.255.0
10. \[R3-GigabitEthernet 0/0/1\] quit
6)配置 OSPF 区域 0
1. \[R1\]ospf 1
2. \[R1-ospf-1\]area 0
3. \[R1-ospf-1-area-0.0.0.0\]network 192.168.12.0 0.0.0.255
4. \[R1-ospf-1-area-0.0.0.0\]network 192.168.1.0 0.0.0.255
5. \[R1-ospf-1-area-0.0.0.0\]quit
7. \[R2\]ospf 2
8. \[R2-ospf-2\]area 0
9. \[R2-ospf-2-area-0.0.0.0\]network 192.168.12.0 0.0.0.255
10. \[R2-ospf-2-area-0.0.0.0\]network 192.168.23.0 0.0.0.255
11. \[R2-ospf-2-area-0.0.0.0\]quit
13. \[R3\]ospf 3
14. \[R3-ospf-3\]area 0
15. \[R3-ospf-3-area-0.0.0.0\]network 192.168.23.0 0.0.0.255
16. \[R3-ospf-3-area-0.0.0.0\]network 192.168.2.0 0.0.0.255
17. \[R3-ospf-3-area-0.0.0.0\]quit
2 OSPF 多区域配置
2.1 问题
1)企业核心机房,连接不同楼宇,实现不同楼宇互通
2)企业核心机房设置为 OSPF 骨干区域
3)其他办公楼宇为 非骨干区域,通过路由器与核心机房互联互通
2.2 方案
搭建实验环境,如图 - 2 所示。
图 - 2
2.3 步骤
实现此案例需要按照如下步骤进行。
1)配置 OSPF - R1
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R1
4. \[R1\]interface GigabitEthernet 0/0/0
5. \[R1-GigabitEthernet0/0/0\]ip add 192.168.12.1 24
6. \[R1-GigabitEthernet0/0/0\]quit
7. \[R1\]interface GigabitEthernet 0/0/2
8. \[R1-GigabitEthernet0/0/2\]ip add 192.168.1.254 24
9. \[R1-GigabitEthernet0/0/2\]quit
11. \[R1\]ospf 1 router-id 1.1.1.1
12. \[R1-ospf-1\]area 12
13. \[R1-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
14. \[R1-ospf-1-area-0.0.0.12\]network 192.168.1.0 0.0.0.255
15. \[R1-ospf-1-area-0.0.0.12\]quit
2)配置 OSPF – R2
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R2
4. \[R2\]interface GigabitEthernet 0/0/1
5. \[R2-GigabitEthernet0/0/1\]ip add 192.168.12.2 24
6. \[R2-GigabitEthernet0/0/1\]quit
8. \[R2\]interface GigabitEthernet 0/0/0
9. \[R2-GigabitEthernet0/0/0\]ip add 192.168.23.2 24
10. \[R2-GigabitEthernet0/0/0\]quit
12. \[R2\]ospf 1 router-id 2.2.2.2
13. \[R2-ospf-1\]area 12
14. \[R2-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
15. \[R2-ospf-1-area-0.0.0.12\]quit
16. \[R2-ospf-1\]area 0
17. \[R2-ospf-1-area-0.0.0.0\]network 192.168.23.0 0.0.0.255
18. \[R2-ospf-1-area-0.0.0.0\]quit
3)配置 OSPF – R3
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R3
4. \[R3\]interface GigabitEthernet 0/0/1
5. \[R3-GigabitEthernet0/0/1\]ip add 192.168.23.3 24
6. \[R3-GigabitEthernet0/0/1\]quit
8. \[R3\]interface GigabitEthernet 0/0/0
9. \[R3-GigabitEthernet0/0/0\]ip add 192.168.34.3 24
10. \[R3-GigabitEthernet0/0/0\]quit
12. \[R3\]ospf 1 router-id 3.3.3.3
13. \[R3-ospf-1\]area 0
14. \[R3-ospf-1-area-0.0.0.0\]network 192.168.23.0 0.0.0.255
15. \[R3-ospf-1-area-0.0.0.0\]network 192.168.34.0 0.0.0.255
16. \[R3-ospf-1-area-0.0.0.0\]quit
4)配置 OSPF – R4
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R4
4. \[R4\]interface GigabitEthernet 0/0/1
5. \[R4-GigabitEthernet0/0/1\]ip add 192.168.34.4 24
6. \[R4-GigabitEthernet0/0/1\]quit
8. \[R4\]interface GigabitEthernet 0/0/0
9. \[R4-GigabitEthernet0/0/0\]ip add 192.168.45.4 24
10. \[R4-GigabitEthernet0/0/0\]quit
12. \[R4\]ospf 1 router-id 4.4.4.4
13. \[R4-ospf-1\]area 0
14. \[R4-ospf-1-area-0.0.0.0\]network 192.168.45.0 0.0.0.255
15. \[R4-ospf-1-area-0.0.0.0\]network 192.168.34.0 0.0.0.255
16. \[R4-ospf-1-area-0.0.0.0\]quit
5)配置 OSPF – R5
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R5
4. \[R5\]interface GigabitEthernet 0/0/1
5. \[R5-GigabitEthernet0/0/1\]ip add 192.168.45.5 24
6. \[R5-GigabitEthernet0/0/1\]quit
8. \[R5\]interface GigabitEthernet 0/0/0
9. \[R5-GigabitEthernet0/0/0\]ip add 192.168.56.5 24
10. \[R5-GigabitEthernet0/0/0\]quit
12. \[R5\]ospf 1 router-id 5.5.5.5
13. \[R5-ospf-1\]area 56
14. \[R5-ospf-1-area-0.0.0.56\]network 192.168.56.0 0.0.0.255
15. \[R5-ospf-1-area-0.0.0.56\]quit
16. \[R5-ospf-1\]area 0
17. \[R5-ospf-1-area-0.0.0.0\]network 192.168.45.0 0.0.0.255
18. \[R5-ospf-1-area-0.0.0.0\]quit
6)配置 OSPF – R6
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R6
4. \[R6\]interface GigabitEthernet 0/0/1
5. \[R6-GigabitEthernet0/0/1\]ip add 192.168.56.6 24
6. \[R6-GigabitEthernet0/0/1\]quit
7. \[R6\]interface GigabitEthernet 0/0/2
8. \[R6-GigabitEthernet0/0/2\]ip add 192.168.2.254 24
9. \[R6-GigabitEthernet0/0/2\]quit
11. \[R6\]ospf 1 router-id 6.6.6.6
12. \[R6-ospf-1\]area 56
13. \[R6-ospf-1-area-0.0.0.56\]network 192.168.56.0 0.0.0.255
14. \[R6-ospf-1-area-0.0.0.56\]network 192.168.2.0 0.0.0.255
15. \[R6-ospf-1-area-0.0.0.56\]quit
7)确保 PC-1 和 PC-2 互通
1. PC-1>ping 192.168.2.1
2. Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to break
3. From 192.168.2.1: bytes=32 seq=1 ttl=125 time=31 ms
4. From 192.168.2.1: bytes=32 seq=2 ttl=125 time=31 ms
5. From 192.168.2.1: bytes=32 seq=3 ttl=125 time=16 ms
6. From 192.168.2.1: bytes=32 seq=4 ttl=125 time=16 ms
7. From 192.168.2.1: bytes=32 seq=5 ttl=125 time=31 ms
9. \-\-\- 192.168.2.1 ping statistics \-\-\-
10. 5 packet(s) transmitted
11. 5 packet(s) received
12. 0.00% packet loss
13. round-trip min/avg/max = 16/25/31 ms
15. PC-2>ping 192.168.1.1
16. Ping 192.168.1.1: 32 data bytes, Press Ctrl_C to break
17. From 192.168.1.1: bytes=32 seq=1 ttl=125 time=16 ms
18. From 192.168.1.1: bytes=32 seq=2 ttl=125 time=31 ms
19. From 192.168.1.1: bytes=32 seq=3 ttl=125 time=31 ms
20. From 192.168.1.1: bytes=32 seq=4 ttl=125 time=32 ms
21. From 192.168.1.1: bytes=32 seq=5 ttl=125 time=31 ms
23. \-\-\- 192.168.1.1 ping statistics \-\-\-
24. 5 packet(s) transmitted
25. 5 packet(s) received
26. 0.00% packet loss
27. round-trip min/avg/max = 16/28/32 ms
3 OSPF 特殊区域之 Stub
3.1 问题
1)两公司之间不运行 OSPF 协议,通过静态路由互通
2)企业内部重要区域 (Area 12) 不希望受到外部链路的抖动的影响
3)如果可以优化,确保区域 12 也不受到其他区域的链路的影响
3.2 方案
搭建实验环境,如图 - 3 所示。
图 - 3
3.3 步骤
实现此案例需要按照如下步骤进行。
1)配置终端设备 - PC1/2/3
PC-1:
192.168.1.1
255.255.255.0
192.168.1.254
PC-2:
192.168.2.1
255.255.255.0
192.168.2.254
PC-3:
192.168.3.1
255.255.255.0
192.168.3.254
2)配置 OSPF - R1
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R1
4. \[R1\]interface GigabitEthernet 0/0/0
5. \[R1-GigabitEthernet0/0/0\]ip add 192.168.12.1 24
6. \[R1-GigabitEthernet0/0/0\]quit
7. \[R1\]interface GigabitEthernet 0/0/2
8. \[R1-GigabitEthernet0/0/2\]ip add 192.168.1.254 24
9. \[R1-GigabitEthernet0/0/2\]quit
11. \[R1\]ospf 1 router-id 1.1.1.1
12. \[R1-ospf-1\]area 12
13. \[R1-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
14. \[R1-ospf-1-area-0.0.0.12\]network 192.168.1.0 0.0.0.255
15. \[R1-ospf-1-area-0.0.0.12\]quit
3)配置 OSPF – R2
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R2
4. \[R2\]interface GigabitEthernet 0/0/1
5. \[R2-GigabitEthernet0/0/1\]ip add 192.168.12.2 24
6. \[R2-GigabitEthernet0/0/1\]quit
8. \[R2\]interface GigabitEthernet 0/0/0
9. \[R2-GigabitEthernet0/0/0\]ip add 192.168.23.2 24
10. \[R2-GigabitEthernet0/0/0\]quit
12. \[R2\]ospf 1 router-id 2.2.2.2
13. \[R2-ospf-1\]area 12
14. \[R2-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
15. \[R2-ospf-1-area-0.0.0.12\]quit
16. \[R2-ospf-1\]area 0
17. \[R2-ospf-1-area-0.0.0.0\]network 192.168.23.0 0.0.0.255
18. \[R2-ospf-1-area-0.0.0.0\]quit
4)配置 OSPF – R3
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R3
4. \[R3\]interface GigabitEthernet 0/0/1
5. \[R3-GigabitEthernet0/0/1\]ip add 192.168.23.3 24
6. \[R3-GigabitEthernet0/0/1\]quit
8. \[R3\]interface GigabitEthernet 0/0/0
9. \[R3-GigabitEthernet0/0/0\]ip add 192.168.34.3 24
10. \[R3-GigabitEthernet0/0/0\]quit
12. \[R3\]ospf 1 router-id 3.3.3.3
13. \[R3-ospf-1\]area 0
14. \[R3-ospf-1-area-0.0.0.0\]network 192.168.23.0 0.0.0.255
15. \[R3-ospf-1-area-0.0.0.0\]network 192.168.34.0 0.0.0.255
16. \[R3-ospf-1-area-0.0.0.0\]quit
5)配置 OSPF – R4
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R4
4. \[R4\]interface GigabitEthernet 0/0/1
5. \[R4-GigabitEthernet0/0/1\]ip add 192.168.34.4 24
6. \[R4-GigabitEthernet0/0/1\]quit
8. \[R4\]interface GigabitEthernet 0/0/0
9. \[R4-GigabitEthernet0/0/0\]ip add 192.168.45.4 24
10. \[R4-GigabitEthernet0/0/0\]quit
12. \[R4\]ospf 1 router-id 4.4.4.4
13. \[R4-ospf-1\]area 0
14. \[R4-ospf-1-area-0.0.0.0\]network 192.168.45.0 0.0.0.255
15. \[R4-ospf-1-area-0.0.0.0\]network 192.168.34.0 0.0.0.255
16. \[R4-ospf-1-area-0.0.0.0\]quit
6)配置 OSPF – R5
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R5
4. \[R5\]interface GigabitEthernet 0/0/1
5. \[R5-GigabitEthernet0/0/1\]ip add 192.168.45.5 24
6. \[R5-GigabitEthernet0/0/1\]quit
8. \[R5\]interface GigabitEthernet 0/0/0
9. \[R5-GigabitEthernet0/0/0\]ip add 192.168.56.5 24
10. \[R5-GigabitEthernet0/0/0\]quit
12. \[R5\]ospf 1 router-id 5.5.5.5
13. \[R5-ospf-1\]area 56
14. \[R5-ospf-1-area-0.0.0.56\]network 192.168.56.0 0.0.0.255
15. \[R5-ospf-1-area-0.0.0.56\]quit
16. \[R5-ospf-1\]area 0
17. \[R5-ospf-1-area-0.0.0.0\]network 192.168.45.0 0.0.0.255
18. \[R5-ospf-1-area-0.0.0.0\]quit
7)配置 OSPF – R6
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R6
4. \[R6\]interface GigabitEthernet 0/0/1
5. \[R6-GigabitEthernet0/0/1\]ip add 192.168.56.6 24
6. \[R6-GigabitEthernet0/0/1\]quit
7. \[R6\]interface GigabitEthernet 0/0/2
8. \[R6-GigabitEthernet0/0/2\]ip add 192.168.2.254 24
9. \[R6-GigabitEthernet0/0/2\]quit
10. \[R6\]interface GigabitEthernet 0/0/0
11. \[R6-GigabitEthernet0/0/0\]ip add 192.168.67.6 24
12. \[R6-GigabitEthernet0/0/0\]quit
15. \[R6\]ospf 1 router-id 6.6.6.6
16. \[R6-ospf-1\]area 56
17. \[R6-ospf-1-area-0.0.0.56\]network 192.168.56.0 0.0.0.255
18. \[R6-ospf-1-area-0.0.0.56\]network 192.168.2.0 0.0.0.255
19. \[R6-ospf-1-area-0.0.0.56\]quit
21. \[R6\] ip route-static 192.168.3.0 24 192.168.67.7
8)配置 R7
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R7
4. \[R7\]interface GigabitEthernet 0/0/1
5. \[R7-GigabitEthernet0/0/1\]ip add 192.168.67.7 24
6. \[R7-GigabitEthernet0/0/1\]quit
8. \[R7\]interface GigabitEthernet 0/0/2
9. \[R7-GigabitEthernet0/0/2\]ip add 192.168.3.254 24
10. \[R7-GigabitEthernet0/0/2\]quit
12. \[R7\] ip route-static 192.168.0.0 16 192.168.67.6
9)R6 宣告引入外部路由
1. \[R6\]ospf 1 router-id 6.6.6.6
2. \[R6-ospf-1\] import-route static
10)配置区域 12 为 Stub 区域
1. \[R1\]ospf 1
2. \[R1-ospf-1\]area 12
3. \[R1-ospf-1-area-0.0.0.12\]stub
5. \[R2\]ospf 1
6. \[R2-ospf-1\]area 12
7. \[R2-ospf-1-area-0.0.0.12\]stub
11)配置区域 12 为 Totally Stub 区域
1. \[R2\]ospf 1
2. \[R2-ospf-1\]area 12
3. \[R2-ospf-1-area-0.0.0.12\]stub no-summary
4 OSPF 特殊区域之 NSSA
4.1 问题
1)企业内网运行 OSPF,经运营商访问公司架设在公网的 “服务器”
2)期望区域 123 不收到外部运营商链路的不稳定的影响
3)“合作公司”与 “企业” 有特定业务合作,要求经过公司访问部署在 “运营商” 的业务服务器
4)如果可以的话,期望区域 123 也不要收到其他的区域的链路的影响
4.2 方案
搭建实验环境,如图 - 4 所示。
/
图 - 4
4.3 步骤
实现此案例需要按照如下步骤进行。
1)配置终端设备 - PC1/Server1
PC-1:
192.168.1.1
255.255.255.0
192.168.1.254
Server-1:
192.168.2.1
255.255.255.0
192.168.2.254
2)配置 OSPF - R1
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R1
4. \[R1\]interface GigabitEthernet 0/0/0
5. \[R1-GigabitEthernet0/0/0\]ip add 192.168.12.1 24
6. \[R1-GigabitEthernet0/0/0\]quit
7. \[R1\]interface GigabitEthernet 0/0/1
8. \[R1-GigabitEthernet0/0/1\]ip add 192.168.16.1 24
9. \[R1-GigabitEthernet0/0/1\]quit
11. \[R1\]ospf 1 router-id 1.1.1.1
12. \[R1-ospf-1\]area 123
13. \[R1-ospf-1-area-0.0.0.123\]network 192.168.12.0 0.0.0.255
14. \[R1-ospf-1-area-0.0.0.123\]quit
3)配置 OSPF – R2
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R2
4. \[R2\]interface GigabitEthernet 0/0/1
5. \[R2-GigabitEthernet0/0/1\]ip add 192.168.12.2 24
6. \[R2-GigabitEthernet0/0/1\]quit
8. \[R2\]interface GigabitEthernet 0/0/0
9. \[R2-GigabitEthernet0/0/0\]ip add 192.168.23.2 24
10. \[R2-GigabitEthernet0/0/0\]quit
12. \[R2\]ospf 1 router-id 2.2.2.2
13. \[R2-ospf-1\]area 123
14. \[R2-ospf-1-area-0.0.0.123\]network 192.168.12.0 0.0.0.255
15. \[R2-ospf-1-area-0.0.0.123\]network 192.168.23.0 0.0.0.255
4)配置 OSPF – R3
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R3
4. \[R3\]interface GigabitEthernet 0/0/1
5. \[R3-GigabitEthernet0/0/1\]ip add 192.168.23.3 24
6. \[R3-GigabitEthernet0/0/1\]quit
8. \[R3\]interface GigabitEthernet 0/0/0
9. \[R3-GigabitEthernet0/0/0\]ip add 192.168.34.3 24
10. \[R3-GigabitEthernet0/0/0\]quit
12. \[R3\]ospf 1 router-id 3.3.3.3
13. \[R3-ospf-1\]area 0
14. \[R3-ospf-1-area-0.0.0.0\]network 192.168.34.0 0.0.0.255
15. \[R3-ospf-1-area-0.0.0.0\]quit
16. \[R3-ospf-1\]area 123
17. \[R3-ospf-1-area-0.0.0.123\] network 192.168.23.0 0.0.0.255
18. \[R3-ospf-1-area-0.0.0.0\]quit
5)配置 OSPF – R4
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R4
4. \[R4\]interface GigabitEthernet 0/0/1
5. \[R4-GigabitEthernet0/0/1\]ip add 192.168.34.4 24
6. \[R4-GigabitEthernet0/0/1\]quit
8. \[R4\]interface GigabitEthernet 0/0/0
9. \[R4-GigabitEthernet0/0/0\]ip add 192.168.45.4 24
10. \[R4-GigabitEthernet0/0/0\]quit
12. \[R4\]ospf 1 router-id 4.4.4.4
13. \[R4-ospf-1\]area 0
14. \[R4-ospf-1-area-0.0.0.0\]network 192.168.34.0 0.0.0.255
15. \[R4-ospf-1-area-0.0.0.0\]quit
17. \[R4\]ip route-static 0.0.0.0 0 192.168.45.5
19. \[R4\]ospf 1
20. \[R4-ospf-1\]default-route-advertise
6)配置 OSPF – R5
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R5
4. \[R5\]interface GigabitEthernet 0/0/1
5. \[R5-GigabitEthernet0/0/1\]ip add 192.168.45.5 24
6. \[R5-GigabitEthernet0/0/1\]quit
8. \[R5\]interface GigabitEthernet 0/0/2
9. \[R5-GigabitEthernet0/0/2\]ip add 192.168.2.254 24
10. \[R5-GigabitEthernet0/0/2\]quit
12. \[R5\]ip route-static 192.168.0.0 16 192.168.45.4
7)配置 R6
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R6
4. \[R6\]interface GigabitEthernet 0/0/0
5. \[R6-GigabitEthernet0/0/0\]ip add 192.168.16.6 24
6. \[R6-GigabitEthernet0/0/0\]quit
7. \[R6\]interface GigabitEthernet 0/0/2
8. \[R6-GigabitEthernet0/0/2\]ip add 192.168.1.254 24
9. \[R6-GigabitEthernet0/0/2\]quit
11. \[R6\]ip route-static 192.168.2.0 24 192.168.16.1
8)配置 R1 与 PC1 互通
1. \[R1\] ip route-static 192.168.1.0 16 192.168.16.6
9)将区域 123 配置为 NSSA 区域
1. \[R1\]ospf 1
2. \[R1-ospf-1\]area 123
3. \[R1-ospf-1-area-0.0.0.123\]nssa
5. \[R2\]ospf 1
6. \[R2-ospf-1\]area 123
7. \[R2-ospf-1-area-0.0.0.123\]nssa
9. \[R3\]ospf 1
10. \[R3-ospf-1\]area 123
11. \[R3-ospf-1-area-0.0.0.123\]nssa
10)在 R1 上引入静态路由
1. \[R1\]ospf 1
2. \[R1-ospf-1\]import-route static
11)配置区域 123 为 Totally NSSA 区域
1. \[R3\]ospf 1
2. \[R3-ospf-1\]area 123
3. \[R3-ospf-1-area-0.0.0.123\]nssa no-summary
5 OSPF 汇总之域间路由
5.1 需求描述
1)企业内网运行多区域的 OSPF 网络,在 R1 上存在多个不稳定的链路
2)R1 上的不稳定链路,会影响到骨干区域的稳定性
3)希望通过技术方案,降低区域 12 的不稳定性对区域 0 的影响
5.2 方案
搭建实验环境,如图 - 5 所示。
图 - 5
5.3 步骤
实现此案例需要按照如下步骤进行。
1)配置 OSPF - R1
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R1
4. \[R1\]interface GigabitEthernet 0/0/0
5. \[R1-GigabitEthernet0/0/0\]ip add 192.168.12.1 24
6. \[R1-GigabitEthernet0/0/0\]quit
8. \[R1\]interface LoopBack 1
9. \[R1-LoopBack1\]ip address 10.10.1.1 24
10. \[R1-LoopBack1\]quit
12. \[R1\]interface LoopBack 2
13. \[R1-LoopBack2\]ip address 10.10.2.2 24
14. \[R1-LoopBack2\]quit
16. \[R1\]interface LoopBack 3
17. \[R1-LoopBack3\]ip address 10.10.3.3 24
18. \[R1-LoopBack3\]quit
20. \[R1\]interface LoopBack 4
21. \[R1-LoopBack4\]ip address 10.10.4.4 24
22. \[R1-LoopBack4\]quit
24. \[R1\]ospf 1 router-id 1.1.1.1
25. \[R1-ospf-1\]area 12
26. \[R1-ospf-1-area-0.0.0.12\]network 10.10.1.0 0.0.0.255
27. \[R1-ospf-1-area-0.0.0.12\]network 10.10.2.0 0.0.0.255
28. \[R1-ospf-1-area-0.0.0.12\]network 10.10.3.0 0.0.0.255
29. \[R1-ospf-1-area-0.0.0.12\]network 10.10.4.0 0.0.0.255
30. \[R1-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
31. \[R1-ospf-1-area-0.0.0.12\]quit
2)配置 OSPF – R2
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R2
4. \[R2\]interface GigabitEthernet 0/0/1
5. \[R2-GigabitEthernet0/0/1\]ip add 192.168.12.2 24
6. \[R2-GigabitEthernet0/0/1\]quit
8. \[R2\]interface GigabitEthernet 0/0/0
9. \[R2-GigabitEthernet0/0/0\]ip add 192.168.23.2 24
10. \[R2-GigabitEthernet0/0/0\]quit
12. \[R2\]ospf 1 router-id 2.2.2.2
13. \[R2-ospf-1\]area 12
14. \[R2-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
15. \[R2-ospf-1-area-0.0.0.12\]quit
16. \[R2-ospf-1\]area 0
17. \[R2-ospf-1-area-0.0.0.0\]network 192.168.23.0 0.0.0.255
18. \[R2-ospf-1-area-0.0.0.0\]quit
3)配置 OSPF – R3
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R3
4. \[R3\]interface GigabitEthernet 0/0/1
5. \[R3-GigabitEthernet0/0/1\]ip add 192.168.23.3 24
6. \[R3-GigabitEthernet0/0/1\]quit
8. \[R3\]interface GigabitEthernet 0/0/0
9. \[R3-GigabitEthernet0/0/0\]ip add 192.168.34.3 24
10. \[R3-GigabitEthernet0/0/0\]quit
12. \[R3\]ospf 1 router-id 3.3.3.3
13. \[R3-ospf-1\]area 0
14. \[R3-ospf-1-area-0.0.0.0\]network 192.168.34.0 0.0.0.255
15. \[R3-ospf-1-area-0.0.0.0\]network 192.168.23.0 0.0.0.255
16. \[R3-ospf-1-area-0.0.0.0\]quit
4)配置 OSPF – R4
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R4
4. \[R4\]interface GigabitEthernet 0/0/1
5. \[R4-GigabitEthernet0/0/1\]ip add 192.168.34.4 24
6. \[R4-GigabitEthernet0/0/1\]quit
8. \[R4\]interface GigabitEthernet 0/0/0
9. \[R4-GigabitEthernet0/0/0\]ip add 192.168.45.4 24
10. \[R4-GigabitEthernet0/0/0\]quit
12. \[R4\]ospf 1 router-id 4.4.4.4
13. \[R4-ospf-1\]area 0
14. \[R4-ospf-1-area-0.0.0.0\]network 192.168.34.0 0.0.0.255
15. \[R4-ospf-1-area-0.0.0.0\]network 192.168.45.0 0.0.0.25
16. \[R4-ospf-1-area-0.0.0.0\]quit
5)配置 OSPF – R5
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R5
4. \[R5\]interface GigabitEthernet 0/0/1
5. \[R5-GigabitEthernet0/0/1\]ip add 192.168.45.5 24
6. \[R5-GigabitEthernet0/0/1\]quit
8. \[R5\]interface GigabitEthernet 0/0/0
9. \[R5-GigabitEthernet0/0/0\]ip add 192.168.56.5 24
10. \[R5-GigabitEthernet0/0/0\]quit
11. \[R5\]ospf 1 router-id 5.5.5.5
12. \[R5-ospf-1\]area 0
13. \[R5-ospf-1-area-0.0.0.0\]network 192.168.45.0 0.0.0.255
14. \[R5-ospf-1-area-0.0.0.0\]quit
15. \[R5-ospf-1\]area 56
16. \[R5-ospf-1-area-0.0.0.56\]network 192.168.56.0 0.0.0.25
17. \[R5-ospf-1-area-0.0.0.56\]quit
6)配置 OSPF – R6
1. <Huawei>undo terminal monitor
2. <Huawei>system-view
3. \[Huawei\]sysname R6
4. \[R6\]interface GigabitEthernet 0/0/1
5. \[R6-GigabitEthernet0/0/1\]ip add 192.168.56.6 24
6. \[R6-GigabitEthernet0/0/1\]quit
8. \[R6\]ospf 1 router-id 6.6.6.6
9. \[R6-ospf-1\]area 56
10. \[R6-ospf-1-area-0.0.0.56\]network 192.168.56.0 0.0.0.255
11. \[R6-ospf-1-area-0.0.0.56\]quit
7)配置 R2 的区域之间的路由汇总
1. \[R2\]ospf 1
2. \[R2-ospf-1\]area 12
3. \[R2-ospf-1-area-0.0.0.12\]abr-summary 10.10.0.0 255.255.0.0
https://tts.tmooc.cn/ttsPage/NTD/NTDTN202109/TCNE/DAY03/CASE/01/index.html