1 OSPF 汇总之外部路由
1.1 需求
1)企业内网运行多区域的 OSPF 网络,在 R6 上存在多个外部链路
2)R6 上的不稳定链路,会影响到骨干区域的稳定性
3)希望通过技术方案,降低外部链路的不稳定性对区域 0 的影响
1.2 方案
搭建实验环境,如图 - 1 所示。
图 - 1
1.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.255
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)配置 R6 的外部路由汇总
1. \[R6\]ospf 1
2. \[R6-ospf-1\]import-route direct
3. \[R6-ospf-1\]asbr-summary 10.60.0.0 255.255.0.0
2 OSPF 安全认证之链路认证
2.1 需求
1)企业内网运行多区域的 OSPF 网络,区域之间通过骨干区域互通
2)为了保证区域 0 的安全,需要确保骨干区域的邻居关系都必须是经过认证的,非法接入的路由器不能与骨干区域建立邻居关系
3)在属于区域 0 的链路上配置 OSPF 链路认证
4)R2-R3、R3-R4 配置明文认证,R4 和 R5 之间配置密文认证
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
8. \[R1\]ospf 1 router-id 1.1.1.1
9. \[R1-ospf-1\]area 12
10. \[R1-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
11. \[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
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 和 R3 之间的链路认证 - 明文认证,密码为 HCIE
1. \[R2\]interface GigabitEthernet 0/0/0
2. \[R2-GigabitEthernet0/0/0\]ospf authentication-mode simple cipher HCIE
3. \[R2-GigabitEthernet0/0/0\]quit
5. \[R3\]interface GigabitEthernet 0/0/1
6. \[R3-GigabitEthernet0/0/1\]ospf authentication-mode simple cipher HCIE
7. \[R3-GigabitEthernet0/0/1\]quit
8)配置 R3 和 R4 之间的链路认证 - 明文认证,密码为 HCIP
1. \[R3\]interface GigabitEthernet 0/0/0
2. \[R3-GigabitEthernet0/0/0\]ospf authentication-mode simple cipher HCIP
3. \[R3-GigabitEthernet0/0/0\]quit
5. \[R4\]interface GigabitEthernet 0/0/1
6. \[R4-GigabitEthernet0/0/1\]ospf authentication-mode simple cipher HCIP
7. \[R4-GigabitEthernet0/0/1\]quit
9)配置 R4 和 R5 之间的链路认证 - 密文认证,密码为 HCIA
1. \[R4\]interface GigabitEthernet 0/0/0
2. \[R4-GigabitEthernet0/0/0\]ospf authentication-mode md5 10 cipher HCIA
3. \[R4-GigabitEthernet0/0/0\]quit
5. \[R5\]interface GigabitEthernet 0/0/1
6. \[R5-GigabitEthernet0/0/1\]ospf authentication-mode md5 10 cipher HCIA
7. \[R5-GigabitEthernet0/0/1\]quit
3 OSPF 安全认证之区域认证
3.1 需求
1)企业内网运行多区域的 OSPF 网络,区域之间通过骨干区域互通
2)为了保证区域 0 的安全,需要确保骨干区域的邻居关系都必须是经过认证的,非法接入的路由器不能与骨干区域建立邻居关系
3)对属于区域 0 中的所有设备的所有接口进行 MD5 加密认证,密码为 HCIE
3.2 方案
搭建实验环境,如图 - 3 所示。
图 - 3
3.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\]ospf 1 router-id 1.1.1.1
9. \[R1-ospf-1\]area 12
10. \[R1-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
11. \[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
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)对区域 0 中的设备进行 “密文认证”,设置为密码为 HCIE
1. \[R2\]ospf 1
2. \[R2-ospf-1\]area 0
3. \[R2-ospf-1-area-0.0.0.0\]authentication-mode md5 7 cipher HCIE
4. \[R2-ospf-1-area-0.0.0.0\]quit
6. \[R3\]ospf 1
7. \[R3-ospf-1\]area 0
8. \[R3-ospf-1-area-0.0.0.0\]authentication-mode md5 7 cipher HCIE
9. \[R3-ospf-1-area-0.0.0.0\]quit
11. \[R4\]ospf 1
12. \[R4-ospf-1\]area 0
13. \[R4-ospf-1-area-0.0.0.0\]authentication-mode md5 7 cipher HCIE
14. \[R4-ospf-1-area-0.0.0.0\]quit
16. \[R5\]ospf 1
17. \[R5-ospf-1\]area 0
18. \[R5-ospf-1-area-0.0.0.0\]authentication-mode md5 7 cipher HCIE
19. \[R5-ospf-1-area-0.0.0.0\]qui
4 OSPF 不连续区域之虚链路
4.1 需求
1)企业内网运行多区域的 OSPF 网络,因网络规划问题,导致区域 12 没有连接到骨干区域
2)现因业务需要,需确保 R1 能和其他区域的设备实现快速互通
4.2 方案
搭建实验环境,如图 - 4 所示。
图 - 4
4.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\]ospf 1 router-id 1.1.1.1
9. \[R1-ospf-1\]area 12
10. \[R1-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
11. \[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 34
17. \[R2-ospf-1-area-0.0.0.34\]network 192.168.23.0 0.0.0.255
18. \[R2-ospf-1-area-0.0.0.34\]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 34
14. \[R3-ospf-1-area-0.0.0.34\]network 192.168.23.0 0.0.0.255
15. \[R3-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
16. \[R3-ospf-1-area-0.0.0.34\]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 34
14. \[R4-ospf-1-area-0.0.0.34\]network 192.168.45.0 0.0.0.255
15. \[R4-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
16. \[R4-ospf-1-area-0.0.0.34\]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 0
14. \[R5-ospf-1-area-0.0.0.0\]network 192.168.56.0 0.0.0.255
15. \[R5-ospf-1-area-0.0.0.0\]quit
16. \[R5-ospf-1\]area 34
17. \[R5-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
18. \[R5-ospf-1-area-0.0.0.34\]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 0
10. \[R6-ospf-1-area-0.0.0.0\]network 192.168.56.0 0.0.0.255
11. \[R6-ospf-1-area-0.0.0.0\]quit
7)穿越区域 34,在 R2 和 R5 之间建立虚链路
1. \[R2\]ospf 1
2. \[R2-ospf-1\]are
3. \[R2-ospf-1\]area 34
4. \[R2-ospf-1-area-0.0.0.34\]vlink-peer 5.5.5.5
5. \[R2-ospf-1-area-0.0.0.34\]quit
7. \[R5\]ospf 1
8. \[R5-ospf-1\]are
9. \[R5-ospf-1\]area 34
10. \[R5-ospf-1-area-0.0.0.34\]vlink-peer 2.2.2.2
11. \[R5-ospf-1-area-0.0.0.34\]quit
5 OSPF 不连续区域之多进程导入
5.1 需求
1)企业内网运行多区域的 OSPF 网络,因网络规划问题,导致区域 12 没有连接到骨干区域
2)现因业务需要,需确保 R1 能和其他区域的设备实现快速互通
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\]ospf 1 router-id 1.1.1.1
9. \[R1-ospf-1\]area 12
10. \[R1-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
11. \[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
17. \[R2\]ospf 3 router-id 2.2.2.2
18. \[R2-ospf-1\]area 34
19. \[R2-ospf-1-area-0.0.0.34\]network 192.168.23.0 0.0.0.255
20. \[R2-ospf-1-area-0.0.0.34\]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 34
14. \[R3-ospf-1-area-0.0.0.34\]network 192.168.23.0 0.0.0.255
15. \[R3-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
16. \[R3-ospf-1-area-0.0.0.34\]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 34
14. \[R4-ospf-1-area-0.0.0.34\]network 192.168.45.0 0.0.0.255
15. \[R4-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
16. \[R4-ospf-1-area-0.0.0.34\]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 0
14. \[R5-ospf-1-area-0.0.0.0\]network 192.168.56.0 0.0.0.255
15. \[R5-ospf-1-area-0.0.0.0\]quit
16. \[R5-ospf-1\]area 34
17. \[R5-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
18. \[R5-ospf-1-area-0.0.0.34\]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 0
10. \[R6-ospf-1-area-0.0.0.0\]network 192.168.56.0 0.0.0.255
11. \[R6-ospf-1-area-0.0.0.0\]quit
7)在 R2 上配置 OSPF 进程之间的互相导入
1. \[R2\]ospf 1
2. \[R2-ospf-1\]import-route ospf 3
4. \[R2\]ospf 3
5. \[R2-ospf-3\]import-route ospf 1
6 OSPF 不连续区域之 GRE 隧道
6.1 需求
1)企业内网运行多区域的 OSPF 网络,因网络规划问题,导致区域 12 没有连接到骨干区域
2)现因业务需要,需确保 R1 能和其他区域的设备实现快速互通
6.2 方案
搭建实验环境,如图 - 6 所示。
图 - 6
6.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\]ospf 1 router-id 1.1.1.1
9. \[R1-ospf-1\]area 12
10. \[R1-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
11. \[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\]interface LoopBack 25
13. \[R2-LoopBack25\]ip address 10.10.25.2 32
14. \[R2-LoopBack25\]quit
16. \[R2\]ospf 1 router-id 2.2.2.2
17. \[R2-ospf-1\]area 12
18. \[R2-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
19. \[R2-ospf-1-area-0.0.0.12\]quit
20. \[R2-ospf-1\]area 34
21. \[R2-ospf-1-area-0.0.0.34\]network 192.168.23.0 0.0.0.255
22. \[R2-ospf-1-area-0.0.0.34\]network 10.10.25.2 0.0.0.0
23. \[R2-ospf-1-area-0.0.0.34\]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 34
14. \[R3-ospf-1-area-0.0.0.34\]network 192.168.23.0 0.0.0.255
15. \[R3-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
16. \[R3-ospf-1-area-0.0.0.34\]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 34
14. \[R4-ospf-1-area-0.0.0.34\]network 192.168.45.0 0.0.0.255
15. \[R4-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
16. \[R4-ospf-1-area-0.0.0.34\]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\]interface LoopBack 25
13. \[R5-LoopBack25\]ip address 10.10.25.5 32
14. \[R5-LoopBack25\]quit
16. \[R5\]ospf 1 router-id 5.5.5.5
17. \[R5-ospf-1\]area 0
18. \[R5-ospf-1-area-0.0.0.0\]network 192.168.56.0 0.0.0.255
19. \[R5-ospf-1-area-0.0.0.0\]quit
20. \[R5-ospf-1\]area 34
21. \[R5-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
22. \[R5-ospf-1-area-0.0.0.34\]network 10.10.25.5 0.0.0.0
23. \[R5-ospf-1-area-0.0.0.34\]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 0
10. \[R6-ospf-1-area-0.0.0.0\]network 192.168.56.0 0.0.0.255
11. \[R6-ospf-1-area-0.0.0.0\]quit
7)在 R2 和 R5 之间建立 GRE 隧道,并宣告进入到 OSPF 区域 0
1. \[R2\]interface Tunnel 0/0/25
2. \[R2-Tunnel0/0/25\]tunnel-protocol gre
3. \[R2-Tunnel0/0/25\]source 10.10.25.2
4. \[R2-Tunnel0/0/25\]destination 10.10.25.5
5. \[R2-Tunnel0/0/25\]ip address 192.168.25.2 24
6. \[R2-Tunnel0/0/25\]quit
7. \[R2\]ospf 1
8. \[R2-ospf-1\]area 0
9. \[R2-ospf-1-area-0.0.0.0\]network 192.168.25.0 0.0.0.255
10. \[R2-ospf-1-area-0.0.0.0\]quit
12. \[R5\]interface Tunnel 0/0/25
13. \[R5-Tunnel0/0/25\]tunnel-protocol gre
14. \[R5-Tunnel0/0/25\]source 10.10.25.5
15. \[R5-Tunnel0/0/25\]destination 10.10.25.2
16. \[R5-Tunnel0/0/25\]ip address 192.168.25.5 24
17. \[R5-Tunnel0/0/25\]quit
18. \[R5\]ospf 1
19. \[R5-ospf-1\]area 0
20. \[R5-ospf-1-area-0.0.0.0\]network 192.168.25.0 0.0.0.255
21. \[R5-ospf-1-area-0.0.0.0\]quit
https://tts.tmooc.cn/ttsPage/NTD/NTDTN202109/TCNE/DAY04/CASE/01/index.html