OSPF单区域配置 、 OSPF 多区域配置 、 OSPF 链路解析 、 OSPF协议概述 、 OSPF 综合案例

1 案例:配置OSPF单域

1.1 问题

  1. 如图,配置设备 IP 地址
  2. 配置 OSPF 协议,所有网段属于区域 0
  3. 验证 各路由器的邻接表
  4. 验证 各路由器的 OSPF 路由
  5. 确保 PC-1 和 PC-2 可以互通

1.2 方案

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

OSPF单区域配置 、 OSPF 多区域配置 、 OSPF 链路解析 、 OSPF协议概述 、 OSPF 综合案例图-1

1.3 步骤

实现此案例需要按照如下步骤进行。[hidecontent type=”payshow”]

1)配置终端设备 – PC1

  1. 地址:192.168.1.1
  2. 掩码:255.255.255.0
  3. 网关:192.168.1.254

2)配置终端设备 – PC2

  1. 地址:192.168.2.1
  2. 掩码:255.255.255.0
  3. 网关:192.168.2.254

3)配置网络设备 – R1

  1. <Huawei>systemview
  2. [Huawei]sysname R1
  3. [R1]interface GigabitEthernet 0/0/2
  4. [R1GigabitEthernet 0/0/2] ip address 192.168.1.254 255.255.255.0
  5. [R1GigabitEthernet 0/0/2] quit
  6. [R1]interface GigabitEthernet 0/0/0
  7. [R1GigabitEthernet 0/0/0] ip address 192.168.12.1 255.255.255.0
  8. [R1GigabitEthernet 0/0/0] quit

4)配置网络设备 – R2

  1. <Huawei>systemview
  2. [Huawei]sysname R2
  3. [R2]interface gi0/0/0
  4. [R2GigabitEthernet 0/0/0] ip address 192.168.23.2 255.255.255.0
  5. [R2GigabitEthernet 0/0/0] quit
  6. [R2]interface gi0/0/1
  7. [R2GigabitEthernet 0/0/1] ip address 192.168.12.2 255.255.255.0
  8. [R2GigabitEthernet 0/0/1] quit

5)配置网络设备 – R3

  1. <Huawei>systemview
  2. [Huawei]sysname R3
  3. [R3]interface GigabitEthernet 0/0/2
  4. [R3GigabitEthernet 0/0/2] ip address 192.168.2.254 255.255.255.0
  5. [R3GigabitEthernet 0/0/2] quit
  6. [R3]interface GigabitEthernet 0/0/1
  7. [R3GigabitEthernet 0/0/1] ip address 192.168.23.3 255.255.255.0
  8. [R3GigabitEthernet 0/0/1] quit

6)配置 OSPF 区域 0

  1. [R1]ospf 1 routerid 1.1.1.1
  2. [R1ospf-1]area 0
  3. [R1ospf-1area-0.0.0.0]network 192.168.12.0 0.0.0.255
  4. [R1ospf-1area-0.0.0.0]network 192.168.1.0 0.0.0.255
  5. [R1ospf-1area-0.0.0.0]quit
  6. [R2]ospf 1 routerid 2.2.2.2
  7. [R2ospf-1]area 0
  8. [R2ospf-1area-0.0.0.0]network 192.168.12.0 0.0.0.255
  9. [R2ospf-1area-0.0.0.0]network 192.168.23.0 0.0.0.255
  10. [R2ospf-1area-0.0.0.0]quit
  11. [R3]ospf 1 routerid 3.3.3.3
  12. [R3ospf-1]area 0
  13. [R3ospf-1area-0.0.0.0]network 192.168.23.0 0.0.0.255
  14. [R3ospf-1area-0.0.0.0]network 192.168.2.0 0.0.0.255
  15. [R3ospf-1area-0.0.0.0]quit

7)验证 OSPF 邻接表

  1. [R1]display ospf peer brief
  2.      OSPF Process 1 with Router ID 1.1.1.1
  3.          Peer Statistic Information
  4. —————————————————————————-
  5. Area Id Interface Neighbor id State
  6. 0.0.0.0 GigabitEthernet0/0/0 2.2.2.2 Full
  7. —————————————————————————-
  8. [R2]display ospf peer brief
  9.      OSPF Process 1 with Router ID 2.2.2.2
  10.          Peer Statistic Information
  11. —————————————————————————-
  12. Area Id Interface Neighbor id State
  13. 0.0.0.0 GigabitEthernet0/0/1 1.1.1.1 Full
  14. 0.0.0.0 GigabitEthernet0/0/0 3.3.3.3 Full
  15. —————————————————————————-
  16. [R3]display ospf peer brief
  17.      OSPF Process 1 with Router ID 3.3.3.3
  18.          Peer Statistic Information
  19. —————————————————————————-
  20. Area Id Interface Neighbor id State
  21. 0.0.0.0 GigabitEthernet0/0/1 2.2.2.2 Full
  22. —————————————————————————-

8)验证 OSPF 路由表

  1. [R1]display ip routingtable protocol ospf
  2. Route Flags: R relay, D download to fib
  3. ——————————————————————————
  4. Destination/Mask Proto Pre Cost Flags NextHop Interface
  5. 192.168.2.0/24 OSPF 10 3 D 192.168.12.2 GigabitEthernet0/0/0
  6. 192.168.23.0/24 OSPF 10 2 D 192.168.12.2 GigabitEthernet0/0/0
  7. [R2]display ip routingtable protocol ospf
  8. Route Flags: R relay, D download to fib
  9. ——————————————————————————
  10. Destination/Mask Proto Pre Cost Flags NextHop Interface
  11. 192.168.1.0/24 OSPF 10 2 D 192.168.12.1 GigabitEthernet0/0/1
  12. 192.168.2.0/24 OSPF 10 2 D 192.168.23.3 GigabitEthernet0/0/0
  13. [R3]display ip routingtable protocol ospf
  14. Route Flags: R relay, D download to fib
  15. ——————————————————————————
  16. Destination/Mask Proto Pre Cost Flags NextHop Interface
  17. 192.168.1.0/24 OSPF 10 3 D 192.168.23.2 GigabitEthernet0/0/1
  18. 192.168.12.0/24 OSPF 10 2 D 192.168.23.2 GigabitEthernet0/0/1

9)测试 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
  8. 192.168.2.1 ping statistics
  9. 5 packet(s) transmitted
  10. 5 packet(s) received
  11. 0.00% packet loss
  12. roundtrip min/avg/max = 16/25/31 ms
  13. PC-2>ping 192.168.1.1
  14. Ping 192.168.1.1: 32 data bytes, Press Ctrl_C to break
  15. From 192.168.1.1: bytes=32 seq=1 ttl=125 time=16 ms
  16. From 192.168.1.1: bytes=32 seq=2 ttl=125 time=31 ms
  17. From 192.168.1.1: bytes=32 seq=3 ttl=125 time=31 ms
  18. From 192.168.1.1: bytes=32 seq=4 ttl=125 time=32 ms
  19. From 192.168.1.1: bytes=32 seq=5 ttl=125 time=31 ms
  20. 192.168.1.1 ping statistics
  21. 5 packet(s) transmitted
  22. 5 packet(s) received
  23. 0.00% packet loss
  24. roundtrip min/avg/max = 16/28/32 ms

2 案例:OSPF邻居表解析

2.1 问题

  1. 如图,配置设备 IP 地址
  2. 配置 OSPF 协议,所有网段属于区域 0
  3. 验证 各路由器的邻接表
  4. 确保 R1-R2之间不需要DR
  5. 确保 R2-R3之间,R2是DR

2.2 方案

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

OSPF单区域配置 、 OSPF 多区域配置 、 OSPF 链路解析 、 OSPF协议概述 、 OSPF 综合案例图-2

2.3 步骤

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

1)配置终端设备 – PC1

  1. 地址:192.168.1.1
  2. 掩码:255.255.255.0
  3. 网关:192.168.1.254

2)配置终端设备 – PC2

  1. 地址:192.168.2.1
  2. 掩码:255.255.255.0
  3. 网关:192.168.2.254

3)配置网络设备 – R1

  1. <Huawei>systemview
  2. [Huawei]sysname R1
  3. [R1]interface GigabitEthernet 0/0/2
  4. [R1GigabitEthernet 0/0/2] ip address 192.168.1.254 255.255.255.0
  5. [R1GigabitEthernet 0/0/2] quit
  6. [R1]interface GigabitEthernet 0/0/0
  7. [R1GigabitEthernet 0/0/0] ip address 192.168.12.1 255.255.255.0
  8. [R1GigabitEthernet 0/0/0] quit

4)配置网络设备 – R2

  1. <Huawei>systemview
  2. [Huawei]sysname R2
  3. [R2]interface gi0/0/0
  4. [R2GigabitEthernet 0/0/0] ip address 192.168.23.2 255.255.255.0
  5. [R2GigabitEthernet 0/0/0] quit
  6. [R2]interface gi0/0/1
  7. [R2GigabitEthernet 0/0/1] ip address 192.168.12.2 255.255.255.0
  8. [R2GigabitEthernet 0/0/1] quit

5)配置网络设备 – R3

  1. <Huawei>systemview
  2. [Huawei]sysname R3
  3. [R3]interface GigabitEthernet 0/0/2
  4. [R3GigabitEthernet 0/0/2] ip address 192.168.2.254 255.255.255.0
  5. [R3GigabitEthernet 0/0/2] quit
  6. [R3]interface GigabitEthernet 0/0/1
  7. [R3GigabitEthernet 0/0/1] ip address 192.168.23.3 255.255.255.0
  8. [R3GigabitEthernet 0/0/1] quit

6)配置 OSPF 区域 0

  1. [R1]ospf 1 routerid 1.1.1.1
  2. [R1ospf-1]area 0
  3. [R1ospf-1area-0.0.0.0]network 192.168.12.0 0.0.0.255
  4. [R1ospf-1area-0.0.0.0]network 192.168.1.0 0.0.0.255
  5. [R1ospf-1area-0.0.0.0]quit
  6. [R2]ospf 1 routerid 2.2.2.2
  7. [R2ospf-1]area 0
  8. [R2ospf-1area-0.0.0.0]network 192.168.12.0 0.0.0.255
  9. [R2ospf-1area-0.0.0.0]network 192.168.23.0 0.0.0.255
  10. [R2ospf-1area-0.0.0.0]quit
  11. [R3]ospf 1 routerid 3.3.3.3
  12. [R3ospf-1]area 0
  13. [R3ospf-1area-0.0.0.0]network 192.168.23.0 0.0.0.255
  14. [R3ospf-1area-0.0.0.0]network 192.168.2.0 0.0.0.255
  15. [R3ospf-1area-0.0.0.0]quit

7)验证 OSPF 邻接表

  1. [R1]display ospf peer brief
  2.      OSPF Process 1 with Router ID 1.1.1.1
  3.          Peer Statistic Information
  4. —————————————————————————-
  5. Area Id Interface Neighbor id State
  6. 0.0.0.0 GigabitEthernet0/0/0 2.2.2.2 Full
  7. —————————————————————————-
  8. [R2]display ospf peer brief
  9.      OSPF Process 1 with Router ID 2.2.2.2
  10.          Peer Statistic Information
  11. —————————————————————————-
  12. Area Id Interface Neighbor id State
  13. 0.0.0.0 GigabitEthernet0/0/1 1.1.1.1 Full
  14. 0.0.0.0 GigabitEthernet0/0/0 3.3.3.3 Full
  15. —————————————————————————-
  16. [R3]display ospf peer brief
  17.      OSPF Process 1 with Router ID 3.3.3.3
  18.          Peer Statistic Information
  19. —————————————————————————-
  20. Area Id Interface Neighbor id State
  21. 0.0.0.0 GigabitEthernet0/0/1 2.2.2.2 Full
  22. —————————————————————————-

8)修改R1-R2之间的网络类型为P2P

  1. [R1]interface GigabitEthernet 0/0/0
  2. [R1GigabitEthernet 0/0/0] ospf networktype p2p
  3. [R1GigabitEthernet 0/0/0] quit
  4. [R2]interface GigabitEthernet 0/0/1
  5. [R2GigabitEthernet 0/0/1] ospf networktype p2p
  6. [R2GigabitEthernet 0/0/1] quit

9)确保R2-R3之间,R2是DR

  1. [R3]interface GigabitEthernet 0/0/1
  2. [R3GigabitEthernet 0/0/1] ospf drpriority 0
  3. [R3GigabitEthernet 0/0/1] quit

3 案例:OSPF多区域的配置

3.1 问题

  1. 如图配置IP地址,设置OSPF区域
  2. 确保R1和R2之间不选举DR,R5为区域56的DR,为区域0的BDR
  3. 验证R2和R5的角色为 ABR
  4. 确保PC-1和 PC-2可以互通

3.2 方案

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

OSPF单区域配置 、 OSPF 多区域配置 、 OSPF 链路解析 、 OSPF协议概述 、 OSPF 综合案例图-3

3.3 步骤

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

1)配置IP地址,设置OSPF区域

  1. <Huawei>undo terminal monitor
  2. <Huawei>systemview
  3. [Huawei]sysname R1
  4. [R1]interface GigabitEthernet 0/0/0
  5. [R1GigabitEthernet0/0/0]ip add 192.168.12.1 24
  6. [R1GigabitEthernet0/0/0]quit
  7. [R1]interface GigabitEthernet 0/0/2
  8. [R1GigabitEthernet0/0/2]ip add 192.168.1.1 24
  9. [R1GigabitEthernet0/0/2]quit
  10. [R1]ospf 1 routerid 1.1.1.1
  11. [R1ospf-1]area 12
  12. [R1ospf-1area-0.0.0.12]network 192.168.12.0 0.0.0.255
  13. [R1ospf-1area-0.0.0.12]network 192.168.1.0 0.0.0.255
  14. [R1ospf-1area-0.0.0.12]quit
  15. <Huawei>undo terminal monitor
  16. <Huawei>systemview
  17. [Huawei]sysname R2
  18. [R2]interface GigabitEthernet 0/0/1
  19. [R2GigabitEthernet0/0/1]ip add 192.168.12.2 24
  20. [R2GigabitEthernet0/0/1]quit
  21. [R2]interface GigabitEthernet 0/0/0
  22. [R2GigabitEthernet0/0/0]ip add 192.168.23.2 24
  23. [R2GigabitEthernet0/0/0]quit
  24. [R2]ospf 1 routerid 2.2.2.2
  25. [R2ospf-1]area 12
  26. [R2ospf-1area-0.0.0.12]network 192.168.12.0 0.0.0.255
  27. [R2ospf-1area-0.0.0.12]quit
  28. [R2ospf-1]area 0
  29. [R2ospf-1area-0.0.0.0]network 192.168.23.0 0.0.0.255
  30. [R2ospf-1area-0.0.0.0]quit
  31. <Huawei>undo terminal monitor
  32. <Huawei>systemview
  33. [Huawei]sysname R3
  34. [R3]interface GigabitEthernet 0/0/1
  35. [R3GigabitEthernet0/0/1]ip add 192.168.23.3 24
  36. [R3GigabitEthernet0/0/1]quit
  37. [R3]interface GigabitEthernet 0/0/0
  38. [R3GigabitEthernet0/0/0]ip add 192.168.34.3 24
  39. [R3GigabitEthernet0/0/0]quit
  40. [R3]ospf 1 routerid 3.3.3.3
  41. [R3ospf-1]area 0
  42. [R3ospf-1area-0.0.0.0]network 192.168.23.0 0.0.0.255
  43. [R3ospf-1area-0.0.0.0]network 192.168.34.0 0.0.0.255
  44. [R3ospf-1area-0.0.0.0]quit
  45. <Huawei>undo terminal monitor
  46. <Huawei>systemview
  47. [Huawei]sysname R4
  48. [R4]interface GigabitEthernet 0/0/1
  49. [R4GigabitEthernet0/0/1]ip add 192.168.34.4 24
  50. [R4GigabitEthernet0/0/1]quit
  51. [R4]interface GigabitEthernet 0/0/0
  52. [R4GigabitEthernet0/0/0]ip add 192.168.45.4 24
  53. [R4GigabitEthernet0/0/0]quit
  54. [R4]ospf 1 routerid 4.4.4.4
  55. [R4ospf-1]area 0
  56. [R4ospf-1area-0.0.0.0]network 192.168.45.0 0.0.0.255
  57. [R4ospf-1area-0.0.0.0]network 192.168.34.0 0.0.0.255
  58. [R4ospf-1area-0.0.0.0]quit
  59. <Huawei>undo terminal monitor
  60. <Huawei>systemview
  61. [Huawei]sysname R5
  62. [R5]interface GigabitEthernet 0/0/1
  63. [R5GigabitEthernet0/0/1]ip add 192.168.45.5 24
  64. [R5GigabitEthernet0/0/1]quit
  65. [R5]interface GigabitEthernet 0/0/0
  66. [R5GigabitEthernet0/0/0]ip add 192.168.56.5 24
  67. [R5GigabitEthernet0/0/0]quit
  68. [R5]ospf 1 routerid 5.5.5.5
  69. [R5ospf-1]area 56
  70. [R5ospf-1area-0.0.0.56]network 192.168.56.0 0.0.0.255
  71. [R5ospf-1area-0.0.0.56]quit
  72. [R5ospf-1]area 0
  73. [R5ospf-1area-0.0.0.0]network 192.168.45.0 0.0.0.255
  74. [R5ospf-1area-0.0.0.0]quit
  75. <Huawei>undo terminal monitor
  76. <Huawei>systemview
  77. [Huawei]sysname R6
  78. [R6]interface GigabitEthernet 0/0/1
  79. [R6GigabitEthernet0/0/1]ip add 192.168.56.6 24
  80. [R6GigabitEthernet0/0/1]quit
  81. [R6]interface GigabitEthernet 0/0/2
  82. [R6GigabitEthernet0/0/2]ip add 192.168.2.254 24
  83. [R6GigabitEthernet0/0/2]quit
  84. [R6]ospf 1 routerid 6.6.6.6
  85. [R6ospf-1]area 56
  86. [R6ospf-1area-0.0.0.56]network 192.168.56.0 0.0.0.255
  87. [R6ospf-1area-0.0.0.56]network 192.168.2.0 0.0.0.255
  88. [R6ospf-1area-0.0.0.56]quit

2)设置R1和R2之间不选举DR配置

  1. [R1]interface GigabitEthernet 0/0/0
  2. [R1GigabitEthernet0/0/0]ospf networktype p2p
  3. [R1GigabitEthernet0/0/0]quit
  4. [R2]interface GigabitEthernet 0/0/1
  5. [R2GigabitEthernet0/0/1]ospf networktype p2p
  6. [R2GigabitEthernet0/0/1]quit

3)配置R5 为 区域 56 的 DR

  1. [R6]interface GigabitEthernet 0/0/1
  2. [R6GigabitEthernet0/0/1] ospf drpriority 0
  3. [R6GigabitEthernet0/0/1]quit

4)配置 R5 为 区域 0 的 BDR

  1. [R4]interface GigabitEthernet 0/0/0
  2. [R4GigabitEthernet0/0/0]ospf drpriority 10
  3. [R4GigabitEthernet0/0/0]quit

5)验证R2和R5是 ABR 的 角色

  1. [R2]display ospf brief
  2.      OSPF Process 1 with Router ID 2.2.2.2
  3.          OSPF Protocol Information
  4. RouterID: 2.2.2.2 Border Router: AREA // R2 为 ABR
  5. MultiVPNInstance is not enabled
  6. Global DSTE Mode: NonStandard IETF Mode
  7. (……)
  8. [R5]display ospf brief
  9.      OSPF Process 1 with Router ID 5.5.5.5
  10.          OSPF Protocol Information
  11. RouterID: 5.5.5.5 Border Router: AREA // R2 为 ABR
  12. MultiVPNInstance is not enabled
  13. Global DSTE Mode: NonStandard IETF Mode
  14. (……)

6)确保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
  8. 192.168.2.1 ping statistics
  9. 5 packet(s) transmitted
  10. 5 packet(s) received
  11. 0.00% packet loss
  12. roundtrip min/avg/max = 16/25/31 ms
  13. PC-2>ping 192.168.1.1
  14. Ping 192.168.1.1: 32 data bytes, Press Ctrl_C to break
  15. From 192.168.1.1: bytes=32 seq=1 ttl=125 time=16 ms
  16. From 192.168.1.1: bytes=32 seq=2 ttl=125 time=31 ms
  17. From 192.168.1.1: bytes=32 seq=3 ttl=125 time=31 ms
  18. From 192.168.1.1: bytes=32 seq=4 ttl=125 time=32 ms
  19. From 192.168.1.1: bytes=32 seq=5 ttl=125 time=31 ms
  20. 192.168.1.1 ping statistics
  21. 5 packet(s) transmitted
  22. 5 packet(s) received
  23. 0.00% packet loss
  24. roundtrip min/avg/max = 16/28/32 ms

4 案例:OSPF 综合案例

4.1 问题

  1. 如图配置IP地址,规划OSPF区域
  2. 配置每个OSPF路由器的 RID 为 10.10.X.X (X为路由器号码)
  3. 确保区域20中,只有1个DR,R3为DR
  4. 确保区域0中,没有 DR
  5. 确保区域0中使用不同网络类型
  6. 确保 R6上,192.168.12.0/24的 cost为10
  7. 确保 R2上,192.168.67.0/24的 cost 为 23
  8. 配置 ACL,确保 R6-R7 无法建立 OSPF 邻居

4.2 方案

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

OSPF单区域配置 、 OSPF 多区域配置 、 OSPF 链路解析 、 OSPF协议概述 、 OSPF 综合案例图-4

4.3 步骤

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

1)配置IP地址,设置OSPF区域

  1. <Huawei>undo terminal monitor
  2. <Huawei>systemview
  3. [Huawei]sysname R1
  4. [R1]interface GigabitEthernet 0/0/0
  5. [R1GigabitEthernet0/0/0]ip add 192.168.12.1 24
  6. [R1GigabitEthernet0/0/0]quit
  7. [R1]ospf 1 routerid 1.1.1.1
  8. [R1ospf-1]area 20
  9. [R1ospf-1area-0.0.0.20]network 192.168.12.0 0.0.0.255
  10. [R1ospf-1area-0.0.0.20]quit
  11. <Huawei>undo terminal monitor
  12. <Huawei>systemview
  13. [Huawei]sysname R2
  14. [R2]interface GigabitEthernet 0/0/1
  15. [R2GigabitEthernet0/0/1]ip add 192.168.12.2 24
  16. [R2GigabitEthernet0/0/1]quit
  17. [R2]interface GigabitEthernet 0/0/0
  18. [R2GigabitEthernet0/0/0]ip add 192.168.23.2 24
  19. [R2GigabitEthernet0/0/0]quit
  20. [R2]ospf 1 routerid 2.2.2.2
  21. [R2ospf-1]area 20
  22. [R2ospf-1area-0.0.0.20]network 192.168.12.0 0.0.0.255
  23. [R2ospf-1area-0.0.0.20]network 192.168.23.0 0.0.0.255
  24. [R2ospf-1area-0.0.0.20]quit
  25. <Huawei>undo terminal monitor
  26. <Huawei>systemview
  27. [Huawei]sysname R3
  28. [R3]interface GigabitEthernet 0/0/1
  29. [R3GigabitEthernet0/0/1]ip add 192.168.23.3 24
  30. [R3GigabitEthernet0/0/1]quit
  31. [R3]interface GigabitEthernet 0/0/0
  32. [R3GigabitEthernet0/0/0]ip add 192.168.34.3 24
  33. [R3GigabitEthernet0/0/0]quit
  34. [R3]ospf 1 routerid 3.3.3.3
  35. [R3ospf-1]area 0
  36. [R3ospf-1area-0.0.0.0]network 192.168.34.0 0.0.0.255
  37. [R3ospf-1area-0.0.0.0]quit
  38. [R3ospf-1]area 20
  39. [R3ospf-1area-0.0.0.20]network 192.168.23.0 0.0.0.255
  40. [R3ospf-1area-0.0.0.0]quit
  41. <Huawei>undo terminal monitor
  42. <Huawei>systemview
  43. [Huawei]sysname R4
  44. [R4]interface GigabitEthernet 0/0/1
  45. [R4GigabitEthernet0/0/1]ip add 192.168.34.4 24
  46. [R4GigabitEthernet0/0/1]quit
  47. [R4]interface GigabitEthernet 0/0/0
  48. [R4GigabitEthernet0/0/0]ip add 192.168.45.4 24
  49. [R4GigabitEthernet0/0/0]quit
  50. [R4]ospf 1 routerid 4.4.4.4.
  51. [R4ospf-1]area 0
  52. [R4ospf-1area-0.0.0.0]network 192.168.45.0 0.0.0.255
  53. [R4ospf-1area-0.0.0.0]network 192.168.34.0 0.0.0.255
  54. [R4ospf-1area-0.0.0.0]quit
  55. <Huawei>undo terminal monitor
  56. <Huawei>systemview
  57. [Huawei]sysname R5
  58. [R5]interface GigabitEthernet 0/0/1
  59. [R5GigabitEthernet0/0/1]ip add 192.168.45.5 24
  60. [R5GigabitEthernet0/0/1]quit
  61. [R5]interface GigabitEthernet 0/0/0
  62. [R5GigabitEthernet0/0/0]ip add 192.168.56.5 24
  63. [R5GigabitEthernet0/0/0]quit
  64. [R5]ospf 1 routerid 5.5.5.5
  65. [R5ospf-1]area 6
  66. [R5ospf-1area-0.0.0.6]network 192.168.56.0 0.0.0.255
  67. [R5ospf-1area-0.0.0.6]quit
  68. [R5ospf-1]area 0
  69. [R5ospf-1area-0.0.0.0]network 192.168.45.0 0.0.0.255
  70. [R5ospf-1area-0.0.0.0]quit
  71. <Huawei>undo terminal monitor
  72. <Huawei>systemview
  73. [Huawei]sysname R6
  74. [R6]interface GigabitEthernet 0/0/1
  75. [R6GigabitEthernet0/0/1]ip add 192.168.56.6 24
  76. [R6GigabitEthernet0/0/1]quit
  77. [R6]interface GigabitEthernet 0/0/0
  78. [R6GigabitEthernet0/0/0]ip add 192.168.67.6 24
  79. [R6GigabitEthernet0/0/0]quit
  80. [R6]ospf 1 routerid 6.6.6.6
  81. [R6ospf-1]area 6
  82. [R6ospf-1area-0.0.0.6]network 192.168.56.0 0.0.0.255
  83. [R6ospf-1area-0.0.0.6]network 192.168.67.0 0.0.0.255
  84. [R6ospf-1area-0.0.0.6]quit
  85. <Huawei>undo terminal monitor
  86. <Huawei>systemview
  87. [Huawei]sysname R7
  88. [R7]interface GigabitEthernet 0/0/1
  89. [R7GigabitEthernet0/0/1]ip add 192.168.67.7 24
  90. [R7GigabitEthernet0/0/1]quit
  91. [R7]ospf 1 routerid 7.7.7.7
  92. [R7ospf-1]area 6
  93. [R7ospf-1area-0.0.0.6]network 192.168.67.0 0.0.0.255
  94. [R7ospf-1area-0.0.0.6]quit

2)配置区域20中的DR

  1. [R1]interface GigabitEthernet 0/0/0
  2. [R1GigabitEthernet0/0/0]ospf networktype p2p
  3. [R1GigabitEthernet0/0/0]quit
  4. [R2]interface GigabitEthernet 0/0/1
  5. [R2GigabitEthernet0/0/1]ospf networktype p2p
  6. [R2GigabitEthernet0/0/1]quit
  7. [R2]interface GigabitEthernet 0/0/0
  8. [R2GigabitEthernet0/0/0]ospf drpriority 0
  9. [R2GigabitEthernet0/0/0]quit

3)确保区域0中没有DR

  1. [R3]interface GigabitEthernet 0/0/0
  2. [R3GigabitEthernet0/0/0]ospf networktype p2p
  3. [R3GigabitEthernet0/0/0]quit
  4. [R4]interface GigabitEthernet 0/0/1
  5. [R4GigabitEthernet0/0/1]ospf networktype p2p
  6. [R4GigabitEthernet0/0/1]quit
  7. [R4]interface GigabitEthernet 0/0/0
  8. [R4GigabitEthernet0/0/0]ospf networktype p2mp
  9. [R4GigabitEthernet0/0/0]quit
  10. [R5]interface GigabitEthernet 0/0/1
  11. [R5GigabitEthernet0/0/1]ospf networktype p2mp
  12. [R5GigabitEthernet0/0/1]quit

4)确保R6的路由表中 192.168.12.0/24 的 cost 为10

  1. [R6]interface GigabitEthernet 0/0/1
  2. [R6GigabitEthernet0/0/1]ospf cost 6
  3. [R6GigabitEthernet0/0/1]quit

5)确保R2的路由表中 192.168.67.0/24 的 cost 为23

  1. [R2]interface GigabitEthernet 0/0/1
  2. [R2GigabitEthernet0/0/1]ospf cost 19
  3. [R2GigabitEthernet0/0/1]quit

6)配置ACL,确保R6和R7之间无法建立OSPF邻居

  1. [R7]acl 3000
  2. [R7acladv-3000]rule 10 deny ospf source 192.168.67.6 0.0.0.0 destination 224.0.0.5 0
  3. [R7]interface GigabitEthernet 0/0/1
  4. [R7GigabitEthernet0/0/1]trafficfilter inbound acl 3000[/hidecontent]

给TA打赏
共{{data.count}}人
人已打赏
华为数通

静态NAT配置 、 动态PNAT之EasyIP 、 静态PNAT之NAT Server 、 动态NAT配置 、 PNAT原理与配置 、 NAT场景与原理

2021-12-27 14:36:18

华为数通

OSPF数据库概述 、 4/5类LSA介绍 、 特殊区域之stub 、 OSFP路由引入 、 3类LSA介绍 、 1/2 类LSA介绍

2021-12-27 14:38:31

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索