• 路由器配置静态和默认路由实现VLAN之间的通信


    目录

    华为路由器静态路由和默认路由的写法

    静态路由和默认路由的区别

    案例


    华为路由器静态路由和默认路由的写法

    配置静态路由:

    [Huawei] ip route-static <目标网络> <子网掩码> <下一跳地址>

    实例:将目标网络192.168.10.0/24的流量发送到下一跳地址10.0.0.1

    [Huawei] ip route-static 192.168.10.0 255.255.255.0 10.0.0.1

    配置默认路由:

    [Huawei] ip route-static 0.0.0.0 0.0.0.0 <下一跳地址>


    实例:将未知目标网络的流量发送到默认下一跳地址203.0.113.1
    [Huawei] ip route-static 0.0.0.0 0.0.0.0 203.0.113.1

    静态路由和默认路由的区别

    1. 静态路由需要手动为每个目标网络配置路由表项。当网络规模变大时,需要手动配置大量的路由表项,而且路由表需要经常更新以适应网络拓扑的变化。而默认路由只需要配置一条路由表项,将所有未知目标网络的流量都发送到下一跳地址,这样可以简化路由表的配置和维护。

    2. 静态路由通常需要手动配置和更新,因此对于复杂的网络拓扑或动态变化的网络环境,静态路由可能不够灵活。而默认路由则更加简单和灵活,适用于较简单的网络环境或者那些需要快速配置的场景。

    3. 静态路由的路由选择是基于管理员手动配置的路由策略来决定下一跳地址。管理员可以根据具体的需求配置不同的路由策略,例如基于最短路径、最优成本等。而默认路由会将所有未知目标网络的流量发送到预设的下一跳地址,没有复杂的路由选择过程。

    4. 静态路由没有自动学习的能力,需要手动配置每个目标网络的路由表项。而一些路由协议(如OSPF或BGP)可以自动学习和更新路由表,根据网络的动态变化自动调整路由路径。虽然默认路由本身不具备自动学习的能力,但是当与动态路由协议结合使用时,可以从邻居路由器处自动学习到默认路由。

    案例

    下面来看案例,这次案例比较简单,主要看现象

     设备配置如下

    为LSW1配置默认路由 

    1. <Huawei>sys
    2. Enter system view, return user view with Ctrl+Z.
    3. [Huawei]sysname LSW1
    4. [LSW1]vlan batch
    5. Sep 17 2023 16:47:30-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
    6. 5.191.3.1 configurations have been changed. The current change number is 4, the
    7. [LSW1]undo info-center enable
    8. Info: Information center is disabled.
    9. [LSW1]vlan batch 10 30 101
    10. Info: This operation may take a few seconds. Please wait for a moment...done.
    11. [LSW1]interface g0/0/9
    12. [LSW1-GigabitEthernet0/0/9]port link-type access
    13. [LSW1-GigabitEthernet0/0/9]port default vlan 10
    14. [LSW1-GigabitEthernet0/0/9]qu
    15. [LSW1]interface g0/0/13
    16. [LSW1-GigabitEthernet0/0/13]port link-type access
    17. [LSW1-GigabitEthernet0/0/13]port default vlan 30
    18. [LSW1-GigabitEthernet0/0/13]qu
    19. [LSW1]interface g0/0/24
    20. [LSW1-GigabitEthernet0/0/24]port link-type access
    21. [LSW1-GigabitEthernet0/0/24]port default vlan 101
    22. [LSW1-GigabitEthernet0/0/24]qu
    23. [LSW1]display vlan
    24. The total number of vlans is : 4
    25. --------------------------------------------------------------------------------
    26. U: Up; D: Down; TG: Tagged; UT: Untagged;
    27. MP: Vlan-mapping; ST: Vlan-stacking;
    28. #: ProtocolTransparent-vlan; *: Management-vlan;
    29. --------------------------------------------------------------------------------
    30. VID Type Ports
    31. --------------------------------------------------------------------------------
    32. 1 common UT:GE0/0/1(D) GE0/0/2(D) GE0/0/3(D) GE0/0/4(D)
    33. GE0/0/5(D) GE0/0/6(D) GE0/0/7(D) GE0/0/8(D)
    34. GE0/0/10(D) GE0/0/11(D) GE0/0/12(D) GE0/0/14(D)
    35. GE0/0/15(D) GE0/0/16(D) GE0/0/17(D) GE0/0/18(D)
    36. GE0/0/19(D) GE0/0/20(D) GE0/0/21(D) GE0/0/22(D)
    37. GE0/0/23(D)
    38. 10 common UT:GE0/0/9(U)
    39. 30 common UT:GE0/0/13(U)
    40. 101 common UT:GE0/0/24(U)
    41. VID Status Property MAC-LRN Statistics Description
    42. --------------------------------------------------------------------------------
    43. 1 enable default enable disable VLAN 0001
    44. 10 enable default enable disable VLAN 0010
    45. 30 enable default enable disable VLAN 0030
    46. 101 enable default enable disable VLAN 0101
    47. [LSW1]display port vlan
    48. Port Link Type PVID Trunk VLAN List
    49. -------------------------------------------------------------------------------
    50. GigabitEthernet0/0/1 hybrid 1 -
    51. GigabitEthernet0/0/2 hybrid 1 -
    52. GigabitEthernet0/0/3 hybrid 1 -
    53. GigabitEthernet0/0/4 hybrid 1 -
    54. GigabitEthernet0/0/5 hybrid 1 -
    55. GigabitEthernet0/0/6 hybrid 1 -
    56. GigabitEthernet0/0/7 hybrid 1 -
    57. GigabitEthernet0/0/8 hybrid 1 -
    58. GigabitEthernet0/0/9 access 10 -
    59. GigabitEthernet0/0/10 hybrid 1 -
    60. GigabitEthernet0/0/11 hybrid 1 -
    61. GigabitEthernet0/0/12 hybrid 1 -
    62. GigabitEthernet0/0/13 access 30 -
    63. GigabitEthernet0/0/14 hybrid 1 -
    64. GigabitEthernet0/0/15 hybrid 1 -
    65. GigabitEthernet0/0/16 hybrid 1 -
    66. GigabitEthernet0/0/17 hybrid 1 -
    67. GigabitEthernet0/0/18 hybrid 1 -
    68. GigabitEthernet0/0/19 hybrid 1 -
    69. GigabitEthernet0/0/20 hybrid 1 -
    70. GigabitEthernet0/0/21 hybrid 1 -
    71. GigabitEthernet0/0/22 hybrid 1 -
    72. GigabitEthernet0/0/23 hybrid 1 -
    73. GigabitEthernet0/0/24 access 101 -
    74. [LSW1]interface vlanif 10
    75. [LSW1-Vlanif10]ip address 192.168.10.1 24
    76. [LSW1-Vlanif10]qu
    77. [LSW1]interface vlanif 30
    78. [LSW1-Vlanif30]ip address 192.168.30.1 24
    79. [LSW1-Vlanif30]qu
    80. [LSW1]interface vlanif 101
    81. [LSW1-Vlanif101]ip address 192.168.101.1 24
    82. [LSW1-Vlanif101]qu
    83. [LSW1]display interface brief
    84. PHY: Physical
    85. *down: administratively down
    86. (l): loopback
    87. (s): spoofing
    88. (b): BFD down
    89. (e): ETHOAM down
    90. (dl): DLDP down
    91. (d): Dampening Suppressed
    92. InUti/OutUti: input utility/output utility
    93. Interface PHY Protocol InUti OutUti inErrors outErrors
    94. GigabitEthernet0/0/1 down down 0% 0% 0 0
    95. GigabitEthernet0/0/2 down down 0% 0% 0 0
    96. GigabitEthernet0/0/3 down down 0% 0% 0 0
    97. GigabitEthernet0/0/4 down down 0% 0% 0 0
    98. GigabitEthernet0/0/5 down down 0% 0% 0 0
    99. GigabitEthernet0/0/6 down down 0% 0% 0 0
    100. GigabitEthernet0/0/7 down down 0% 0% 0 0
    101. GigabitEthernet0/0/8 down down 0% 0% 0 0
    102. GigabitEthernet0/0/9 up up 0% 0% 0 0
    103. GigabitEthernet0/0/10 down down 0% 0% 0 0
    104. GigabitEthernet0/0/11 down down 0% 0% 0 0
    105. GigabitEthernet0/0/12 down down 0% 0% 0 0
    106. GigabitEthernet0/0/13 up up 0% 0% 0 0
    107. GigabitEthernet0/0/14 down down 0% 0% 0 0
    108. GigabitEthernet0/0/15 down down 0% 0% 0 0
    109. GigabitEthernet0/0/16 down down 0% 0% 0 0
    110. GigabitEthernet0/0/17 down down 0% 0% 0 0
    111. GigabitEthernet0/0/18 down down 0% 0% 0 0
    112. GigabitEthernet0/0/19 down down 0% 0% 0 0
    113. GigabitEthernet0/0/20 down down 0% 0% 0 0
    114. GigabitEthernet0/0/21 down down 0% 0% 0 0
    115. GigabitEthernet0/0/22 down down 0% 0% 0 0
    116. GigabitEthernet0/0/23 down down 0% 0% 0 0
    117. GigabitEthernet0/0/24 up up 0% 0% 0 0
    118. [LSW1]display ip interface brief
    119. *down: administratively down
    120. ^down: standby
    121. (l): loopback
    122. (s): spoofing
    123. The number of interface that is UP in Physical is 4
    124. The number of interface that is DOWN in Physical is 2
    125. The number of interface that is UP in Protocol is 4
    126. The number of interface that is DOWN in Protocol is 2
    127. Interface IP Address/Mask Physical Protocol
    128. MEth0/0/1 unassigned down down
    129. NULL0 unassigned up up(s)
    130. Vlanif1 unassigned down down
    131. Vlanif10 192.168.10.1/24 up up
    132. Vlanif30 192.168.30.1/24 up up
    133. Vlanif101 192.168.101.1/24 up up
    134. [LSW1]display IP interface vlanif 10
    135. Vlanif10 current state : UP
    136. Line protocol current state : UP
    137. The Maximum Transmit Unit : 1500 bytes
    138. input packets : 0, bytes : 0, multicasts : 0
    139. output packets : 0, bytes : 0, multicasts : 0
    140. Directed-broadcast packets:
    141. received packets: 0, sent packets: 0
    142. forwarded packets: 0, dropped packets: 0
    143. Internet Address is 192.168.10.1/24
    144. Broadcast address : 192.168.10.255
    145. TTL being 1 packet number: 0
    146. TTL invalid packet number: 0
    147. ICMP packet input number: 0
    148. Echo reply: 0
    149. Unreachable: 0
    150. Source quench: 0
    151. Routing redirect: 0
    152. Echo request: 0
    153. Router advert: 0
    154. Router solicit: 0
    155. Time exceed: 0
    156. IP header bad: 0
    157. Timestamp request:
    158. [LSW1]display IP interface vlanif 30
    159. Vlanif30 current state : UP
    160. Line protocol current state : UP
    161. The Maximum Transmit Unit : 1500 bytes
    162. input packets : 0, bytes : 0, multicasts : 0
    163. output packets : 0, bytes : 0, multicasts : 0
    164. Directed-broadcast packets:
    165. received packets: 0, sent packets: 0
    166. forwarded packets: 0, dropped packets: 0
    167. Internet Address is 192.168.30.1/24
    168. Broadcast address : 192.168.30.255
    169. TTL being 1 packet number: 0
    170. TTL invalid packet number: 0
    171. ICMP packet input number: 0
    172. Echo reply: 0
    173. Unreachable: 0
    174. Source quench: 0
    175. Routing redirect: 0
    176. Echo request: 0
    177. Router advert: 0
    178. Router solicit: 0
    179. Time exceed: 0
    180. IP header bad: 0
    181. Timestamp request:
    182. [LSW1]display IP interface vlanif 101
    183. Vlanif101 current state : UP
    184. Line protocol current state : UP
    185. The Maximum Transmit Unit : 1500 bytes
    186. input packets : 0, bytes : 0, multicasts : 0
    187. output packets : 0, bytes : 0, multicasts : 0
    188. Directed-broadcast packets:
    189. received packets: 0, sent packets: 0
    190. forwarded packets: 0, dropped packets: 0
    191. Internet Address is 192.168.101.1/24
    192. Broadcast address : 192.168.101.255
    193. TTL being 1 packet number: 0
    194. TTL invalid packet number: 0
    195. ICMP packet input number: 0
    196. Echo reply: 0
    197. Unreachable: 0
    198. Source quench: 0
    199. Routing redirect: 0
    200. Echo request: 0
    201. Router advert: 0
    202. Router solicit: 0
    203. Time exceed: 0
    204. IP header bad: 0
    205. Timestamp request: 0
    206. Timestamp reply: 0
    207. [LSW1]display IP routing-table
    208. Route Flags: R - relay, D - download to fib
    209. ------------------------------------------------------------------------------
    210. Routing Tables: Public
    211. Destinations : 8 Routes : 8
    212. Destination/Mask Proto Pre Cost Flags NextHop Interface
    213. 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
    214. 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    215. 192.168.10.0/24 Direct 0 0 D 192.168.10.1 Vlanif10
    216. 192.168.10.1/32 Direct 0 0 D 127.0.0.1 Vlanif10
    217. 192.168.30.0/24 Direct 0 0 D 192.168.30.1 Vlanif30
    218. 192.168.30.1/32 Direct 0 0 D 127.0.0.1 Vlanif30
    219. 192.168.101.0/24 Direct 0 0 D 192.168.101.1 Vlanif101
    220. 192.168.101.1/32 Direct 0 0 D 127.0.0.1 Vlanif101

    同理,为LSW2配置默认路由 

    1. <Huawei>sys
    2. Enter system view, return user view with Ctrl+Z.
    3. [Huawei]sysname LSW2
    4. [LSW2]vlan batch
    5. Sep 17 2023 16:55:00-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
    6. 5.191.3.1 configurations have been changed. The current change number is 4, the
    7. change loop count is 0, and the maximum number of records is 4095.
    8. ^
    9. Error:Incomplete command found at '^' position.
    10. [LSW2]undo info-center enable
    11. Info: Information center is disabled.
    12. [LSW2]vlan batch 80 81 102
    13. Info: This operation may take a few seconds. Please wait for a moment...done.
    14. [LSW2]interface g0/0/9
    15. [LSW2-GigabitEthernet0/0/9]port link-type access
    16. [LSW2-GigabitEthernet0/0/9]qu
    17. [LSW2]interface g0/0/15
    18. [LSW2-GigabitEthernet0/0/15]port link-type access
    19. [LSW2-GigabitEthernet0/0/15]port default vlan 80
    20. [LSW2-GigabitEthernet0/0/15]qu
    21. [LSW2]interface g0/0/17
    22. [LSW2-GigabitEthernet0/0/17]port link-type access
    23. [LSW2-GigabitEthernet0/0/17]port default vlan 81
    24. [LSW2-GigabitEthernet0/0/17]qu
    25. [LSW2]interface g0/0/24
    26. [LSW2-GigabitEthernet0/0/24]port link-type access
    27. [LSW2-GigabitEthernet0/0/24]port default vlan 102
    28. [LSW2-GigabitEthernet0/0/24]qu
    29. [LSW2]display vlan
    30. The total number of vlans is : 4
    31. --------------------------------------------------------------------------------
    32. U: Up; D: Down; TG: Tagged; UT: Untagged;
    33. MP: Vlan-mapping; ST: Vlan-stacking;
    34. #: ProtocolTransparent-vlan; *: Management-vlan;
    35. --------------------------------------------------------------------------------
    36. VID Type Ports
    37. --------------------------------------------------------------------------------
    38. 1 common UT:GE0/0/1(D) GE0/0/2(D) GE0/0/3(D) GE0/0/4(D)
    39. GE0/0/5(D) GE0/0/6(D) GE0/0/7(D) GE0/0/8(D)
    40. GE0/0/9(D) GE0/0/10(D) GE0/0/11(D) GE0/0/12(D)
    41. GE0/0/13(D) GE0/0/14(D) GE0/0/16(D) GE0/0/18(D)
    42. GE0/0/19(D) GE0/0/20(D) GE0/0/21(D) GE0/0/22(D)
    43. GE0/0/23(D)
    44. 80 common UT:GE0/0/15(U)
    45. 81 common UT:GE0/0/17(U)
    46. 102 common UT:GE0/0/24(U)
    47. VID Status Property MAC-LRN Statistics Description
    48. --------------------------------------------------------------------------------
    49. 1 enable default enable disable VLAN 0001
    50. 80 enable default enable disable VLAN 0080
    51. 81 enable default enable disable VLAN 0081
    52. 102 enable default enable disable VLAN 0102
    53. [LSW2]display port vlan
    54. Port Link Type PVID Trunk VLAN List
    55. -------------------------------------------------------------------------------
    56. GigabitEthernet0/0/1 hybrid 1 -
    57. GigabitEthernet0/0/2 hybrid 1 -
    58. GigabitEthernet0/0/3 hybrid 1 -
    59. GigabitEthernet0/0/4 hybrid 1 -
    60. GigabitEthernet0/0/5 hybrid 1 -
    61. GigabitEthernet0/0/6 hybrid 1 -
    62. GigabitEthernet0/0/7 hybrid 1 -
    63. GigabitEthernet0/0/8 hybrid 1 -
    64. GigabitEthernet0/0/9 access 1 -
    65. GigabitEthernet0/0/10 hybrid 1 -
    66. GigabitEthernet0/0/11 hybrid 1 -
    67. GigabitEthernet0/0/12 hybrid 1 -
    68. GigabitEthernet0/0/13 hybrid 1 -
    69. GigabitEthernet0/0/14 hybrid 1 -
    70. GigabitEthernet0/0/15 access 80 -
    71. GigabitEthernet0/0/16 hybrid 1 -
    72. GigabitEthernet0/0/17 access 81 -
    73. GigabitEthernet0/0/18 hybrid 1 -
    74. GigabitEthernet0/0/19 hybrid 1 -
    75. GigabitEthernet0/0/20 hybrid 1 -
    76. GigabitEthernet0/0/21 hybrid 1 -
    77. GigabitEthernet0/0/22 hybrid 1 -
    78. GigabitEthernet0/0/23 hybrid 1 -
    79. GigabitEthernet0/0/24 access 102 -
    80. [LSW2]display port vlan
    81. Port Link Type PVID Trunk VLAN List
    82. -------------------------------------------------------------------------------
    83. GigabitEthernet0/0/1 hybrid 1 -
    84. GigabitEthernet0/0/2 hybrid 1 -
    85. GigabitEthernet0/0/3 hybrid 1 -
    86. GigabitEthernet0/0/4 hybrid 1 -
    87. GigabitEthernet0/0/5 hybrid 1 -
    88. GigabitEthernet0/0/6 hybrid 1 -
    89. GigabitEthernet0/0/7 hybrid 1 -
    90. GigabitEthernet0/0/8 hybrid 1 -
    91. GigabitEthernet0/0/9 access 1 -
    92. GigabitEthernet0/0/10 hybrid 1 -
    93. GigabitEthernet0/0/11 hybrid 1 -
    94. GigabitEthernet0/0/12 hybrid 1 -
    95. GigabitEthernet0/0/13 hybrid 1 -
    96. GigabitEthernet0/0/14 hybrid 1 -
    97. GigabitEthernet0/0/15 access 80 -
    98. GigabitEthernet0/0/16 hybrid 1 -
    99. GigabitEthernet0/0/17 access 81 -
    100. GigabitEthernet0/0/18 hybrid 1 -
    101. GigabitEthernet0/0/19 hybrid 1 -
    102. GigabitEthernet0/0/20 hybrid 1 -
    103. GigabitEthernet0/0/21 hybrid 1 -
    104. GigabitEthernet0/0/22 hybrid 1 -
    105. GigabitEthernet0/0/23 hybrid 1 -
    106. GigabitEthernet0/0/24 access 102 -
    107. [LSW2]interface vlanif 80
    108. [LSW2-Vlanif80]ip address 192.168.80.1 24
    109. [LSW2-Vlanif80]qu
    110. [LSW2]interface vlanif 81
    111. [LSW2-Vlanif81]ip address 192.168.81.1 24
    112. [LSW2-Vlanif81]qu
    113. [LSW2]interface vlanif 102
    114. [LSW2-Vlanif102]ip address 192.168.102.1 24
    115. [LSW2-Vlanif102]qu
    116. [LSW2]display interface brief
    117. PHY: Physical
    118. *down: administratively down
    119. (l): loopback
    120. (s): spoofing
    121. (b): BFD down
    122. (e): ETHOAM down
    123. (dl): DLDP down
    124. (d): Dampening Suppressed
    125. InUti/OutUti: input utility/output utility
    126. Interface PHY Protocol InUti OutUti inErrors outErrors
    127. GigabitEthernet0/0/1 down down 0% 0% 0 0
    128. GigabitEthernet0/0/2 down down 0% 0% 0 0
    129. GigabitEthernet0/0/3 down down 0% 0% 0 0
    130. GigabitEthernet0/0/4 down down 0% 0% 0 0
    131. GigabitEthernet0/0/5 down down 0% 0% 0 0
    132. GigabitEthernet0/0/6 down down 0% 0% 0 0
    133. GigabitEthernet0/0/7 down down 0% 0% 0 0
    134. GigabitEthernet0/0/8 down down 0% 0% 0 0
    135. GigabitEthernet0/0/9 down down 0% 0% 0 0
    136. GigabitEthernet0/0/10 down down 0% 0% 0 0
    137. GigabitEthernet0/0/11 down down 0% 0% 0 0
    138. GigabitEthernet0/0/12 down down 0% 0% 0 0
    139. GigabitEthernet0/0/13 down down 0% 0% 0 0
    140. GigabitEthernet0/0/14 down down 0% 0% 0 0
    141. GigabitEthernet0/0/15 up up 0% 0% 0 0
    142. GigabitEthernet0/0/16 down down 0% 0% 0 0
    143. GigabitEthernet0/0/17 up up 0% 0% 0 0
    144. GigabitEthernet0/0/18 down down 0% 0% 0 0
    145. GigabitEthernet0/0/19 down down 0% 0% 0 0
    146. GigabitEthernet0/0/20 down down 0% 0% 0 0
    147. GigabitEthernet0/0/21 down down 0% 0% 0 0
    148. GigabitEthernet0/0/22 down down 0% 0% 0 0
    149. GigabitEthernet0/0/23 down down 0% 0% 0 0
    150. GigabitEthernet0/0/24 up up 0% 0% 0 0
    151. [LSW2]display ip interface brief
    152. *down: administratively down
    153. ^down: standby
    154. (l): loopback
    155. (s): spoofing
    156. The number of interface that is UP in Physical is 4
    157. The number of interface that is DOWN in Physical is 2
    158. The number of interface that is UP in Protocol is 4
    159. The number of interface that is DOWN in Protocol is 2
    160. Interface IP Address/Mask Physical Protocol
    161. MEth0/0/1 unassigned down down
    162. NULL0 unassigned up up(s)
    163. Vlanif1 unassigned down down
    164. Vlanif80 192.168.80.1/24 up up
    165. Vlanif81 192.168.81.1/24 up up
    166. Vlanif102 192.168.102.1/24 up up
    167. [LSW2]display IP interface vlanif 80
    168. Vlanif80 current state : UP
    169. Line protocol current state : UP
    170. The Maximum Transmit Unit : 1500 bytes
    171. input packets : 0, bytes : 0, multicasts : 0
    172. output packets : 0, bytes : 0, multicasts : 0
    173. Directed-broadcast packets:
    174. received packets: 0, sent packets: 0
    175. forwarded packets: 0, dropped packets: 0
    176. Internet Address is 192.168.80.1/24
    177. Broadcast address : 192.168.80.255
    178. TTL being 1 packet number: 0
    179. TTL invalid packet number: 0
    180. ICMP packet input number: 0
    181. Echo reply: 0
    182. Unreachable: 0
    183. Source quench: 0
    184. Routing redirect: 0
    185. Echo request: 0
    186. Router advert: 0
    187. Router solicit: 0
    188. Time exceed: 0
    189. IP header bad: 0
    190. Timestamp request:
    191. [LSW2]display IP interface vlanif 81
    192. Vlanif81 current state : UP
    193. Line protocol current state : UP
    194. The Maximum Transmit Unit : 1500 bytes
    195. input packets : 0, bytes : 0, multicasts : 0
    196. output packets : 0, bytes : 0, multicasts : 0
    197. Directed-broadcast packets:
    198. received packets: 0, sent packets: 0
    199. forwarded packets: 0, dropped packets: 0
    200. Internet Address is 192.168.81.1/24
    201. Broadcast address : 192.168.81.255
    202. TTL being 1 packet number: 0
    203. TTL invalid packet number: 0
    204. ICMP packet input number: 0
    205. Echo reply: 0
    206. Unreachable: 0
    207. Source quench: 0
    208. Routing redirect: 0
    209. Echo request: 0
    210. Router advert: 0
    211. Router solicit: 0
    212. Time exceed: 0
    213. IP header bad: 0
    214. Timestamp request: 0
    215. Timestamp reply: 0
    216. [LSW2]display IP interface vlanif 102
    217. Vlanif102 current state : UP
    218. Line protocol current state : UP
    219. The Maximum Transmit Unit : 1500 bytes
    220. input packets : 0, bytes : 0, multicasts : 0
    221. output packets : 0, bytes : 0, multicasts : 0
    222. Directed-broadcast packets:
    223. received packets: 0, sent packets: 0
    224. forwarded packets: 0, dropped packets: 0
    225. Internet Address is 192.168.102.1/24
    226. Broadcast address : 192.168.102.255
    227. TTL being 1 packet number: 0
    228. TTL invalid packet number: 0
    229. ICMP packet input number: 0
    230. Echo reply: 0
    231. Unreachable: 0
    232. Source quench: 0
    233. Routing redirect: 0
    234. Echo request: 0
    235. Router advert: 0
    236. Router solicit: 0
    237. Time exceed: 0
    238. IP header bad: 0
    239. Timestamp request: 0
    240. Timestamp reply: 0
    241. [LSW2]display IP routing-table
    242. Route Flags: R - relay, D - download to fib
    243. ------------------------------------------------------------------------------
    244. Routing Tables: Public
    245. Destinations : 8 Routes : 8
    246. Destination/Mask Proto Pre Cost Flags NextHop Interface
    247. 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
    248. 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    249. 192.168.80.0/24 Direct 0 0 D 192.168.80.1 Vlanif80
    250. 192.168.80.1/32 Direct 0 0 D 127.0.0.1 Vlanif80
    251. 192.168.81.0/24 Direct 0 0 D 192.168.81.1 Vlanif81
    252. 192.168.81.1/32 Direct 0 0 D 127.0.0.1 Vlanif81
    253. 192.168.102.0/24 Direct 0 0 D 192.168.102.1 Vlanif102
    254. 192.168.102.1/32 Direct 0 0 D 127.0.0.1 Vlanif102

    配置路由器RTA端口

    1. <Huawei>sys
    2. Enter system view, return user view with Ctrl+Z.
    3. [Huawei]sysname RTA
    4. #配置连接交换机LSW1的端口g0/0/1及对应的ip地址
    5. [RTA]interface g0/0/1
    6. [RTA-GigabitEthernet0/0/1]ip address 192.168.101.2 24
    7. [RTA-GigabitEthernet0/0/1]
    8. Sep 17 2023 17:06:09-08:00 RTA %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
    9. on the interface GigabitEthernet0/0/1 has entered the UP state.
    10. [RTA-GigabitEthernet0/0/1]qu
    11. [RTA]interface g0/0/2
    12. [RTA-GigabitEthernet0/0/2]ip address 192.168.102.2 24
    13. Sep 17 2023 17:06:56-08:00 RTA %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
    14. on the interface GigabitEthernet0/0/2 has entered the UP state.
    15. [RTA-GigabitEthernet0/0/2]qu
    16. #配置环回接口 IP 地址,模拟校园网上的一台主机。
    17. # 环回接口 Loopback 用于模拟在路由器后的一个IP 网段。Loopback 接口作为一个逻辑接口并不真实存在,并且该接口永远不会 DOWN,正是由于这个特性,使得 Loopback 接口常用于: 网络测试、协议的 RouerID、建立基于Loopback 的邻接关系、作为SNMP traps 消息的源地址等
    18. [RTA]interface loopback 0
    19. [RTA-LoopBack0]ip address 10.1.1.10 23
    20. [RTA-LoopBack0]qu
    21. [RTA]display interface brief
    22. PHY: Physical
    23. *down: administratively down
    24. (l): loopback
    25. (s): spoofing
    26. (b): BFD down
    27. ^down: standby
    28. (e): ETHOAM down
    29. (d): Dampening Suppressed
    30. InUti/OutUti: input utility/output utility
    31. Interface PHY Protocol InUti OutUti inErrors outErrors
    32. GigabitEthernet0/0/0 down down 0% 0% 0 0
    33. GigabitEthernet0/0/1 up up 0% 0% 0 0
    34. GigabitEthernet0/0/2 up up 0% 0% 0 0
    35. LoopBack0 up up(s) 0% 0% 0 0
    36. NULL0 up up(s) 0% 0% 0 0
    37. [RTA]display ip interface brief
    38. *down: administratively down
    39. ^down: standby
    40. (l): loopback
    41. (s): spoofing
    42. The number of interface that is UP in Physical is 4
    43. The number of interface that is DOWN in Physical is 1
    44. The number of interface that is UP in Protocol is 4
    45. The number of interface that is DOWN in Protocol is 1
    46. Interface IP Address/Mask Physical Protocol
    47. GigabitEthernet0/0/0 unassigned down down
    48. GigabitEthernet0/0/1 192.168.101.2/24 up up
    49. GigabitEthernet0/0/2 192.168.102.2/24 up up
    50. LoopBack0 10.1.1.10/23 up up(s)
    51. NULL0 unassigned up up(s)
    52. [RTA]display IP interface g0/0/1
    53. GigabitEthernet0/0/1 current state : UP
    54. Line protocol current state : UP
    55. The Maximum Transmit Unit : 1500 bytes
    56. input packets : 0, bytes : 0, multicasts : 0
    57. output packets : 0, bytes : 0, multicasts : 0
    58. Directed-broadcast packets:
    59. received packets: 0, sent packets: 0
    60. forwarded packets: 0, dropped packets: 0
    61. ARP packet input number: 0
    62. Request packet: 0
    63. Reply packet: 0
    64. Unknown packet: 0
    65. Internet Address is 192.168.101.2/24
    66. Broadcast address : 192.168.101.255
    67. TTL being 1 packet number: 0
    68. TTL invalid packet number: 0
    69. ICMP packet input number: 0
    70. Echo reply: 0
    71. Unreachable: 0
    72. Source quench: 0
    73. Routing redirect: 0
    74. Echo request: 0
    75. Router advert:
    76. [RTA]display IP interface g0/0/2
    77. GigabitEthernet0/0/2 current state : UP
    78. Line protocol current state : UP
    79. The Maximum Transmit Unit : 1500 bytes
    80. input packets : 0, bytes : 0, multicasts : 0
    81. output packets : 0, bytes : 0, multicasts : 0
    82. Directed-broadcast packets:
    83. received packets: 0, sent packets: 0
    84. forwarded packets: 0, dropped packets: 0
    85. ARP packet input number: 0
    86. Request packet: 0
    87. Reply packet: 0
    88. Unknown packet: 0
    89. Internet Address is 192.168.102.2/24
    90. Broadcast address : 192.168.102.255
    91. TTL being 1 packet number: 0
    92. TTL invalid packet number: 0
    93. ICMP packet input number: 0
    94. Echo reply: 0
    95. Unreachable: 0
    96. Source quench: 0
    97. Routing redirect: 0
    98. Echo request: 0
    99. Router advert: 0
    100. Router solicit: 0
    101. [RTA]display IP routing-table
    102. Route Flags: R - relay, D - download to fib
    103. ------------------------------------------------------------------------------
    104. Routing Tables: Public
    105. Destinations : 13 Routes : 13
    106. Destination/Mask Proto Pre Cost Flags NextHop Interface
    107. 10.1.0.0/23 Direct 0 0 D 10.1.1.10 LoopBack0
    108. 10.1.1.10/32 Direct 0 0 D 127.0.0.1 LoopBack0
    109. 10.1.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
    110. 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
    111. 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    112. 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    113. 192.168.101.0/24 Direct 0 0 D 192.168.101.2 GigabitEthernet
    114. 0/0/1
    115. 192.168.101.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
    116. 0/0/1
    117. 192.168.101.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
    118. 0/0/1
    119. 192.168.102.0/24 Direct 0 0 D 192.168.102.2 GigabitEthernet
    120. 0/0/2
    121. 192.168.102.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
    122. 0/0/2
    123. 192.168.102.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
    124. 0/0/2
    125. 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0

     在PC-10-1 ping其他主机

    1. PC>ping 192.168.30.11
    2. Ping 192.168.30.11: 32 data bytes, Press Ctrl_C to break
    3. From 192.168.30.11: bytes=32 seq=1 ttl=127 time=62 ms
    4. From 192.168.30.11: bytes=32 seq=2 ttl=127 time=31 ms
    5. From 192.168.30.11: bytes=32 seq=3 ttl=127 time=32 ms
    6. From 192.168.30.11: bytes=32 seq=4 ttl=127 time=31 ms
    7. From 192.168.30.11: bytes=32 seq=5 ttl=127 time=47 ms
    8. --- 192.168.30.11 ping statistics ---
    9. 5 packet(s) transmitted
    10. 5 packet(s) received
    11. 0.00% packet loss
    12. round-trip min/avg/max = 31/40/62 ms
    13. PC>ping 192.168.80.11
    14. Ping 192.168.80.11: 32 data bytes, Press Ctrl_C to break
    15. Request timeout!
    16. Request timeout!
    17. Request timeout!
    18. Request timeout!
    19. Request timeout!
    20. --- 192.168.80.11 ping statistics ---
    21. 5 packet(s) transmitted
    22. 0 packet(s) received
    23. 100.00% packet loss
    24. PC>ping 192.168.81.11
    25. Ping 192.168.81.11: 32 data bytes, Press Ctrl_C to break
    26. Request timeout!
    27. Request timeout!
    28. Request timeout!
    29. Request timeout!
    30. Request timeout!
    31. --- 192.168.81.11 ping statistics ---
    32. 5 packet(s) transmitted
    33. 0 packet(s) received
    34. 100.00% packet loss
    35. PC>ping 10.1.1.10
    36. Ping 10.1.1.10: 32 data bytes, Press Ctrl_C to break
    37. Request timeout!
    38. Request timeout!
    39. Request timeout!
    40. Request timeout!
    41. Request timeout!
    42. --- 10.1.1.10 ping statistics ---
    43. 5 packet(s) transmitted
    44. 0 packet(s) received
    45. 100.00% packet loss

     在PC-30-1上ping其他主机

    1. PC>ping 192.168.10.11
    2. Ping 192.168.10.11: 32 data bytes, Press Ctrl_C to break
    3. From 192.168.10.11: bytes=32 seq=1 ttl=127 time=31 ms
    4. From 192.168.10.11: bytes=32 seq=2 ttl=127 time=47 ms
    5. From 192.168.10.11: bytes=32 seq=3 ttl=127 time=47 ms
    6. From 192.168.10.11: bytes=32 seq=4 ttl=127 time=31 ms
    7. From 192.168.10.11: bytes=32 seq=5 ttl=127 time=31 ms
    8. --- 192.168.10.11 ping statistics ---
    9. 5 packet(s) transmitted
    10. 5 packet(s) received
    11. 0.00% packet loss
    12. round-trip min/avg/max = 31/37/47 ms
    13. PC>ping 192.168.80.11
    14. Ping 192.168.80.11: 32 data bytes, Press Ctrl_C to break
    15. Request timeout!
    16. Request timeout!
    17. Request timeout!
    18. Request timeout!
    19. Request timeout!
    20. --- 192.168.80.11 ping statistics ---
    21. 5 packet(s) transmitted
    22. 0 packet(s) received
    23. 100.00% packet loss
    24. PC>ping 192.168.81.11
    25. Ping 192.168.81.11: 32 data bytes, Press Ctrl_C to break
    26. Request timeout!
    27. Request timeout!
    28. Request timeout!
    29. Request timeout!
    30. Request timeout!
    31. --- 192.168.81.11 ping statistics ---
    32. 5 packet(s) transmitted
    33. 0 packet(s) received
    34. 100.00% packet loss
    35. PC>ping 10.1.1.10
    36. Ping 10.1.1.10: 32 data bytes, Press Ctrl_C to break
    37. Request timeout!
    38. Request timeout!
    39. Request timeout!
    40. Request timeout!
    41. Request timeout!
    42. --- 10.1.1.10 ping statistics ---
    43. 5 packet(s) transmitted
    44. 0 packet(s) received
    45. 100.00% packet loss

    在PC-80-1上ping其他主机

    1. PC>ping 192.168.81.11
    2. Ping 192.168.81.11: 32 data bytes, Press Ctrl_C to break
    3. From 192.168.81.11: bytes=32 seq=1 ttl=127 time=62 ms
    4. From 192.168.81.11: bytes=32 seq=2 ttl=127 time=47 ms
    5. From 192.168.81.11: bytes=32 seq=3 ttl=127 time=47 ms
    6. From 192.168.81.11: bytes=32 seq=4 ttl=127 time=47 ms
    7. From 192.168.81.11: bytes=32 seq=5 ttl=127 time=31 ms
    8. --- 192.168.81.11 ping statistics ---
    9. 5 packet(s) transmitted
    10. 5 packet(s) received
    11. 0.00% packet loss
    12. round-trip min/avg/max = 31/46/62 ms
    13. PC>ping 192.168.10.11
    14. Ping 192.168.10.11: 32 data bytes, Press Ctrl_C to break
    15. Request timeout!
    16. Request timeout!
    17. Request timeout!
    18. Request timeout!
    19. Request timeout!
    20. --- 192.168.10.11 ping statistics ---
    21. 5 packet(s) transmitted
    22. 0 packet(s) received
    23. 100.00% packet loss
    24. PC>ping 192.168.30.11
    25. Ping 192.168.30.11: 32 data bytes, Press Ctrl_C to break
    26. Request timeout!
    27. Request timeout!
    28. Request timeout!
    29. Request timeout!
    30. Request timeout!
    31. --- 192.168.30.11 ping statistics ---
    32. 5 packet(s) transmitted
    33. 0 packet(s) received
    34. 100.00% packet loss
    35. PC>ping 10.1.1.10
    36. Ping 10.1.1.10: 32 data bytes, Press Ctrl_C to break
    37. Request timeout!
    38. Request timeout!
    39. Request timeout!
    40. Request timeout!
    41. Request timeout!
    42. --- 10.1.1.10 ping statistics ---
    43. 5 packet(s) transmitted
    44. 0 packet(s) received
    45. 100.00% packet loss

     在PC-81-1上ping其他主机

    1. PC>ping 192.168.80.11
    2. Ping 192.168.80.11: 32 data bytes, Press Ctrl_C to break
    3. From 192.168.80.11: bytes=32 seq=1 ttl=127 time=47 ms
    4. From 192.168.80.11: bytes=32 seq=2 ttl=127 time=47 ms
    5. From 192.168.80.11: bytes=32 seq=3 ttl=127 time=31 ms
    6. From 192.168.80.11: bytes=32 seq=4 ttl=127 time=31 ms
    7. From 192.168.80.11: bytes=32 seq=5 ttl=127 time=47 ms
    8. --- 192.168.80.11 ping statistics ---
    9. 5 packet(s) transmitted
    10. 5 packet(s) received
    11. 0.00% packet loss
    12. round-trip min/avg/max = 31/40/47 ms
    13. PC>ping 192.168.10.11
    14. Ping 192.168.10.11: 32 data bytes, Press Ctrl_C to break
    15. Request timeout!
    16. Request timeout!
    17. Request timeout!
    18. Request timeout!
    19. Request timeout!
    20. --- 192.168.10.11 ping statistics ---
    21. 5 packet(s) transmitted
    22. 0 packet(s) received
    23. 100.00% packet loss
    24. PC>ping 192.168.30.11
    25. Ping 192.168.30.11: 32 data bytes, Press Ctrl_C to break
    26. Request timeout!
    27. Request timeout!
    28. Request timeout!
    29. Request timeout!
    30. Request timeout!
    31. --- 192.168.30.11 ping statistics ---
    32. 5 packet(s) transmitted
    33. 0 packet(s) received
    34. 100.00% packet loss
    35. PC>ping 10.1.1.10
    36. Ping 10.1.1.10: 32 data bytes, Press Ctrl_C to break
    37. Request timeout!
    38. Request timeout!
    39. Request timeout!
    40. Request timeout!
    41. Request timeout!
    42. --- 10.1.1.10 ping statistics ---
    43. 5 packet(s) transmitted
    44. 0 packet(s) received
    45. 100.00% packet loss

    至此,我们可以看到不同交换机还不能实现vlan的相互通信

    现在在交换机和路由器上都配置默认路由

    1. <LSW1>sys
    2. Enter system view, return user view with Ctrl+Z.
    3. # 配置默认路由,简化路由配置
    4. # 默认路由的目的网络为0.0.0.0,子网掩码为0.0.0.0,下一跳地址为 192.168.102.2
    5. #也可以配置到每个网络的静态路由
    6. [LSW1]ip route-static 0.0.0.0 0.0.0.0 192.168.101.2
    7. [LSW1]display IP routing-table
    8. Route Flags: R - relay, D - download to fib
    9. ------------------------------------------------------------------------------
    10. Routing Tables: Public
    11. Destinations : 9 Routes : 9
    12. Destination/Mask Proto Pre Cost Flags NextHop Interface
    13. 0.0.0.0/0 Static 60 0 RD 192.168.101.2 Vlanif101
    14. 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
    15. 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    16. 192.168.10.0/24 Direct 0 0 D 192.168.10.1 Vlanif10
    17. 192.168.10.1/32 Direct 0 0 D 127.0.0.1 Vlanif10
    18. 192.168.30.0/24 Direct 0 0 D 192.168.30.1 Vlanif30
    19. 192.168.30.1/32 Direct 0 0 D 127.0.0.1 Vlanif30
    20. 192.168.101.0/24 Direct 0 0 D 192.168.101.1 Vlanif101
    21. 192.168.101.1/32 Direct 0 0 D 127.0.0.1 Vlanif101

    在LSW2上配置默认路由

    1. <LSW2>sys
    2. Enter system view, return user view with Ctrl+Z.
    3. [LSW2]ip route-static 0.0.0.0 0.0.0.0 192.168.102.2
    4. [LSW2]display IP routing-table
    5. Route Flags: R - relay, D - download to fib
    6. ------------------------------------------------------------------------------
    7. Routing Tables: Public
    8. Destinations : 9 Routes : 9
    9. Destination/Mask Proto Pre Cost Flags NextHop Interface
    10. 0.0.0.0/0 Static 60 0 RD 192.168.102.2 Vlanif102
    11. 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
    12. 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    13. 192.168.80.0/24 Direct 0 0 D 192.168.80.1 Vlanif80
    14. 192.168.80.1/32 Direct 0 0 D 127.0.0.1 Vlanif80
    15. 192.168.81.0/24 Direct 0 0 D 192.168.81.1 Vlanif81
    16. 192.168.81.1/32 Direct 0 0 D 127.0.0.1 Vlanif81
    17. 192.168.102.0/24 Direct 0 0 D 192.168.102.1 Vlanif102
    18. 192.168.102.1/32 Direct 0 0 D 127.0.0.1 Vlanif102

     在路由器RTA上配置静态和默认路由

    1. <RTA>sys
    2. Enter system view, return user view with Ctrl+Z.
    3. [RTA]ip route-static 192.168.10.0 24 192.168.101.1
    4. [RTA]ip route-static 192.168.30.0 24 192.168.101.1
    5. [RTA]ip route-static 0.0.0.0 0.0.0.0 192.168.102.1
    6. #也可以配置静态路由
    7. #[RTA]ip route-static 192.168.80.0 24 192.168.102.1
    8. #[RTA]ip route-static 192.168.81.0 24 192.168.102.1
    9. [RTA]display IP routing-table
    10. Route Flags: R - relay, D - download to fib
    11. ------------------------------------------------------------------------------
    12. Routing Tables: Public
    13. Destinations : 16 Routes : 16
    14. Destination/Mask Proto Pre Cost Flags NextHop Interface
    15. 0.0.0.0/0 Static 60 0 RD 192.168.102.1 GigabitEthernet
    16. 0/0/2
    17. 10.1.0.0/23 Direct 0 0 D 10.1.1.10 LoopBack0
    18. 10.1.1.10/32 Direct 0 0 D 127.0.0.1 LoopBack0
    19. 10.1.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
    20. 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
    21. 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    22. 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    23. 192.168.10.0/24 Static 60 0 RD 192.168.101.1 GigabitEthernet
    24. 0/0/1
    25. 192.168.30.0/24 Static 60 0 RD 192.168.101.1 GigabitEthernet
    26. 0/0/1
    27. 192.168.101.0/24 Direct 0 0 D 192.168.101.2 GigabitEthernet
    28. 0/0/1
    29. 192.168.101.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
    30. 0/0/1
    31. 192.168.101.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
    32. 0/0/1
    33. 192.168.102.0/24 Direct 0 0 D 192.168.102.2 GigabitEthernet
    34. 0/0/2
    35. 192.168.102.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
    36. 0/0/2
    37. 192.168.102.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
    38. 0/0/2
    39. 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0

     现在PC-10-1可以ping通其他主机

    1. PC>ping 192.168.80.11
    2. Ping 192.168.80.11: 32 data bytes, Press Ctrl_C to break
    3. From 192.168.80.11: bytes=32 seq=1 ttl=125 time=78 ms
    4. From 192.168.80.11: bytes=32 seq=2 ttl=125 time=94 ms
    5. From 192.168.80.11: bytes=32 seq=3 ttl=125 time=62 ms
    6. From 192.168.80.11: bytes=32 seq=4 ttl=125 time=47 ms
    7. From 192.168.80.11: bytes=32 seq=5 ttl=125 time=78 ms
    8. --- 192.168.80.11 ping statistics ---
    9. 5 packet(s) transmitted
    10. 5 packet(s) received
    11. 0.00% packet loss
    12. round-trip min/avg/max = 47/71/94 ms
    13. PC>ping 192.168.81.11
    14. Ping 192.168.81.11: 32 data bytes, Press Ctrl_C to break
    15. From 192.168.81.11: bytes=32 seq=1 ttl=125 time=78 ms
    16. From 192.168.81.11: bytes=32 seq=2 ttl=125 time=94 ms
    17. From 192.168.81.11: bytes=32 seq=3 ttl=125 time=78 ms
    18. From 192.168.81.11: bytes=32 seq=4 ttl=125 time=78 ms
    19. From 192.168.81.11: bytes=32 seq=5 ttl=125 time=93 ms
    20. --- 192.168.81.11 ping statistics ---
    21. 5 packet(s) transmitted
    22. 5 packet(s) received
    23. 0.00% packet loss
    24. round-trip min/avg/max = 78/84/94 ms
    25. PC>ping 10.1.1.10
    26. Ping 10.1.1.10: 32 data bytes, Press Ctrl_C to break
    27. From 10.1.1.10: bytes=32 seq=1 ttl=254 time=78 ms
    28. From 10.1.1.10: bytes=32 seq=2 ttl=254 time=47 ms
    29. From 10.1.1.10: bytes=32 seq=3 ttl=254 time=31 ms
    30. From 10.1.1.10: bytes=32 seq=4 ttl=254 time=31 ms
    31. From 10.1.1.10: bytes=32 seq=5 ttl=254 time=47 ms
    32. --- 10.1.1.10 ping statistics ---
    33. 5 packet(s) transmitted
    34. 5 packet(s) received
    35. 0.00% packet loss
    36. round-trip min/avg/max = 31/46/78 ms

     PC-80-1也可以ping通其他主机

    1. PC>ping 192.168.10.11
    2. Ping 192.168.10.11: 32 data bytes, Press Ctrl_C to break
    3. Request timeout!
    4. From 192.168.10.11: bytes=32 seq=2 ttl=125 time=47 ms
    5. From 192.168.10.11: bytes=32 seq=3 ttl=125 time=63 ms
    6. From 192.168.10.11: bytes=32 seq=4 ttl=125 time=78 ms
    7. From 192.168.10.11: bytes=32 seq=5 ttl=125 time=78 ms
    8. --- 192.168.10.11 ping statistics ---
    9. 5 packet(s) transmitted
    10. 4 packet(s) received
    11. 20.00% packet loss
    12. round-trip min/avg/max = 0/66/78 ms
    13. PC>ping 192.168.30.11
    14. Ping 192.168.30.11: 32 data bytes, Press Ctrl_C to break
    15. Request timeout!
    16. From 192.168.30.11: bytes=32 seq=2 ttl=125 time=94 ms
    17. From 192.168.30.11: bytes=32 seq=3 ttl=125 time=63 ms
    18. From 192.168.30.11: bytes=32 seq=4 ttl=125 time=93 ms
    19. From 192.168.30.11: bytes=32 seq=5 ttl=125 time=94 ms
    20. --- 192.168.30.11 ping statistics ---
    21. 5 packet(s) transmitted
    22. 4 packet(s) received
    23. 20.00% packet loss
    24. round-trip min/avg/max = 0/86/94 ms
    25. PC>ping 10.1.1.10
    26. Ping 10.1.1.10: 32 data bytes, Press Ctrl_C to break
    27. From 10.1.1.10: bytes=32 seq=1 ttl=254 time=47 ms
    28. From 10.1.1.10: bytes=32 seq=2 ttl=254 time=31 ms
    29. From 10.1.1.10: bytes=32 seq=3 ttl=254 time=47 ms
    30. From 10.1.1.10: bytes=32 seq=4 ttl=254 time=31 ms
    31. From 10.1.1.10: bytes=32 seq=5 ttl=254 time=47 ms
    32. --- 10.1.1.10 ping statistics ---
    33. 5 packet(s) transmitted
    34. 5 packet(s) received
    35. 0.00% packet loss
    36. round-trip min/avg/max = 31/40/47 ms

     PC-30-1也可以ping通其他主机

    1. PC>ping 192.168.10.11
    2. Ping 192.168.10.11: 32 data bytes, Press Ctrl_C to break
    3. Request timeout!
    4. From 192.168.10.11: bytes=32 seq=2 ttl=127 time=32 ms
    5. From 192.168.10.11: bytes=32 seq=3 ttl=127 time=47 ms
    6. From 192.168.10.11: bytes=32 seq=4 ttl=127 time=46 ms
    7. From 192.168.10.11: bytes=32 seq=5 ttl=127 time=47 ms
    8. --- 192.168.10.11 ping statistics ---
    9. 5 packet(s) transmitted
    10. 4 packet(s) received
    11. 20.00% packet loss
    12. round-trip min/avg/max = 0/43/47 ms
    13. PC>ping 192.168.80.11
    14. Ping 192.168.80.11: 32 data bytes, Press Ctrl_C to break
    15. From 192.168.80.11: bytes=32 seq=1 ttl=125 time=47 ms
    16. From 192.168.80.11: bytes=32 seq=2 ttl=125 time=63 ms
    17. From 192.168.80.11: bytes=32 seq=3 ttl=125 time=78 ms
    18. From 192.168.80.11: bytes=32 seq=4 ttl=125 time=62 ms
    19. From 192.168.80.11: bytes=32 seq=5 ttl=125 time=94 ms
    20. --- 192.168.80.11 ping statistics ---
    21. 5 packet(s) transmitted
    22. 5 packet(s) received
    23. 0.00% packet loss
    24. round-trip min/avg/max = 47/68/94 ms
    25. PC>ping 192.168.81.11
    26. Ping 192.168.81.11: 32 data bytes, Press Ctrl_C to break
    27. From 192.168.81.11: bytes=32 seq=1 ttl=125 time=110 ms
    28. From 192.168.81.11: bytes=32 seq=2 ttl=125 time=78 ms
    29. From 192.168.81.11: bytes=32 seq=3 ttl=125 time=62 ms
    30. From 192.168.81.11: bytes=32 seq=4 ttl=125 time=79 ms
    31. From 192.168.81.11: bytes=32 seq=5 ttl=125 time=78 ms
    32. --- 192.168.81.11 ping statistics ---
    33. 5 packet(s) transmitted
    34. 5 packet(s) received
    35. 0.00% packet loss
    36. round-trip min/avg/max = 62/81/110 ms

     PC-81-1能ping通其他主机

    1. PC>ping 192.168.10.11
    2. Ping 192.168.10.11: 32 data bytes, Press Ctrl_C to break
    3. Request timeout!
    4. From 192.168.10.11: bytes=32 seq=2 ttl=125 time=47 ms
    5. From 192.168.10.11: bytes=32 seq=3 ttl=125 time=94 ms
    6. From 192.168.10.11: bytes=32 seq=4 ttl=125 time=62 ms
    7. From 192.168.10.11: bytes=32 seq=5 ttl=125 time=78 ms
    8. --- 192.168.10.11 ping statistics ---
    9. 5 packet(s) transmitted
    10. 4 packet(s) received
    11. 20.00% packet loss
    12. round-trip min/avg/max = 0/70/94 ms
    13. PC>ping 192.168.30.11
    14. Ping 192.168.30.11: 32 data bytes, Press Ctrl_C to break
    15. From 192.168.30.11: bytes=32 seq=1 ttl=125 time=94 ms
    16. From 192.168.30.11: bytes=32 seq=2 ttl=125 time=62 ms
    17. From 192.168.30.11: bytes=32 seq=3 ttl=125 time=63 ms
    18. From 192.168.30.11: bytes=32 seq=4 ttl=125 time=78 ms
    19. From 192.168.30.11: bytes=32 seq=5 ttl=125 time=63 ms
    20. --- 192.168.30.11 ping statistics ---
    21. 5 packet(s) transmitted
    22. 5 packet(s) received
    23. 0.00% packet loss
    24. round-trip min/avg/max = 62/72/94 ms
    25. PC>ping 192.168.80.11
    26. Ping 192.168.80.11: 32 data bytes, Press Ctrl_C to break
    27. From 192.168.80.11: bytes=32 seq=1 ttl=127 time=31 ms
    28. From 192.168.80.11: bytes=32 seq=2 ttl=127 time=47 ms
    29. From 192.168.80.11: bytes=32 seq=3 ttl=127 time=31 ms
    30. From 192.168.80.11: bytes=32 seq=4 ttl=127 time=47 ms
    31. From 192.168.80.11: bytes=32 seq=5 ttl=127 time=47 ms
    32. --- 192.168.80.11 ping statistics ---
    33. 5 packet(s) transmitted
    34. 5 packet(s) received
    35. 0.00% packet loss
    36. round-trip min/avg/max = 31/40/47 ms
    37. PC>ping 10.1.1.10
    38. Ping 10.1.1.10: 32 data bytes, Press Ctrl_C to break
    39. From 10.1.1.10: bytes=32 seq=1 ttl=254 time=31 ms
    40. From 10.1.1.10: bytes=32 seq=2 ttl=254 time=31 ms
    41. From 10.1.1.10: bytes=32 seq=3 ttl=254 time=47 ms
    42. From 10.1.1.10: bytes=32 seq=4 ttl=254 time=47 ms
    43. From 10.1.1.10: bytes=32 seq=5 ttl=254 time=31 ms
    44. --- 10.1.1.10 ping statistics ---
    45. 5 packet(s) transmitted
    46. 5 packet(s) received
    47. 0.00% packet loss
    48. round-trip min/avg/max = 31/37/47 ms

     以下是案例的拓扑图链接:

    链接:https://pan.baidu.com/s/1CXDetuC34Hi_E88TUgVx4g 
    提取码:o3b5

    不过还是建议自己多写 

  • 相关阅读:
    Nginx.conf设置nginx优化(二)
    【程序的编译(预处理操作)+链接】
    IIS配置优化
    java源码系列:HashMap源码验证,自己手写一个HashMap之01-基本框架
    学习编程的第二十七天
    nmap保存到扫描文件(局域网)
    C++求解汉明距离
    【信号去噪】基于麻雀算法优化最小二乘法lms自适应滤波器实现语音去噪附matlab代码
    微电网与电动车蓄电池优化(Matlab代码实现)
    LeetCode 139 单词拆分
  • 原文地址:https://blog.csdn.net/weixin_69884785/article/details/132946707