当前位置:   article > 正文

华为交换机配置静态路由_华为交换机静态路由配置

华为交换机静态路由配置

组网需求:

处于不同交换机下(不同网段)的PC机,相互进行通信

配置思路

采用如下的思路配置IPv4静态路由:

  1. 创建VLAN并配置各接口所属VLAN,配置各VLANIF接口的IP地址,实现相邻设备网络互通。
  2. 在各主机上配置IP缺省网关,在各台Switch上配置IPv4静态路由或者静态缺省路由,实现不配置动态路由协议,使不同网段的任意两台主机之间能够互通

路由信息:

  1. SW1:
  2. ip route-static 0.0.0.0 0.0.0.0 10.2.4.2
  3. SW2:
  4. ip route-static 10.1.1.0 255.255.255.248 10.2.4.1
  5. ip route-static 10.1.2.0 255.255.255.248 10.2.4.6
  6. ip route-static 10.1.3.0 255.255.255.248 10.2.4.10
  7. SW3:
  8. ip route-static 0.0.0.0 0.0.0.0 10.2.4.5
  9. SW4:
  10. ip route-static 0.0.0.0 0.0.0.0 10.2.4.9

SW1配置,其它类似:

[SW1] sysname SW1

[SW1] vlan batch 10 30

[SW1] interface Vlanif 10

[SW1] ip address 10.2.4.1 255.255.255.252

[SW1] dhcp enable

[SW1] interface Vlanif 30

[SW1] ip address 10.1.1.1 255.255.255.248

[SW1] port-group vlan30

[SW1] group-member GigabitEthernet0/0/1 to GigabitEthernet0/0/5

[SW1] port link-type access

[SW1] port default vlan 30

[SW1] interface Eth-Trunk 1

[SW1] mode lacp-static

[SW1] trunkport GigabitEthernet 0/0/23 to 0/0/24

[SW1] port link-type trunk

[SW1] port trunk allow-pass vlan 10

[SW1] ip route-static 0.0.0.0 0.0.0.0 10.2.4.2

<SW1>save

 

测试:

查看SW2路由表:

  1. <SW2>dis ip routing-table
  2. Route Flags: R - relay, D - download to fib
  3. ------------------------------------------------------------------------------
  4. Routing Tables: Public
  5. Destinations : 11 Routes : 11
  6. Destination/Mask Proto Pre Cost Flags NextHop Interface
  7. 10.1.1.0/29 Static 60 0 RD 10.2.4.1 Vlanif10
  8. 10.1.2.0/29 Static 60 0 RD 10.2.4.6 Vlanif20
  9. 10.1.3.0/29 Static 60 0 RD 10.2.4.10 Vlanif40
  10. 10.2.4.0/30 Direct 0 0 D 10.2.4.2 Vlanif10
  11. 10.2.4.2/32 Direct 0 0 D 127.0.0.1 Vlanif10
  12. 10.2.4.4/30 Direct 0 0 D 10.2.4.5 Vlanif20
  13. 10.2.4.5/32 Direct 0 0 D 127.0.0.1 Vlanif20
  14. 10.2.4.8/30 Direct 0 0 D 10.2.4.9 Vlanif40
  15. 10.2.4.9/32 Direct 0 0 D 127.0.0.1 Vlanif40
  16. 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
  17. 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0

SW1配置文件:

  1. [SW1]dis current-configuration
  2. #
  3. sysname SW1
  4. #
  5. vlan batch 10 30
  6. #
  7. cluster enable
  8. ntdp enable
  9. ndp enable
  10. #
  11. drop illegal-mac alarm
  12. #
  13. dhcp enable
  14. #
  15. diffserv domain default
  16. #
  17. drop-profile default
  18. #
  19. aaa
  20. authentication-scheme default
  21. authorization-scheme default
  22. accounting-scheme default
  23. domain default
  24. domain default_admin
  25. local-user admin password simple admin
  26. Oct 29 2019 10:42:51-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
  27. 191.3.1 configurations have been changed. The current change number is 26, the ch
  28. ange loop count is 0, and the maximum number of records is 4095. local-user admin service-type http
  29. #
  30. interface Vlanif1
  31. #
  32. interface Vlanif10
  33. ip address 10.2.4.1 255.255.255.252
  34. #
  35. interface Vlanif30
  36. ip address 10.1.1.1 255.255.255.248
  37. dhcp select interface
  38. #
  39. interface MEth0/0/1
  40. #
  41. interface Eth-Trunk1
  42. port link-type trunk
  43. port trunk allow-pass vlan 10
  44. mode lacp-static
  45. #
  46. interface GigabitEthernet0/0/1
  47. port link-type access
  48. port default vlan 30
  49. #
  50. interface GigabitEthernet0/0/2
  51. port link-type access
  52. port default vlan 30
  53. #
  54. interface GigabitEthernet0/0/3
  55. port link-type access
  56. port default vlan 30
  57. #
  58. interface GigabitEthernet0/0/4
  59. port link-type access
  60. port default vlan 30
  61. #
  62. interface GigabitEthernet0/0/5
  63. port link-type access
  64. port default vlan 30
  65. #
  66. interface GigabitEthernet0/0/6
  67. #
  68. interface GigabitEthernet0/0/7
  69. #
  70. interface GigabitEthernet0/0/8
  71. #
  72. interface GigabitEthernet0/0/9
  73. #
  74. interface GigabitEthernet0/0/10
  75. #
  76. interface GigabitEthernet0/0/11
  77. #
  78. interface GigabitEthernet0/0/12
  79. #
  80. interface GigabitEthernet0/0/13
  81. #
  82. interface GigabitEthernet0/0/14
  83. #
  84. interface GigabitEthernet0/0/15
  85. #
  86. interface GigabitEthernet0/0/16
  87. #
  88. interface GigabitEthernet0/0/17
  89. #
  90. interface GigabitEthernet0/0/18
  91. #
  92. interface GigabitEthernet0/0/19
  93. #
  94. interface GigabitEthernet0/0/20
  95. #
  96. interface GigabitEthernet0/0/21
  97. #
  98. interface GigabitEthernet0/0/22
  99. #
  100. interface GigabitEthernet0/0/23
  101. eth-trunk 1
  102. #
  103. interface GigabitEthernet0/0/24
  104. eth-trunk 1
  105. #
  106. interface NULL0
  107. #
  108. ip route-static 0.0.0.0 0.0.0.0 10.2.4.2
  109. #
  110. user-interface con 0
  111. user-interface vty 0 4
  112. #
  113. port-group vlan30
  114. group-member GigabitEthernet0/0/1
  115. group-member GigabitEthernet0/0/2
  116. group-member GigabitEthernet0/0/3
  117. group-member GigabitEthernet0/0/4
  118. group-member GigabitEthernet0/0/5
  119. #
  120. return

SW2配置文件:

  1. [SW2]dis current-configuration
  2. #
  3. sysname SW2
  4. #
  5. vlan batch 10 20 40
  6. #
  7. cluster enable
  8. ntdp enable
  9. ndp enable
  10. #
  11. drop illegal-mac alarm
  12. #
  13. diffserv domain default
  14. #
  15. drop-profile default
  16. #
  17. aaa
  18. authentication-scheme default
  19. authorization-scheme default
  20. accounting-scheme default
  21. domain default
  22. domain default_admin
  23. local-user admin password simple admin
  24. local-user admin service-type http
  25. #
  26. interface Vlanif1
  27. #
  28. interface Vlanif10
  29. ip address 10.2.4.2 255.255.255.252
  30. #
  31. interface Vlanif20
  32. ip address 10.2.4.5 255.255.255.252
  33. #
  34. interface Vlanif40
  35. ip address 10.2.4.9 255.255.255.252
  36. #
  37. interface MEth0/0/1
  38. #
  39. interface Eth-Trunk1
  40. port link-type trunk
  41. port trunk allow-pass vlan 10
  42. mode lacp-static
  43. #
  44. interface Eth-Trunk2
  45. port link-type trunk
  46. port trunk allow-pass vlan 20
  47. mode lacp-static
  48. #
  49. interface Eth-Trunk3
  50. port link-type trunk
  51. port trunk allow-pass vlan 40
  52. mode lacp-static
  53. #
  54. interface GigabitEthernet0/0/1
  55. #
  56. interface GigabitEthernet0/0/2
  57. #
  58. interface GigabitEthernet0/0/3
  59. #
  60. interface GigabitEthernet0/0/4
  61. #
  62. interface GigabitEthernet0/0/5
  63. #
  64. interface GigabitEthernet0/0/6
  65. #
  66. interface GigabitEthernet0/0/7
  67. #
  68. interface GigabitEthernet0/0/8
  69. #
  70. interface GigabitEthernet0/0/9
  71. #
  72. interface GigabitEthernet0/0/10
  73. #
  74. interface GigabitEthernet0/0/11
  75. #
  76. interface GigabitEthernet0/0/12
  77. #
  78. interface GigabitEthernet0/0/13
  79. #
  80. interface GigabitEthernet0/0/14
  81. #
  82. interface GigabitEthernet0/0/15
  83. #
  84. interface GigabitEthernet0/0/16
  85. #
  86. interface GigabitEthernet0/0/17
  87. #
  88. interface GigabitEthernet0/0/18
  89. #
  90. interface GigabitEthernet0/0/19
  91. eth-trunk 2
  92. #
  93. interface GigabitEthernet0/0/20
  94. eth-trunk 2
  95. #
  96. interface GigabitEthernet0/0/21
  97. eth-trunk 3
  98. #
  99. interface GigabitEthernet0/0/22
  100. eth-trunk 3
  101. #
  102. interface GigabitEthernet0/0/23
  103. eth-trunk 1
  104. #
  105. interface GigabitEthernet0/0/24
  106. eth-trunk 1
  107. #
  108. interface NULL0
  109. #
  110. ip route-static 10.1.1.0 255.255.255.248 10.2.4.1
  111. ip route-static 10.1.2.0 255.255.255.248 10.2.4.6
  112. ip route-static 10.1.3.0 255.255.255.248 10.2.4.10
  113. #
  114. user-interface con 0
  115. user-interface vty 0 4
  116. #
  117. return

SW3配置文件:

  1. [SW3]dis current-configuration
  2. #
  3. sysname SW3
  4. #
  5. vlan batch 20 50
  6. #
  7. cluster enable
  8. ntdp enable
  9. ndp enable
  10. #
  11. drop illegal-mac alarm
  12. #
  13. dhcp enable
  14. #
  15. diffserv domain default
  16. #
  17. drop-profile default
  18. #
  19. aaa
  20. authentication-scheme default
  21. authorization-scheme default
  22. accounting-scheme default
  23. domain default
  24. domain default_admin
  25. local-user admin password simple admin
  26. local-user admin service-type http
  27. #
  28. interface Vlanif1
  29. #
  30. interface Vlanif20
  31. ip address 10.2.4.6 255.255.255.252
  32. #
  33. interface Vlanif50
  34. ip address 10.1.2.1 255.255.255.248
  35. dhcp select interface
  36. #
  37. interface MEth0/0/1
  38. #
  39. interface Eth-Trunk1
  40. port link-type trunk
  41. port trunk allow-pass vlan 20
  42. mode lacp-static
  43. #
  44. interface GigabitEthernet0/0/1
  45. port link-type access
  46. port default vlan 50
  47. #
  48. interface GigabitEthernet0/0/2
  49. port link-type access
  50. port default vlan 50
  51. #
  52. interface GigabitEthernet0/0/3
  53. port link-type access
  54. port default vlan 50
  55. #
  56. interface GigabitEthernet0/0/4
  57. port link-type access
  58. port default vlan 50
  59. #
  60. interface GigabitEthernet0/0/5
  61. port link-type access
  62. port default vlan 50
  63. #
  64. interface GigabitEthernet0/0/6
  65. #
  66. interface GigabitEthernet0/0/7
  67. #
  68. interface GigabitEthernet0/0/8
  69. #
  70. interface GigabitEthernet0/0/9
  71. #
  72. interface GigabitEthernet0/0/10
  73. #
  74. interface GigabitEthernet0/0/11
  75. #
  76. interface GigabitEthernet0/0/12
  77. #
  78. interface GigabitEthernet0/0/13
  79. #
  80. interface GigabitEthernet0/0/14
  81. #
  82. interface GigabitEthernet0/0/15
  83. #
  84. interface GigabitEthernet0/0/16
  85. #
  86. interface GigabitEthernet0/0/17
  87. #
  88. interface GigabitEthernet0/0/18
  89. #
  90. interface GigabitEthernet0/0/19
  91. #
  92. interface GigabitEthernet0/0/20
  93. #
  94. interface GigabitEthernet0/0/21
  95. #
  96. interface GigabitEthernet0/0/22
  97. #
  98. interface GigabitEthernet0/0/23
  99. eth-trunk 1
  100. #
  101. interface GigabitEthernet0/0/24
  102. eth-trunk 1
  103. #
  104. interface NULL0
  105. #
  106. ip route-static 0.0.0.0 0.0.0.0 10.2.4.5
  107. #
  108. user-interface con 0
  109. user-interface vty 0 4
  110. #
  111. port-group vlan50
  112. group-member GigabitEthernet0/0/1
  113. group-member GigabitEthernet0/0/2
  114. group-member GigabitEthernet0/0/3
  115. group-member GigabitEthernet0/0/4
  116. group-member GigabitEthernet0/0/5
  117. #

SW4配置文件:

  1. [SW4]dis cur
  2. #
  3. sysname SW4
  4. #
  5. vlan batch 40 60
  6. #
  7. cluster enable
  8. ntdp enable
  9. ndp enable
  10. #
  11. drop illegal-mac alarm
  12. #
  13. dhcp enable
  14. #
  15. diffserv domain default
  16. #
  17. drop-profile default
  18. #
  19. aaa
  20. authentication-scheme default
  21. authorization-scheme default
  22. accounting-scheme default
  23. domain default
  24. domain default_admin
  25. local-user admin password simple admin
  26. local-user admin service-type http
  27. #
  28. interface Vlanif1
  29. #
  30. interface Vlanif40
  31. ip address 10.2.4.10 255.255.255.252
  32. #
  33. interface Vlanif60
  34. ip address 10.1.3.1 255.255.255.248
  35. dhcp select interface
  36. #
  37. interface MEth0/0/1
  38. #
  39. interface Eth-Trunk1
  40. port link-type trunk
  41. port trunk allow-pass vlan 40
  42. mode lacp-static
  43. #
  44. interface GigabitEthernet0/0/1
  45. port link-type access
  46. port default vlan 60
  47. #
  48. interface GigabitEthernet0/0/2
  49. port link-type access
  50. port default vlan 60
  51. #
  52. interface GigabitEthernet0/0/3
  53. port link-type access
  54. port default vlan 60
  55. #
  56. interface GigabitEthernet0/0/4
  57. port link-type access
  58. port default vlan 60
  59. #
  60. interface GigabitEthernet0/0/5
  61. port link-type access
  62. port default vlan 60
  63. #
  64. interface GigabitEthernet0/0/6
  65. #
  66. interface GigabitEthernet0/0/7
  67. #
  68. interface GigabitEthernet0/0/8
  69. #
  70. interface GigabitEthernet0/0/9
  71. #
  72. interface GigabitEthernet0/0/10
  73. #
  74. interface GigabitEthernet0/0/11
  75. #
  76. interface GigabitEthernet0/0/12
  77. #
  78. interface GigabitEthernet0/0/13
  79. #
  80. interface GigabitEthernet0/0/14
  81. #
  82. interface GigabitEthernet0/0/15
  83. #
  84. interface GigabitEthernet0/0/16
  85. #
  86. interface GigabitEthernet0/0/17
  87. #
  88. interface GigabitEthernet0/0/18
  89. #
  90. interface GigabitEthernet0/0/19
  91. #
  92. interface GigabitEthernet0/0/20
  93. #
  94. interface GigabitEthernet0/0/21
  95. #
  96. interface GigabitEthernet0/0/22
  97. #
  98. interface GigabitEthernet0/0/23
  99. eth-trunk 1
  100. #
  101. interface GigabitEthernet0/0/24
  102. eth-trunk 1
  103. #
  104. interface NULL0
  105. #
  106. ip route-static 0.0.0.0 0.0.0.0 10.2.4.9
  107. #
  108. user-interface con 0
  109. user-interface vty 0 4
  110. #
  111. port-group vlan60
  112. group-member GigabitEthernet0/0/1
  113. group-member GigabitEthernet0/0/2
  114. group-member GigabitEthernet0/0/3
  115. group-member GigabitEthernet0/0/4
  116. group-member GigabitEthernet0/0/5
  117. #
  118. return

 

 

 

 

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/206793
推荐阅读
相关标签
  

闽ICP备14008679号