Top

  1. OSPF 汇总之外部路由
  2. OSPF 安全认证之链路认证
  3. OSPF 安全认证之区域认证
  4. OSPF 不连续区域之虚链路
  5. OSPF 不连续区域之多进程导入
  6. OSPF 不连续区域之 GRE 隧道

1 OSPF 汇总之外部路由

1.1 需求

1)企业内网运行多区域的 OSPF 网络,在 R6 上存在多个外部链路

2)R6 上的不稳定链路,会影响到骨干区域的稳定性

3)希望通过技术方案,降低外部链路的不稳定性对区域 0 的影响

1.2 方案

搭建实验环境,如图 - 1 所示。

CASE - 图1

图 - 1

1.3 步骤

实现此案例需要按照如下步骤进行。

1)配置 OSPF - R1

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R1
  4. 4. \[R1\]interface GigabitEthernet 0/0/0
  5. 5. \[R1-GigabitEthernet0/0/0\]ip add 192.168.12.1 24
  6. 6. \[R1-GigabitEthernet0/0/0\]quit
  7. 8. \[R1\]interface LoopBack 1
  8. 9. \[R1-LoopBack1\]ip address 10.10.1.1 24
  9. 10. \[R1-LoopBack1\]quit
  10. 12. \[R1\]interface LoopBack 2
  11. 13. \[R1-LoopBack2\]ip address 10.10.2.2 24
  12. 14. \[R1-LoopBack2\]quit
  13. 16. \[R1\]interface LoopBack 3
  14. 17. \[R1-LoopBack3\]ip address 10.10.3.3 24
  15. 18. \[R1-LoopBack3\]quit
  16. 20. \[R1\]interface LoopBack 4
  17. 21. \[R1-LoopBack4\]ip address 10.10.4.4 24
  18. 22. \[R1-LoopBack4\]quit
  19. 24. \[R1\]ospf 1 router-id 1.1.1.1
  20. 25. \[R1-ospf-1\]area 12
  21. 26. \[R1-ospf-1-area-0.0.0.12\]network 10.10.1.0 0.0.0.255
  22. 27. \[R1-ospf-1-area-0.0.0.12\]network 10.10.2.0 0.0.0.255
  23. 28. \[R1-ospf-1-area-0.0.0.12\]network 10.10.3.0 0.0.0.255
  24. 29. \[R1-ospf-1-area-0.0.0.12\]network 10.10.4.0 0.0.0.255
  25. 30. \[R1-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
  26. 31. \[R1-ospf-1-area-0.0.0.12\]quit

2)配置 OSPF – R2

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R2
  4. 4. \[R2\]interface GigabitEthernet 0/0/1
  5. 5. \[R2-GigabitEthernet0/0/1\]ip add 192.168.12.2 24
  6. 6. \[R2-GigabitEthernet0/0/1\]quit
  7. 8. \[R2\]interface GigabitEthernet 0/0/0
  8. 9. \[R2-GigabitEthernet0/0/0\]ip add 192.168.23.2 24
  9. 10. \[R2-GigabitEthernet0/0/0\]quit
  10. 12. \[R2\]ospf 1 router-id 2.2.2.2
  11. 13. \[R2-ospf-1\]area 12
  12. 14. \[R2-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
  13. 15. \[R2-ospf-1-area-0.0.0.12\]quit
  14. 16. \[R2-ospf-1\]area 0
  15. 17. \[R2-ospf-1-area-0.0.0.0\]network 192.168.23.0 0.0.0.255
  16. 18. \[R2-ospf-1-area-0.0.0.0\]quit

3)配置 OSPF – R3

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R3
  4. 4. \[R3\]interface GigabitEthernet 0/0/1
  5. 5. \[R3-GigabitEthernet0/0/1\]ip add 192.168.23.3 24
  6. 6. \[R3-GigabitEthernet0/0/1\]quit
  7. 8. \[R3\]interface GigabitEthernet 0/0/0
  8. 9. \[R3-GigabitEthernet0/0/0\]ip add 192.168.34.3 24
  9. 10. \[R3-GigabitEthernet0/0/0\]quit
  10. 12. \[R3\]ospf 1 router-id 3.3.3.3
  11. 13. \[R3-ospf-1\]area 0
  12. 14. \[R3-ospf-1-area-0.0.0.0\]network 192.168.34.0 0.0.0.255
  13. 15. \[R3-ospf-1-area-0.0.0.0\]network 192.168.23.0 0.0.0.255
  14. 16. \[R3-ospf-1-area-0.0.0.0\]quit

4)配置 OSPF – R4

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R4
  4. 4. \[R4\]interface GigabitEthernet 0/0/1
  5. 5. \[R4-GigabitEthernet0/0/1\]ip add 192.168.34.4 24
  6. 6. \[R4-GigabitEthernet0/0/1\]quit
  7. 8. \[R4\]interface GigabitEthernet 0/0/0
  8. 9. \[R4-GigabitEthernet0/0/0\]ip add 192.168.45.4 24
  9. 10. \[R4-GigabitEthernet0/0/0\]quit
  10. 12. \[R4\]ospf 1 router-id 4.4.4.4
  11. 13. \[R4-ospf-1\]area 0
  12. 14. \[R4-ospf-1-area-0.0.0.0\]network 192.168.34.0 0.0.0.255
  13. 15. \[R4-ospf-1-area-0.0.0.0\]network 192.168.45.0 0.0.0.25
  14. 16. \[R4-ospf-1-area-0.0.0.0\]quit

5)配置 OSPF – R5

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R5
  4. 4. \[R5\]interface GigabitEthernet 0/0/1
  5. 5. \[R5-GigabitEthernet0/0/1\]ip add 192.168.45.5 24
  6. 6. \[R5-GigabitEthernet0/0/1\]quit
  7. 8. \[R5\]interface GigabitEthernet 0/0/0
  8. 9. \[R5-GigabitEthernet0/0/0\]ip add 192.168.56.5 24
  9. 10. \[R5-GigabitEthernet0/0/0\]quit
  10. 11. \[R5\]ospf 1 router-id 5.5.5.5
  11. 12. \[R5-ospf-1\]area 0
  12. 13. \[R5-ospf-1-area-0.0.0.0\]network 192.168.45.0 0.0.0.255
  13. 14. \[R5-ospf-1-area-0.0.0.0\]quit
  14. 15. \[R5-ospf-1\]area 56
  15. 16. \[R5-ospf-1-area-0.0.0.56\]network 192.168.56.0 0.0.0.255
  16. 17. \[R5-ospf-1-area-0.0.0.56\]quit

6)配置 OSPF – R6

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R6
  4. 4. \[R6\]interface GigabitEthernet 0/0/1
  5. 5. \[R6-GigabitEthernet0/0/1\]ip add 192.168.56.6 24
  6. 6. \[R6-GigabitEthernet0/0/1\]quit
  7. 8. \[R6\]ospf 1 router-id 6.6.6.6
  8. 9. \[R6-ospf-1\]area 56
  9. 10. \[R6-ospf-1-area-0.0.0.56\]network 192.168.56.0 0.0.0.255
  10. 11. \[R6-ospf-1-area-0.0.0.56\]quit

7)配置 R6 的外部路由汇总

  1. 1. \[R6\]ospf 1
  2. 2. \[R6-ospf-1\]import-route direct
  3. 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 所示。

CASE - 图2

图 - 2

2.3 步骤

实现此案例需要按照如下步骤进行。

1)配置 OSPF - R1

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R1
  4. 4. \[R1\]interface GigabitEthernet 0/0/0
  5. 5. \[R1-GigabitEthernet0/0/0\]ip add 192.168.12.1 24
  6. 6. \[R1-GigabitEthernet0/0/0\]quit
  7. 8. \[R1\]ospf 1 router-id 1.1.1.1
  8. 9. \[R1-ospf-1\]area 12
  9. 10. \[R1-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
  10. 11. \[R1-ospf-1-area-0.0.0.12\]quit

2)配置 OSPF – R2

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R2
  4. 4. \[R2\]interface GigabitEthernet 0/0/1
  5. 5. \[R2-GigabitEthernet0/0/1\]ip add 192.168.12.2 24
  6. 6. \[R2-GigabitEthernet0/0/1\]quit
  7. 8. \[R2\]interface GigabitEthernet 0/0/0
  8. 9. \[R2-GigabitEthernet0/0/0\]ip add 192.168.23.2 24
  9. 10. \[R2-GigabitEthernet0/0/0\]quit
  10. 12. \[R2\]ospf 1 router-id 2.2.2.2
  11. 13. \[R2-ospf-1\]area 12
  12. 14. \[R2-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
  13. 15. \[R2-ospf-1-area-0.0.0.12\]quit
  14. 16. \[R2-ospf-1\]area 0
  15. 17. \[R2-ospf-1-area-0.0.0.0\]network 192.168.23.0 0.0.0.255
  16. 18. \[R2-ospf-1-area-0.0.0.0\]quit

3)配置 OSPF – R3

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R3
  4. 4. \[R3\]interface GigabitEthernet 0/0/1
  5. 5. \[R3-GigabitEthernet0/0/1\]ip add 192.168.23.3 24
  6. 6. \[R3-GigabitEthernet0/0/1\]quit
  7. 8. \[R3\]interface GigabitEthernet 0/0/0
  8. 9. \[R3-GigabitEthernet0/0/0\]ip add 192.168.34.3 24
  9. 10. \[R3-GigabitEthernet0/0/0\]quit
  10. 12. \[R3\]ospf 1 router-id 3.3.3.3
  11. 13. \[R3-ospf-1\]area 0
  12. 14. \[R3-ospf-1-area-0.0.0.0\]network 192.168.23.0 0.0.0.255
  13. 15. \[R3-ospf-1-area-0.0.0.0\]network 192.168.34.0 0.0.0.255
  14. 16. \[R3-ospf-1-area-0.0.0.0\]quit

4)配置 OSPF – R4

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R4
  4. 4. \[R4\]interface GigabitEthernet 0/0/1
  5. 5. \[R4-GigabitEthernet0/0/1\]ip add 192.168.34.4 24
  6. 6. \[R4-GigabitEthernet0/0/1\]quit
  7. 8. \[R4\]interface GigabitEthernet 0/0/0
  8. 9. \[R4-GigabitEthernet0/0/0\]ip add 192.168.45.4 24
  9. 10. \[R4-GigabitEthernet0/0/0\]quit
  10. 12. \[R4\]ospf 1 router-id 4.4.4.4
  11. 13. \[R4-ospf-1\]area 0
  12. 14. \[R4-ospf-1-area-0.0.0.0\]network 192.168.45.0 0.0.0.255
  13. 15. \[R4-ospf-1-area-0.0.0.0\]network 192.168.34.0 0.0.0.255
  14. 16. \[R4-ospf-1-area-0.0.0.0\]quit

5)配置 OSPF – R5

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R5
  4. 4. \[R5\]interface GigabitEthernet 0/0/1
  5. 5. \[R5-GigabitEthernet0/0/1\]ip add 192.168.45.5 24
  6. 6. \[R5-GigabitEthernet0/0/1\]quit
  7. 8. \[R5\]interface GigabitEthernet 0/0/0
  8. 9. \[R5-GigabitEthernet0/0/0\]ip add 192.168.56.5 24
  9. 10. \[R5-GigabitEthernet0/0/0\]quit
  10. 12. \[R5\]ospf 1 router-id 5.5.5.5
  11. 13. \[R5-ospf-1\]area 56
  12. 14. \[R5-ospf-1-area-0.0.0.56\]network 192.168.56.0 0.0.0.255
  13. 15. \[R5-ospf-1-area-0.0.0.56\]quit
  14. 16. \[R5-ospf-1\]area 0
  15. 17. \[R5-ospf-1-area-0.0.0.0\]network 192.168.45.0 0.0.0.255
  16. 18. \[R5-ospf-1-area-0.0.0.0\]quit

6)配置 OSPF – R6

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R6
  4. 4. \[R6\]interface GigabitEthernet 0/0/1
  5. 5. \[R6-GigabitEthernet0/0/1\]ip add 192.168.56.6 24
  6. 6. \[R6-GigabitEthernet0/0/1\]quit
  7. 8. \[R6\]ospf 1 router-id 6.6.6.6
  8. 9. \[R6-ospf-1\]area 56
  9. 10. \[R6-ospf-1-area-0.0.0.56\]network 192.168.56.0 0.0.0.255
  10. 11. \[R6-ospf-1-area-0.0.0.56\]quit

7)配置 R2 和 R3 之间的链路认证 - 明文认证,密码为 HCIE

  1. 1. \[R2\]interface GigabitEthernet 0/0/0
  2. 2. \[R2-GigabitEthernet0/0/0\]ospf authentication-mode simple cipher HCIE
  3. 3. \[R2-GigabitEthernet0/0/0\]quit
  4. 5. \[R3\]interface GigabitEthernet 0/0/1
  5. 6. \[R3-GigabitEthernet0/0/1\]ospf authentication-mode simple cipher HCIE
  6. 7. \[R3-GigabitEthernet0/0/1\]quit

8)配置 R3 和 R4 之间的链路认证 - 明文认证,密码为 HCIP

  1. 1. \[R3\]interface GigabitEthernet 0/0/0
  2. 2. \[R3-GigabitEthernet0/0/0\]ospf authentication-mode simple cipher HCIP
  3. 3. \[R3-GigabitEthernet0/0/0\]quit
  4. 5. \[R4\]interface GigabitEthernet 0/0/1
  5. 6. \[R4-GigabitEthernet0/0/1\]ospf authentication-mode simple cipher HCIP
  6. 7. \[R4-GigabitEthernet0/0/1\]quit

9)配置 R4 和 R5 之间的链路认证 - 密文认证,密码为 HCIA

  1. 1. \[R4\]interface GigabitEthernet 0/0/0
  2. 2. \[R4-GigabitEthernet0/0/0\]ospf authentication-mode md5 10 cipher HCIA
  3. 3. \[R4-GigabitEthernet0/0/0\]quit
  4. 5. \[R5\]interface GigabitEthernet 0/0/1
  5. 6. \[R5-GigabitEthernet0/0/1\]ospf authentication-mode md5 10 cipher HCIA
  6. 7. \[R5-GigabitEthernet0/0/1\]quit

3 OSPF 安全认证之区域认证

3.1 需求

1)企业内网运行多区域的 OSPF 网络,区域之间通过骨干区域互通

2)为了保证区域 0 的安全,需要确保骨干区域的邻居关系都必须是经过认证的,非法接入的路由器不能与骨干区域建立邻居关系

3)对属于区域 0 中的所有设备的所有接口进行 MD5 加密认证,密码为 HCIE

3.2 方案

搭建实验环境,如图 - 3 所示。

CASE - 图3

图 - 3

3.3 步骤

实现此案例需要按照如下步骤进行。

1)配置 OSPF - R1

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R1
  4. 4. \[R1\]interface GigabitEthernet 0/0/0
  5. 5. \[R1-GigabitEthernet0/0/0\]ip add 192.168.12.1 24
  6. 6. \[R1-GigabitEthernet0/0/0\]quit
  7. 8. \[R1\]ospf 1 router-id 1.1.1.1
  8. 9. \[R1-ospf-1\]area 12
  9. 10. \[R1-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
  10. 11. \[R1-ospf-1-area-0.0.0.12\]quit

2)配置 OSPF – R2

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R2
  4. 4. \[R2\]interface GigabitEthernet 0/0/1
  5. 5. \[R2-GigabitEthernet0/0/1\]ip add 192.168.12.2 24
  6. 6. \[R2-GigabitEthernet0/0/1\]quit
  7. 8. \[R2\]interface GigabitEthernet 0/0/0
  8. 9. \[R2-GigabitEthernet0/0/0\]ip add 192.168.23.2 24
  9. 10. \[R2-GigabitEthernet0/0/0\]quit
  10. 12. \[R2\]ospf 1 router-id 2.2.2.2
  11. 13. \[R2-ospf-1\]area 12
  12. 14. \[R2-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
  13. 15. \[R2-ospf-1-area-0.0.0.12\]quit
  14. 16. \[R2-ospf-1\]area 0
  15. 17. \[R2-ospf-1-area-0.0.0.0\]network 192.168.23.0 0.0.0.255
  16. 18. \[R2-ospf-1-area-0.0.0.0\]quit

3)配置 OSPF – R3

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R3
  4. 4. \[R3\]interface GigabitEthernet 0/0/1
  5. 5. \[R3-GigabitEthernet0/0/1\]ip add 192.168.23.3 24
  6. 6. \[R3-GigabitEthernet0/0/1\]quit
  7. 8. \[R3\]interface GigabitEthernet 0/0/0
  8. 9. \[R3-GigabitEthernet0/0/0\]ip add 192.168.34.3 24
  9. 10. \[R3-GigabitEthernet0/0/0\]quit
  10. 12. \[R3\]ospf 1 router-id 3.3.3.3
  11. 13. \[R3-ospf-1\]area 0
  12. 14. \[R3-ospf-1-area-0.0.0.0\]network 192.168.23.0 0.0.0.255
  13. 15. \[R3-ospf-1-area-0.0.0.0\]network 192.168.34.0 0.0.0.255
  14. 16. \[R3-ospf-1-area-0.0.0.0\]quit

4)配置 OSPF – R4

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R4
  4. 4. \[R4\]interface GigabitEthernet 0/0/1
  5. 5. \[R4-GigabitEthernet0/0/1\]ip add 192.168.34.4 24
  6. 6. \[R4-GigabitEthernet0/0/1\]quit
  7. 8. \[R4\]interface GigabitEthernet 0/0/0
  8. 9. \[R4-GigabitEthernet0/0/0\]ip add 192.168.45.4 24
  9. 10. \[R4-GigabitEthernet0/0/0\]quit
  10. 12. \[R4\]ospf 1 router-id 4.4.4.4
  11. 13. \[R4-ospf-1\]area 0
  12. 14. \[R4-ospf-1-area-0.0.0.0\]network 192.168.45.0 0.0.0.255
  13. 15. \[R4-ospf-1-area-0.0.0.0\]network 192.168.34.0 0.0.0.255
  14. 16. \[R4-ospf-1-area-0.0.0.0\]quit

5)配置 OSPF – R5

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R5
  4. 4. \[R5\]interface GigabitEthernet 0/0/1
  5. 5. \[R5-GigabitEthernet0/0/1\]ip add 192.168.45.5 24
  6. 6. \[R5-GigabitEthernet0/0/1\]quit
  7. 8. \[R5\]interface GigabitEthernet 0/0/0
  8. 9. \[R5-GigabitEthernet0/0/0\]ip add 192.168.56.5 24
  9. 10. \[R5-GigabitEthernet0/0/0\]quit
  10. 12. \[R5\]ospf 1 router-id 5.5.5.5
  11. 13. \[R5-ospf-1\]area 56
  12. 14. \[R5-ospf-1-area-0.0.0.56\]network 192.168.56.0 0.0.0.255
  13. 15. \[R5-ospf-1-area-0.0.0.56\]quit
  14. 16. \[R5-ospf-1\]area 0
  15. 17. \[R5-ospf-1-area-0.0.0.0\]network 192.168.45.0 0.0.0.255
  16. 18. \[R5-ospf-1-area-0.0.0.0\]quit

6)配置 OSPF – R6

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R6
  4. 4. \[R6\]interface GigabitEthernet 0/0/1
  5. 5. \[R6-GigabitEthernet0/0/1\]ip add 192.168.56.6 24
  6. 6. \[R6-GigabitEthernet0/0/1\]quit
  7. 8. \[R6\]ospf 1 router-id 6.6.6.6
  8. 9. \[R6-ospf-1\]area 56
  9. 10. \[R6-ospf-1-area-0.0.0.56\]network 192.168.56.0 0.0.0.255
  10. 11. \[R6-ospf-1-area-0.0.0.56\]quit

7)对区域 0 中的设备进行 “密文认证”,设置为密码为 HCIE

  1. 1. \[R2\]ospf 1
  2. 2. \[R2-ospf-1\]area 0
  3. 3. \[R2-ospf-1-area-0.0.0.0\]authentication-mode md5 7 cipher HCIE
  4. 4. \[R2-ospf-1-area-0.0.0.0\]quit
  5. 6. \[R3\]ospf 1
  6. 7. \[R3-ospf-1\]area 0
  7. 8. \[R3-ospf-1-area-0.0.0.0\]authentication-mode md5 7 cipher HCIE
  8. 9. \[R3-ospf-1-area-0.0.0.0\]quit
  9. 11. \[R4\]ospf 1
  10. 12. \[R4-ospf-1\]area 0
  11. 13. \[R4-ospf-1-area-0.0.0.0\]authentication-mode md5 7 cipher HCIE
  12. 14. \[R4-ospf-1-area-0.0.0.0\]quit
  13. 16. \[R5\]ospf 1
  14. 17. \[R5-ospf-1\]area 0
  15. 18. \[R5-ospf-1-area-0.0.0.0\]authentication-mode md5 7 cipher HCIE
  16. 19. \[R5-ospf-1-area-0.0.0.0\]qui

4 OSPF 不连续区域之虚链路

4.1 需求

1)企业内网运行多区域的 OSPF 网络,因网络规划问题,导致区域 12 没有连接到骨干区域

2)现因业务需要,需确保 R1 能和其他区域的设备实现快速互通

4.2 方案

搭建实验环境,如图 - 4 所示。

CASE - 图4

图 - 4

4.3 步骤

实现此案例需要按照如下步骤进行。

1)配置 OSPF - R1

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R1
  4. 4. \[R1\]interface GigabitEthernet 0/0/0
  5. 5. \[R1-GigabitEthernet0/0/0\]ip add 192.168.12.1 24
  6. 6. \[R1-GigabitEthernet0/0/0\]quit
  7. 8. \[R1\]ospf 1 router-id 1.1.1.1
  8. 9. \[R1-ospf-1\]area 12
  9. 10. \[R1-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
  10. 11. \[R1-ospf-1-area-0.0.0.12\]quit

2)配置 OSPF – R2

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R2
  4. 4. \[R2\]interface GigabitEthernet 0/0/1
  5. 5. \[R2-GigabitEthernet0/0/1\]ip add 192.168.12.2 24
  6. 6. \[R2-GigabitEthernet0/0/1\]quit
  7. 8. \[R2\]interface GigabitEthernet 0/0/0
  8. 9. \[R2-GigabitEthernet0/0/0\]ip add 192.168.23.2 24
  9. 10. \[R2-GigabitEthernet0/0/0\]quit
  10. 12. \[R2\]ospf 1 router-id 2.2.2.2
  11. 13. \[R2-ospf-1\]area 12
  12. 14. \[R2-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
  13. 15. \[R2-ospf-1-area-0.0.0.12\]quit
  14. 16. \[R2-ospf-1\]area 34
  15. 17. \[R2-ospf-1-area-0.0.0.34\]network 192.168.23.0 0.0.0.255
  16. 18. \[R2-ospf-1-area-0.0.0.34\]quit

3)配置 OSPF – R3

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R3
  4. 4. \[R3\]interface GigabitEthernet 0/0/1
  5. 5. \[R3-GigabitEthernet0/0/1\]ip add 192.168.23.3 24
  6. 6. \[R3-GigabitEthernet0/0/1\]quit
  7. 8. \[R3\]interface GigabitEthernet 0/0/0
  8. 9. \[R3-GigabitEthernet0/0/0\]ip add 192.168.34.3 24
  9. 10. \[R3-GigabitEthernet0/0/0\]quit
  10. 12. \[R3\]ospf 1 router-id 3.3.3.3
  11. 13. \[R3-ospf-1\]area 34
  12. 14. \[R3-ospf-1-area-0.0.0.34\]network 192.168.23.0 0.0.0.255
  13. 15. \[R3-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
  14. 16. \[R3-ospf-1-area-0.0.0.34\]quit

4)配置 OSPF – R4

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R4
  4. 4. \[R4\]interface GigabitEthernet 0/0/1
  5. 5. \[R4-GigabitEthernet0/0/1\]ip add 192.168.34.4 24
  6. 6. \[R4-GigabitEthernet0/0/1\]quit
  7. 8. \[R4\]interface GigabitEthernet 0/0/0
  8. 9. \[R4-GigabitEthernet0/0/0\]ip add 192.168.45.4 24
  9. 10. \[R4-GigabitEthernet0/0/0\]quit
  10. 12. \[R4\]ospf 1 router-id 4.4.4.4
  11. 13. \[R4-ospf-1\]area 34
  12. 14. \[R4-ospf-1-area-0.0.0.34\]network 192.168.45.0 0.0.0.255
  13. 15. \[R4-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
  14. 16. \[R4-ospf-1-area-0.0.0.34\]quit

5)配置 OSPF – R5

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R5
  4. 4. \[R5\]interface GigabitEthernet 0/0/1
  5. 5. \[R5-GigabitEthernet0/0/1\]ip add 192.168.45.5 24
  6. 6. \[R5-GigabitEthernet0/0/1\]quit
  7. 8. \[R5\]interface GigabitEthernet 0/0/0
  8. 9. \[R5-GigabitEthernet0/0/0\]ip add 192.168.56.5 24
  9. 10. \[R5-GigabitEthernet0/0/0\]quit
  10. 12. \[R5\]ospf 1 router-id 5.5.5.5
  11. 13. \[R5-ospf-1\]area 0
  12. 14. \[R5-ospf-1-area-0.0.0.0\]network 192.168.56.0 0.0.0.255
  13. 15. \[R5-ospf-1-area-0.0.0.0\]quit
  14. 16. \[R5-ospf-1\]area 34
  15. 17. \[R5-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
  16. 18. \[R5-ospf-1-area-0.0.0.34\]quit

6)配置 OSPF – R6

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R6
  4. 4. \[R6\]interface GigabitEthernet 0/0/1
  5. 5. \[R6-GigabitEthernet0/0/1\]ip add 192.168.56.6 24
  6. 6. \[R6-GigabitEthernet0/0/1\]quit
  7. 8. \[R6\]ospf 1 router-id 6.6.6.6
  8. 9. \[R6-ospf-1\]area 0
  9. 10. \[R6-ospf-1-area-0.0.0.0\]network 192.168.56.0 0.0.0.255
  10. 11. \[R6-ospf-1-area-0.0.0.0\]quit

7)穿越区域 34,在 R2 和 R5 之间建立虚链路

  1. 1. \[R2\]ospf 1
  2. 2. \[R2-ospf-1\]are
  3. 3. \[R2-ospf-1\]area 34
  4. 4. \[R2-ospf-1-area-0.0.0.34\]vlink-peer 5.5.5.5
  5. 5. \[R2-ospf-1-area-0.0.0.34\]quit
  6. 7. \[R5\]ospf 1
  7. 8. \[R5-ospf-1\]are
  8. 9. \[R5-ospf-1\]area 34
  9. 10. \[R5-ospf-1-area-0.0.0.34\]vlink-peer 2.2.2.2
  10. 11. \[R5-ospf-1-area-0.0.0.34\]quit

5 OSPF 不连续区域之多进程导入

5.1 需求

1)企业内网运行多区域的 OSPF 网络,因网络规划问题,导致区域 12 没有连接到骨干区域

2)现因业务需要,需确保 R1 能和其他区域的设备实现快速互通

5.2 方案

搭建实验环境,如图 - 5 所示。

CASE - 图5

图 - 5

5.3 步骤

实现此案例需要按照如下步骤进行。

1)配置 OSPF - R1

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R1
  4. 4. \[R1\]interface GigabitEthernet 0/0/0
  5. 5. \[R1-GigabitEthernet0/0/0\]ip add 192.168.12.1 24
  6. 6. \[R1-GigabitEthernet0/0/0\]quit
  7. 8. \[R1\]ospf 1 router-id 1.1.1.1
  8. 9. \[R1-ospf-1\]area 12
  9. 10. \[R1-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
  10. 11. \[R1-ospf-1-area-0.0.0.12\]quit

2)配置 OSPF – R2

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R2
  4. 4. \[R2\]interface GigabitEthernet 0/0/1
  5. 5. \[R2-GigabitEthernet0/0/1\]ip add 192.168.12.2 24
  6. 6. \[R2-GigabitEthernet0/0/1\]quit
  7. 8. \[R2\]interface GigabitEthernet 0/0/0
  8. 9. \[R2-GigabitEthernet0/0/0\]ip add 192.168.23.2 24
  9. 10. \[R2-GigabitEthernet0/0/0\]quit
  10. 12. \[R2\]ospf 1 router-id 2.2.2.2
  11. 13. \[R2-ospf-1\]area 12
  12. 14. \[R2-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
  13. 15. \[R2-ospf-1-area-0.0.0.12\]quit
  14. 17. \[R2\]ospf 3 router-id 2.2.2.2
  15. 18. \[R2-ospf-1\]area 34
  16. 19. \[R2-ospf-1-area-0.0.0.34\]network 192.168.23.0 0.0.0.255
  17. 20. \[R2-ospf-1-area-0.0.0.34\]quit

3)配置 OSPF – R3

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R3
  4. 4. \[R3\]interface GigabitEthernet 0/0/1
  5. 5. \[R3-GigabitEthernet0/0/1\]ip add 192.168.23.3 24
  6. 6. \[R3-GigabitEthernet0/0/1\]quit
  7. 8. \[R3\]interface GigabitEthernet 0/0/0
  8. 9. \[R3-GigabitEthernet0/0/0\]ip add 192.168.34.3 24
  9. 10. \[R3-GigabitEthernet0/0/0\]quit
  10. 12. \[R3\]ospf 1 router-id 3.3.3.3
  11. 13. \[R3-ospf-1\]area 34
  12. 14. \[R3-ospf-1-area-0.0.0.34\]network 192.168.23.0 0.0.0.255
  13. 15. \[R3-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
  14. 16. \[R3-ospf-1-area-0.0.0.34\]quit

4)配置 OSPF – R4

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R4
  4. 4. \[R4\]interface GigabitEthernet 0/0/1
  5. 5. \[R4-GigabitEthernet0/0/1\]ip add 192.168.34.4 24
  6. 6. \[R4-GigabitEthernet0/0/1\]quit
  7. 8. \[R4\]interface GigabitEthernet 0/0/0
  8. 9. \[R4-GigabitEthernet0/0/0\]ip add 192.168.45.4 24
  9. 10. \[R4-GigabitEthernet0/0/0\]quit
  10. 12. \[R4\]ospf 1 router-id 4.4.4.4
  11. 13. \[R4-ospf-1\]area 34
  12. 14. \[R4-ospf-1-area-0.0.0.34\]network 192.168.45.0 0.0.0.255
  13. 15. \[R4-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
  14. 16. \[R4-ospf-1-area-0.0.0.34\]quit

5)配置 OSPF – R5

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R5
  4. 4. \[R5\]interface GigabitEthernet 0/0/1
  5. 5. \[R5-GigabitEthernet0/0/1\]ip add 192.168.45.5 24
  6. 6. \[R5-GigabitEthernet0/0/1\]quit
  7. 8. \[R5\]interface GigabitEthernet 0/0/0
  8. 9. \[R5-GigabitEthernet0/0/0\]ip add 192.168.56.5 24
  9. 10. \[R5-GigabitEthernet0/0/0\]quit
  10. 12. \[R5\]ospf 1 router-id 5.5.5.5
  11. 13. \[R5-ospf-1\]area 0
  12. 14. \[R5-ospf-1-area-0.0.0.0\]network 192.168.56.0 0.0.0.255
  13. 15. \[R5-ospf-1-area-0.0.0.0\]quit
  14. 16. \[R5-ospf-1\]area 34
  15. 17. \[R5-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
  16. 18. \[R5-ospf-1-area-0.0.0.34\]quit

6)配置 OSPF – R6

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R6
  4. 4. \[R6\]interface GigabitEthernet 0/0/1
  5. 5. \[R6-GigabitEthernet0/0/1\]ip add 192.168.56.6 24
  6. 6. \[R6-GigabitEthernet0/0/1\]quit
  7. 8. \[R6\]ospf 1 router-id 6.6.6.6
  8. 9. \[R6-ospf-1\]area 0
  9. 10. \[R6-ospf-1-area-0.0.0.0\]network 192.168.56.0 0.0.0.255
  10. 11. \[R6-ospf-1-area-0.0.0.0\]quit

7)在 R2 上配置 OSPF 进程之间的互相导入

  1. 1. \[R2\]ospf 1
  2. 2. \[R2-ospf-1\]import-route ospf 3
  3. 4. \[R2\]ospf 3
  4. 5. \[R2-ospf-3\]import-route ospf 1

6 OSPF 不连续区域之 GRE 隧道

6.1 需求

1)企业内网运行多区域的 OSPF 网络,因网络规划问题,导致区域 12 没有连接到骨干区域

2)现因业务需要,需确保 R1 能和其他区域的设备实现快速互通

6.2 方案

搭建实验环境,如图 - 6 所示。

CASE - 图6

图 - 6

6.3 步骤

实现此案例需要按照如下步骤进行。

1)配置 OSPF - R1

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R1
  4. 4. \[R1\]interface GigabitEthernet 0/0/0
  5. 5. \[R1-GigabitEthernet0/0/0\]ip add 192.168.12.1 24
  6. 6. \[R1-GigabitEthernet0/0/0\]quit
  7. 8. \[R1\]ospf 1 router-id 1.1.1.1
  8. 9. \[R1-ospf-1\]area 12
  9. 10. \[R1-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
  10. 11. \[R1-ospf-1-area-0.0.0.12\]quit

2)配置 OSPF – R2

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R2
  4. 4. \[R2\]interface GigabitEthernet 0/0/1
  5. 5. \[R2-GigabitEthernet0/0/1\]ip add 192.168.12.2 24
  6. 6. \[R2-GigabitEthernet0/0/1\]quit
  7. 8. \[R2\]interface GigabitEthernet 0/0/0
  8. 9. \[R2-GigabitEthernet0/0/0\]ip add 192.168.23.2 24
  9. 10. \[R2-GigabitEthernet0/0/0\]quit
  10. 12. \[R2\]interface LoopBack 25
  11. 13. \[R2-LoopBack25\]ip address 10.10.25.2 32
  12. 14. \[R2-LoopBack25\]quit
  13. 16. \[R2\]ospf 1 router-id 2.2.2.2
  14. 17. \[R2-ospf-1\]area 12
  15. 18. \[R2-ospf-1-area-0.0.0.12\]network 192.168.12.0 0.0.0.255
  16. 19. \[R2-ospf-1-area-0.0.0.12\]quit
  17. 20. \[R2-ospf-1\]area 34
  18. 21. \[R2-ospf-1-area-0.0.0.34\]network 192.168.23.0 0.0.0.255
  19. 22. \[R2-ospf-1-area-0.0.0.34\]network 10.10.25.2 0.0.0.0
  20. 23. \[R2-ospf-1-area-0.0.0.34\]quit

3)配置 OSPF – R3

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R3
  4. 4. \[R3\]interface GigabitEthernet 0/0/1
  5. 5. \[R3-GigabitEthernet0/0/1\]ip add 192.168.23.3 24
  6. 6. \[R3-GigabitEthernet0/0/1\]quit
  7. 8. \[R3\]interface GigabitEthernet 0/0/0
  8. 9. \[R3-GigabitEthernet0/0/0\]ip add 192.168.34.3 24
  9. 10. \[R3-GigabitEthernet0/0/0\]quit
  10. 12. \[R3\]ospf 1 router-id 3.3.3.3
  11. 13. \[R3-ospf-1\]area 34
  12. 14. \[R3-ospf-1-area-0.0.0.34\]network 192.168.23.0 0.0.0.255
  13. 15. \[R3-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
  14. 16. \[R3-ospf-1-area-0.0.0.34\]quit

4)配置 OSPF – R4

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R4
  4. 4. \[R4\]interface GigabitEthernet 0/0/1
  5. 5. \[R4-GigabitEthernet0/0/1\]ip add 192.168.34.4 24
  6. 6. \[R4-GigabitEthernet0/0/1\]quit
  7. 8. \[R4\]interface GigabitEthernet 0/0/0
  8. 9. \[R4-GigabitEthernet0/0/0\]ip add 192.168.45.4 24
  9. 10. \[R4-GigabitEthernet0/0/0\]quit
  10. 12. \[R4\]ospf 1 router-id 4.4.4.4
  11. 13. \[R4-ospf-1\]area 34
  12. 14. \[R4-ospf-1-area-0.0.0.34\]network 192.168.45.0 0.0.0.255
  13. 15. \[R4-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
  14. 16. \[R4-ospf-1-area-0.0.0.34\]quit

5)配置 OSPF – R5

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R5
  4. 4. \[R5\]interface GigabitEthernet 0/0/1
  5. 5. \[R5-GigabitEthernet0/0/1\]ip add 192.168.45.5 24
  6. 6. \[R5-GigabitEthernet0/0/1\]quit
  7. 8. \[R5\]interface GigabitEthernet 0/0/0
  8. 9. \[R5-GigabitEthernet0/0/0\]ip add 192.168.56.5 24
  9. 10. \[R5-GigabitEthernet0/0/0\]quit
  10. 12. \[R5\]interface LoopBack 25
  11. 13. \[R5-LoopBack25\]ip address 10.10.25.5 32
  12. 14. \[R5-LoopBack25\]quit
  13. 16. \[R5\]ospf 1 router-id 5.5.5.5
  14. 17. \[R5-ospf-1\]area 0
  15. 18. \[R5-ospf-1-area-0.0.0.0\]network 192.168.56.0 0.0.0.255
  16. 19. \[R5-ospf-1-area-0.0.0.0\]quit
  17. 20. \[R5-ospf-1\]area 34
  18. 21. \[R5-ospf-1-area-0.0.0.34\]network 192.168.34.0 0.0.0.255
  19. 22. \[R5-ospf-1-area-0.0.0.34\]network 10.10.25.5 0.0.0.0
  20. 23. \[R5-ospf-1-area-0.0.0.34\]quit

6)配置 OSPF – R6

  1. 1. <Huawei>undo terminal monitor
  2. 2. <Huawei>system-view
  3. 3. \[Huawei\]sysname R6
  4. 4. \[R6\]interface GigabitEthernet 0/0/1
  5. 5. \[R6-GigabitEthernet0/0/1\]ip add 192.168.56.6 24
  6. 6. \[R6-GigabitEthernet0/0/1\]quit
  7. 8. \[R6\]ospf 1 router-id 6.6.6.6
  8. 9. \[R6-ospf-1\]area 0
  9. 10. \[R6-ospf-1-area-0.0.0.0\]network 192.168.56.0 0.0.0.255
  10. 11. \[R6-ospf-1-area-0.0.0.0\]quit

7)在 R2 和 R5 之间建立 GRE 隧道,并宣告进入到 OSPF 区域 0

  1. 1. \[R2\]interface Tunnel 0/0/25
  2. 2. \[R2-Tunnel0/0/25\]tunnel-protocol gre
  3. 3. \[R2-Tunnel0/0/25\]source 10.10.25.2
  4. 4. \[R2-Tunnel0/0/25\]destination 10.10.25.5
  5. 5. \[R2-Tunnel0/0/25\]ip address 192.168.25.2 24
  6. 6. \[R2-Tunnel0/0/25\]quit
  7. 7. \[R2\]ospf 1
  8. 8. \[R2-ospf-1\]area 0
  9. 9. \[R2-ospf-1-area-0.0.0.0\]network 192.168.25.0 0.0.0.255
  10. 10. \[R2-ospf-1-area-0.0.0.0\]quit
  11. 12. \[R5\]interface Tunnel 0/0/25
  12. 13. \[R5-Tunnel0/0/25\]tunnel-protocol gre
  13. 14. \[R5-Tunnel0/0/25\]source 10.10.25.5
  14. 15. \[R5-Tunnel0/0/25\]destination 10.10.25.2
  15. 16. \[R5-Tunnel0/0/25\]ip address 192.168.25.5 24
  16. 17. \[R5-Tunnel0/0/25\]quit
  17. 18. \[R5\]ospf 1
  18. 19. \[R5-ospf-1\]area 0
  19. 20. \[R5-ospf-1-area-0.0.0.0\]network 192.168.25.0 0.0.0.255
  20. 21. \[R5-ospf-1-area-0.0.0.0\]quit

https://tts.tmooc.cn/ttsPage/NTD/NTDTN202109/TCNE/DAY04/CASE/01/index.html