当前位置:   article > 正文

python自动化管理和zabbix监控网络设备(有线网络和路由配置部分)

python自动化管理和zabbix监控网络设备(有线网络和路由配置部分)

目录

一、拓扑图

二、core-sw1

三、core-sw2

四、sum-sw1

五、sum-sw2

六、FW1

七、DMZ-SW1

结语


前言


具体原理和操作可以访问我的主页视频

白帽小丑的个人空间-白帽小丑个人主页-哔哩哔哩视频


一、拓扑图

二、core-sw1

  1. sys
  2. sysname core-sw1
  3. vlan batch 10 20 30 40 50 60 100
  4. vlan batch 200 210 220 230 240 250
  5. stp region-configuration
  6. region-name huawei
  7. revision-level 1
  8. instance 1 vlan 10 20 30
  9. instance 2 vlan 40 50 60
  10. instance 3 vlan 200 210 220
  11. instance 4 vlan 230 240 250
  12. instance 5 vlan 100
  13. active region-configuration
  14. q
  15. stp instance 1 root primary
  16. stp instance 3 root primary
  17. stp instance 5 root primary
  18. stp instance 2 root secondary
  19. stp instance 4 root secondary
  20. inter gi0/0/1
  21. port link trunk
  22. port trunk all vlan all
  23. inter gi0/0/2
  24. port link trunk
  25. port trunk all vlan all
  26. interface Eth-Trunk 1
  27. p l t
  28. p t a v all
  29. inter gi0/0/3
  30. eth-trunk 1
  31. inter gi0/0/4
  32. eth-trunk 1
  33. interface Vlanif 10
  34. ip address 172.16.0.252 23
  35. vrrp vrid 10 virtual-ip 172.16.1.254
  36. vrrp vrid 10 priority 120
  37. interface Vlanif 20
  38. ip address 172.16.2.252 23
  39. vrrp vrid 10 virtual-ip 172.16.3.254
  40. vrrp vrid 10 priority 120
  41. interface Vlanif 30
  42. ip address 172.16.4.252 23
  43. vrrp vrid 10 virtual-ip 172.16.5.254
  44. vrrp vrid 10 priority 120
  45. interface Vlanif 40
  46. ip address 172.16.6.252 23
  47. vrrp vrid 10 virtual-ip 172.16.7.254
  48. vrrp vrid 10 priority 100
  49. interface Vlanif 50
  50. ip address 172.16.8.252 23
  51. vrrp vrid 10 virtual-ip 172.16.9.254
  52. vrrp vrid 10 priority 100
  53. interface Vlanif 60
  54. ip address 172.16.10.252 23
  55. vrrp vrid 10 virtual-ip 172.16.11.254
  56. vrrp vrid 10 priority 100
  57. dhcp enable
  58. ip pool vlan10
  59. network 172.16.0.0 mask 23
  60. gateway-list 172.16.1.254
  61. dns-list 192.168.150.1
  62. excluded-ip-address 172.16.1.1 172.16.1.253
  63. excluded-ip-address 172.16.0.252 172.16.0.253
  64. q
  65. interface Vlanif 10
  66. dhcp select global
  67. q
  68. ip pool vlan20
  69. network 172.16.2.0 mask 23
  70. gateway-list 172.16.3.254
  71. dns-list 192.168.150.1
  72. excluded-ip-address 172.16.3.1 172.16.3.253
  73. excluded-ip-address 172.16.2.252 172.16.2.253
  74. q
  75. interface Vlanif 20
  76. dhcp select global
  77. q
  78. ip pool vlan30
  79. network 172.16.4.0 mask 23
  80. gateway-list 172.16.5.254
  81. dns-list 192.168.150.1
  82. excluded-ip-address 172.16.5.1 172.16.5.253
  83. excluded-ip-address 172.16.4.252 172.16.4.253
  84. q
  85. interface Vlanif 30
  86. dhcp select global
  87. q
  88. ip pool vlan40
  89. network 172.16.6.0 mask 23
  90. gateway-list 172.16.7.254
  91. dns-list 192.168.150.1
  92. excluded-ip-address 172.16.7.1 172.16.7.253
  93. excluded-ip-address 172.16.6.252 172.16.6.253
  94. q
  95. interface Vlanif 40
  96. dhcp select global
  97. q
  98. ip pool vlan50
  99. network 172.16.8.0 mask 23
  100. gateway-list 172.16.9.254
  101. dns-list 192.168.150.1
  102. excluded-ip-address 172.16.9.1 172.16.9.253
  103. excluded-ip-address 172.16.8.252 172.16.8.253
  104. q
  105. interface Vlanif 50
  106. dhcp select global
  107. q
  108. ip pool vlan60
  109. network 172.16.10.0 mask 23
  110. gateway-list 172.16.11.254
  111. dns-list 192.168.150.1
  112. excluded-ip-address 172.16.11.1 172.16.11.253
  113. excluded-ip-address 172.16.10.252 172.16.10.253
  114. q
  115. interface Vlanif 60
  116. dhcp select global
  117. q
  118. interface Vlanif 200
  119. ip address 172.200.1.251 23
  120. vrrp vrid 20 virtual-ip 172.200.1.254
  121. vrrp vrid 20 priority 120
  122. interface Vlanif 210
  123. ip address 172.210.3.251 23
  124. vrrp vrid 20 virtual-ip 172.210.3.254
  125. vrrp vrid 20 priority 120
  126. interface Vlanif 220
  127. ip address 172.220.5.251 23
  128. vrrp vrid 20 virtual-ip 172.220.5.254
  129. vrrp vrid 20 priority 120
  130. interface Vlanif 230
  131. ip address 172.230.7.251 23
  132. vrrp vrid 20 virtual-ip 172.230.7.254
  133. vrrp vrid 20 priority 100
  134. interface Vlanif 240
  135. ip address 172.240.9.251 23
  136. vrrp vrid 20 virtual-ip 172.240.9.254
  137. vrrp vrid 20 priority 100
  138. interface Vlanif 250
  139. ip address 172.250.11.251 23
  140. vrrp vrid 20 virtual-ip 172.250.11.254
  141. vrrp vrid 20 priority 100
  142. interface Vlanif 100
  143. ip address 192.168.100.251 24
  144. vrrp vrid 20 virtual-ip 192.168.100.254
  145. vrrp vrid 20 priority 120
  146. vlan 70
  147. inter vlan 70
  148. ip address 10.1.70.1 30
  149. inter gi0/0/5
  150. p l ac
  151. p de vlan 70
  152. inter loop 0
  153. ip address 2.2.2.2 32
  154. router id 2.2.2.2
  155. ospf 1
  156. area 0
  157. network 10.1.70.0 0.0.0.3
  158. network 172.16.0.0 255.255.254.0
  159. network 172.16.2.0 255.255.254.0
  160. network 172.16.4.0 255.255.254.0
  161. network 172.16.6.0 255.255.254.0
  162. network 172.16.8.0 255.255.254.0
  163. network 172.16.10.0 255.255.254.0
  164. network 172.200.0.0 255.255.254.0
  165. network 172.210.2.0 255.255.254.0
  166. network 172.220.4.0 255.255.254.0
  167. network 172.230.6.0 255.255.254.0
  168. network 172.240.8.0 255.255.254.0
  169. network 172.250.10.0 255.255.254.0
  170. network 192.168.100.0 255.255.255.0
  171. network 2.2.2.2 0.0.0.0
  172. quit

三、core-sw2

  1. sys
  2. sysname core-sw2
  3. vlan batch 10 20 30 40 50 60 100
  4. vlan batch 200 210 220 230 240 250
  5. stp region-configuration
  6. region-name huawei
  7. revision-level 1
  8. instance 1 vlan 10 20 30
  9. instance 2 vlan 40 50 60
  10. instance 3 vlan 200 210 220
  11. instance 4 vlan 230 240 250
  12. instance 5 vlan 100
  13. active region-configuration
  14. q
  15. stp instance 1 root secondary
  16. stp instance 3 root secondary
  17. stp instance 5 root secondary
  18. stp instance 2 root primary
  19. stp instance 4 root primary
  20. inter gi0/0/1
  21. port link trunk
  22. port trunk all vlan all
  23. inter gi0/0/2
  24. port link trunk
  25. port trunk all vlan all
  26. interface Eth-Trunk 1
  27. p l t
  28. p t a v all
  29. inter gi0/0/3
  30. eth-trunk 1
  31. inter gi0/0/4
  32. eth-trunk 1
  33. sys
  34. sysname core-sw1
  35. vlan batch 10 20 30 40 50 60 100
  36. vlan batch 200 210 220 230 240 250
  37. stp region-configuration
  38. region-name huawei
  39. revision-level 1
  40. instance 1 vlan 10 20 30
  41. instance 2 vlan 40 50 60
  42. instance 3 vlan 200 210 220
  43. instance 4 vlan 230 240 250
  44. instance 5 vlan 100
  45. active region-configuration
  46. q
  47. stp instance 1 root primary
  48. stp instance 3 root primary
  49. stp instance 5 root primary
  50. stp instance 2 root secondary
  51. stp instance 4 root secondary
  52. inter gi0/0/1
  53. port link trunk
  54. port trunk all vlan all
  55. inter gi0/0/2
  56. port link trunk
  57. port trunk all vlan all
  58. interface Eth-Trunk 1
  59. p l t
  60. p t a v all
  61. inter gi0/0/3
  62. eth-trunk 1
  63. inter gi0/0/4
  64. eth-trunk 1
  65. interface Vlanif 10
  66. ip address 172.16.0.253 23
  67. vrrp vrid 10 virtual-ip 172.16.1.254
  68. vrrp vrid 10 priority 100
  69. interface Vlanif 20
  70. ip address 172.16.2.253 23
  71. vrrp vrid 10 virtual-ip 172.16.3.254
  72. vrrp vrid 10 priority 100
  73. interface Vlanif 30
  74. ip address 172.16.4.253 23
  75. vrrp vrid 10 virtual-ip 172.16.5.254
  76. vrrp vrid 10 priority 100
  77. interface Vlanif 40
  78. ip address 172.16.6.253 23
  79. vrrp vrid 10 virtual-ip 172.16.7.254
  80. vrrp vrid 10 priority 120
  81. interface Vlanif 50
  82. ip address 172.16.8.253 23
  83. vrrp vrid 10 virtual-ip 172.16.9.254
  84. vrrp vrid 10 priority 120
  85. interface Vlanif 60
  86. ip address 172.16.10.253 23
  87. vrrp vrid 10 virtual-ip 172.16.11.254
  88. vrrp vrid 10 priority 120
  89. dhcp enable
  90. ip pool vlan10
  91. network 172.16.0.0 mask 23
  92. gateway-list 172.16.1.254
  93. dns-list 192.168.150.1
  94. excluded-ip-address 172.16.0.1 172.16.0.254
  95. q
  96. interface Vlanif 10
  97. dhcp select global
  98. q
  99. ip pool vlan20
  100. network 172.16.2.0 mask 23
  101. gateway-list 172.16.3.254
  102. dns-list 192.168.150.1
  103. excluded-ip-address 172.16.2.1 172.16.2.254
  104. q
  105. interface Vlanif 20
  106. dhcp select global
  107. q
  108. ip pool vlan30
  109. network 172.16.4.0 mask 23
  110. gateway-list 172.16.5.254
  111. dns-list 192.168.150.1
  112. excluded-ip-address 172.16.4.1 172.16.4.254
  113. q
  114. interface Vlanif 30
  115. dhcp select global
  116. q
  117. ip pool vlan40
  118. network 172.16.6.0 mask 23
  119. gateway-list 172.16.7.254
  120. dns-list 192.168.150.1
  121. excluded-ip-address 172.16.6.1 172.16.6.254
  122. q
  123. interface Vlanif 40
  124. dhcp select global
  125. q
  126. ip pool vlan50
  127. network 172.16.8.0 mask 23
  128. gateway-list 172.16.9.254
  129. dns-list 192.168.150.1
  130. excluded-ip-address 172.16.8.1 172.16.8.254
  131. q
  132. interface Vlanif 50
  133. dhcp select global
  134. q
  135. ip pool vlan60
  136. network 172.16.10.0 mask 23
  137. gateway-list 172.16.11.254
  138. dns-list 192.168.150.1
  139. excluded-ip-address 172.16.10.1 172.16.10.254
  140. q
  141. interface Vlanif 60
  142. dhcp select global
  143. q
  144. interface Vlanif 200
  145. ip address 172.200.1.252 23
  146. vrrp vrid 20 virtual-ip 172.200.1.254
  147. vrrp vrid 20 priority 100
  148. interface Vlanif 210
  149. ip address 172.210.3.252 23
  150. vrrp vrid 20 virtual-ip 172.210.3.254
  151. vrrp vrid 20 priority 100
  152. interface Vlanif 220
  153. ip address 172.220.5.252 23
  154. vrrp vrid 20 virtual-ip 172.220.5.254
  155. vrrp vrid 20 priority 100
  156. interface Vlanif 230
  157. ip address 172.230.7.252 23
  158. vrrp vrid 20 virtual-ip 172.230.7.254
  159. vrrp vrid 20 priority 120
  160. interface Vlanif 240
  161. ip address 172.240.9.252 23
  162. vrrp vrid 20 virtual-ip 172.240.9.254
  163. vrrp vrid 20 priority 120
  164. interface Vlanif 250
  165. ip address 172.250.11.252 23
  166. vrrp vrid 20 virtual-ip 172.250.11.254
  167. vrrp vrid 20 priority 120
  168. interface Vlanif 100
  169. ip address 192.168.100.252 24
  170. vrrp vrid 20 virtual-ip 192.168.100.254
  171. vrrp vrid 20 priority 100
  172. vlan 80
  173. inter vlan 80
  174. ip address 10.1.80.1 30
  175. inter gi0/0/5
  176. p l ac
  177. p de vlan 80
  178. inter loop 0
  179. ip address 3.3.3.3 32
  180. router id 3.3.3.3
  181. ospf 1
  182. silent-interface Vlanif 10
  183. silent-interface Vlanif 20
  184. silent-interface Vlanif 30
  185. silent-interface Vlanif 40
  186. silent-interface Vlanif 50
  187. silent-interface Vlanif 60
  188. silent-interface Vlanif 200
  189. silent-interface Vlanif 210
  190. silent-interface Vlanif 220
  191. silent-interface Vlanif 230
  192. silent-interface Vlanif 240
  193. silent-interface Vlanif 250
  194. silent-interface Vlanif 100
  195. area 0
  196. network 10.1.80.0 0.0.0.3
  197. network 172.16.0.0 255.255.254.0
  198. network 172.16.2.0 255.255.254.0
  199. network 172.16.4.0 255.255.254.0
  200. network 172.16.6.0 255.255.254.0
  201. network 172.16.8.0 255.255.254.0
  202. network 172.16.10.0 255.255.254.0
  203. network 172.200.0.0 255.255.254.0
  204. network 172.210.2.0 255.255.254.0
  205. network 172.220.4.0 255.255.254.0
  206. network 172.230.6.0 255.255.254.0
  207. network 172.240.8.0 255.255.254.0
  208. network 172.250.10.0 255.255.254.0
  209. network 192.168.100.0 255.255.255.0
  210. network 3.3.3.3 0.0.0.0
  211. q

四、sum-sw1

  1. sys
  2. sysname sum-sw1
  3. vlan batch 10 20 30 40 50 60 100
  4. vlan batch 200 210 220 230 240 250
  5. port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/9
  6. port link-type trunk
  7. port trunk allow-pass vlan all
  8. q
  9. stp region-configuration
  10. region-name huawei
  11. revision-level 1
  12. instance 1 vlan 10 20 30
  13. instance 2 vlan 40 50 60
  14. instance 3 vlan 200 210 220
  15. instance 4 vlan 230 240 250
  16. instance 5 vlan 100
  17. active region-configuration
  18. q

五、sum-sw2

  1. sys
  2. sysname sum-sw2
  3. vlan batch 10 20 30 40 50 60 100
  4. vlan batch 200 210 220 230 240 250
  5. port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/9
  6. port link-type trunk
  7. port trunk allow-pass vlan all
  8. q
  9. stp region-configuration
  10. region-name huawei
  11. revision-level 1
  12. instance 1 vlan 10 20 30
  13. instance 2 vlan 40 50 60
  14. instance 3 vlan 200 210 220
  15. instance 4 vlan 230 240 250
  16. instance 5 vlan 100
  17. active region-configuration
  18. q

六、sw1-6

  1. system-view
  2. sysname SW1
  3. vlan batch 10 100 200
  4. inter gi0/0/1
  5. port link-type trunk
  6. port trunk allow-pass vlan 10 100 200
  7. quit
  8. inter gi0/0/2
  9. port link-type trunk
  10. port trunk allow-pass vlan 10 100 200
  11. quit
  12. inter gi0/0/3
  13. port link-type access
  14. port default vlan 10
  15. quit
  16. inter gi0/0/4
  1. system-view
  2. sysname SW2
  3. vlan batch 20 100 210
  4. inter gi0/0/1
  5. port link-type trunk
  6. port trunk allow-pass vlan 20 100 210
  7. quit
  8. inter gi0/0/2
  9. port link-type trunk
  10. port trunk allow-pass vlan 20 100 210
  11. quit
  12. inter gi0/0/3
  13. port link-type access
  14. port default vlan 20
  15. quit
  1. system-view
  2. sysname SW3
  3. vlan batch 30 100 220
  4. inter gi0/0/1
  5. port link-type trunk
  6. port trunk allow-pass vlan 30 100 220
  7. quit
  8. inter gi0/0/2
  9. port link-type trunk
  10. port trunk allow-pass vlan 30 100 220
  11. quit
  12. inter gi0/0/3
  13. port link-type access
  14. port default vlan 30
  15. quit
  1. system-view
  2. sysname SW4
  3. vlan batch 40 100 230
  4. inter gi0/0/1
  5. port link-type trunk
  6. port trunk allow-pass vlan 40 100 230
  7. quit
  8. inter gi0/0/2
  9. port link-type trunk
  10. port trunk allow-pass vlan 40 100 230
  11. quit
  12. inter gi0/0/3
  13. port link-type access
  14. port default vlan 40
  15. quit
  1. system-view
  2. sysname SW5
  3. vlan batch 50 100 240
  4. inter gi0/0/1
  5. port link-type trunk
  6. port trunk allow-pass vlan 50 100 240
  7. quit
  8. inter gi0/0/2
  9. port link-type trunk
  10. port trunk allow-pass vlan 50 100 240
  11. quit
  12. inter gi0/0/3
  13. port link-type access
  14. port default vlan 50
  15. quit
  1. system-view
  2. sysname SW6
  3. vlan batch 60 100 250
  4. inter gi0/0/1
  5. port link-type trunk
  6. port trunk allow-pass vlan 60 100 250
  7. quit
  8. inter gi0/0/2
  9. port link-type trunk
  10. port trunk allow-pass vlan 60 100 250
  11. quit
  12. inter gi0/0/3
  13. port link-type access
  14. port default vlan 60
  15. quit

六、FW1

  1. admin
  2. Huawei@123
  3. Admin@123
  4. sys
  5. sysname FW1
  6. firewall zone untrust
  7. add interface GigabitEthernet1/0/4
  8. firewall zone trust
  9. add interface GigabitEthernet0/0/0
  10. add interface GigabitEthernet1/0/0
  11. add interface GigabitEthernet1/0/1
  12. add interface GigabitEthernet1/0/3
  13. firewall zone dmz
  14. add interface GigabitEthernet1/0/2
  15. inter gi1/0/0
  16. ip address 10.1.70.2 30
  17. inter gi1/0/1
  18. ip address 10.1.80.2 30
  19. inter loop 0
  20. ip address 1.1.1.1 32
  21. router id 1.1.1.1
  22. ospf 1
  23. default-route-advertise always
  24. area 0
  25. network 10.1.70.0 0.0.0.3
  26. network 10.1.80.0 0.0.0.3

七、DMZ-SW1

  1. sys
  2. sysname DMZ-SW1
  3. vlan batch 150 160 170
  4. interface Vlanif150
  5. ip address 192.168.150.254 255.255.255.0
  6. interface Vlanif160
  7. ip address 192.168.160.254 255.255.255.0
  8. interface Vlanif170
  9. ip address 192.168.170.254 255.255.255.0
  10. inter gi0/0/2
  11. p l a
  12. p d v 150
  13. inter gi0/0/3
  14. p l a
  15. p d v 160
  16. inter gi0/0/4
  17. p l a
  18. p d v 170
  19. vlan 90
  20. inter vlan 90
  21. ip address 10.1.90.1 30
  22. inter gi0/0/1
  23. p l a
  24. p d v 90
  25. q
  26. int LoopBack 0
  27. ip add 4.4.4.4 32
  28. router id 4.4.4.4
  29. ospf 1
  30. area 0.0.0.1
  31. network 192.168.150.0 0.0.0.255
  32. network 192.168.160.0 0.0.0.255
  33. network 192.168.170.0 0.0.0.255
  34. network 10.1.90.0 0.0.0.3
  35. network 4.4.4.4 0.0.0.0
  36. quit

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

闽ICP备14008679号