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

目录

目录

一、拓扑图

二、core-sw1

三、core-sw2

四、sum-sw1

五、sum-sw2

六、FW1

七、DMZ-SW1

结语



一、拓扑图

二、core-sw1

复制代码
sys
sysname core-sw1
vlan batch 10 20 30 40 50 60 100 
vlan batch 200 210 220 230 240 250 


stp region-configuration 
region-name huawei
revision-level 1
instance 1 vlan 10 20 30
instance 2 vlan 40 50 60
instance 3 vlan 200 210 220
instance 4 vlan 230 240 250
instance 5 vlan 100
active region-configuration
q


stp instance 1 root primary
stp instance 3 root primary
stp instance 5 root primary

stp instance 2 root secondary
stp instance 4 root secondary


inter gi0/0/1
port link trunk
port trunk all vlan all

inter gi0/0/2
port link trunk
port trunk all vlan all

  interface Eth-Trunk 1
  p l t
  p t a v all
  inter gi0/0/3
  eth-trunk 1
  inter gi0/0/4
  eth-trunk 1



interface Vlanif 10
ip address 172.16.0.252 23
vrrp vrid 10 virtual-ip 172.16.1.254
vrrp vrid 10 priority 120

interface Vlanif 20
ip address 172.16.2.252 23
vrrp vrid 10 virtual-ip 172.16.3.254
vrrp vrid 10 priority 120

interface Vlanif 30
ip address 172.16.4.252 23
vrrp vrid 10 virtual-ip 172.16.5.254
vrrp vrid 10 priority 120

interface Vlanif 40
ip address 172.16.6.252 23
vrrp vrid 10 virtual-ip 172.16.7.254
vrrp vrid 10 priority 100

interface Vlanif 50
ip address 172.16.8.252 23
vrrp vrid 10 virtual-ip 172.16.9.254
vrrp vrid 10 priority 100

interface Vlanif 60
ip address 172.16.10.252 23
vrrp vrid 10 virtual-ip 172.16.11.254
vrrp vrid 10 priority 100


dhcp enable
ip pool vlan10
network 172.16.0.0 mask 23
gateway-list 172.16.1.254
dns-list 192.168.150.1
excluded-ip-address 172.16.1.1 172.16.1.253
excluded-ip-address 172.16.0.252 172.16.0.253
q

interface Vlanif 10 
dhcp select global
q

ip pool vlan20
network 172.16.2.0 mask 23
gateway-list 172.16.3.254
dns-list 192.168.150.1
excluded-ip-address 172.16.3.1 172.16.3.253
excluded-ip-address 172.16.2.252 172.16.2.253
q

interface Vlanif 20
dhcp select global
q

ip pool vlan30
network 172.16.4.0 mask 23
gateway-list 172.16.5.254
dns-list 192.168.150.1
excluded-ip-address 172.16.5.1 172.16.5.253
excluded-ip-address 172.16.4.252 172.16.4.253
q

interface Vlanif 30 
dhcp select global
q

ip pool vlan40
network 172.16.6.0 mask 23
gateway-list 172.16.7.254
dns-list 192.168.150.1
excluded-ip-address 172.16.7.1 172.16.7.253
excluded-ip-address 172.16.6.252 172.16.6.253
q

interface Vlanif 40
dhcp select global
q

ip pool vlan50
network 172.16.8.0 mask 23
gateway-list 172.16.9.254
dns-list 192.168.150.1
excluded-ip-address 172.16.9.1 172.16.9.253
excluded-ip-address 172.16.8.252 172.16.8.253
q

interface Vlanif 50
dhcp select global
q

ip pool vlan60
network 172.16.10.0 mask 23
gateway-list 172.16.11.254
dns-list 192.168.150.1
excluded-ip-address 172.16.11.1 172.16.11.253
excluded-ip-address 172.16.10.252 172.16.10.253
q

interface Vlanif 60
dhcp select global
q




interface Vlanif 200
ip address 172.200.1.251 23
vrrp vrid 20 virtual-ip 172.200.1.254
vrrp vrid 20 priority 120

interface Vlanif 210
ip address 172.210.3.251 23
vrrp vrid 20 virtual-ip 172.210.3.254
vrrp vrid 20 priority 120

interface Vlanif 220
ip address 172.220.5.251 23
vrrp vrid 20 virtual-ip 172.220.5.254
vrrp vrid 20 priority 120

interface Vlanif 230
ip address 172.230.7.251 23
vrrp vrid 20 virtual-ip 172.230.7.254
vrrp vrid 20 priority 100

interface Vlanif 240
ip address 172.240.9.251 23
vrrp vrid 20 virtual-ip 172.240.9.254
vrrp vrid 20 priority 100

interface Vlanif 250
ip address 172.250.11.251 23
vrrp vrid 20 virtual-ip 172.250.11.254
vrrp vrid 20 priority 100

interface Vlanif 100
ip address 192.168.100.251 24
vrrp vrid 20 virtual-ip 192.168.100.254
vrrp vrid 20 priority 120

  vlan 70
  inter vlan 70
  ip address 10.1.70.1 30
  inter gi0/0/5
  p l ac
  p de vlan 70


inter loop 0
ip address 2.2.2.2 32

router id 2.2.2.2
ospf 1
area 0	
network 10.1.70.0 0.0.0.3
network 172.16.0.0 255.255.254.0
network 172.16.2.0 255.255.254.0
network 172.16.4.0 255.255.254.0
network 172.16.6.0 255.255.254.0
network 172.16.8.0 255.255.254.0
network 172.16.10.0 255.255.254.0
network 172.200.0.0 255.255.254.0
network 172.210.2.0 255.255.254.0
network 172.220.4.0 255.255.254.0
network 172.230.6.0 255.255.254.0
network 172.240.8.0 255.255.254.0
network 172.250.10.0 255.255.254.0
network 192.168.100.0 255.255.255.0
network 2.2.2.2 0.0.0.0 
quit

三、core-sw2

复制代码
sys
sysname core-sw2
vlan batch 10 20 30 40 50 60 100 
vlan batch 200 210 220 230 240 250 


stp region-configuration 
region-name huawei
revision-level 1
instance 1 vlan 10 20 30
instance 2 vlan 40 50 60
instance 3 vlan 200 210 220
instance 4 vlan 230 240 250
instance 5 vlan 100
active region-configuration
q


stp instance 1 root secondary
stp instance 3 root secondary
stp instance 5 root secondary

stp instance 2 root primary
stp instance 4 root primary



inter gi0/0/1
port link trunk
port trunk all vlan all

inter gi0/0/2
port link trunk
port trunk all vlan all

  interface Eth-Trunk 1
  p l t
  p t a v all
  inter gi0/0/3
  eth-trunk 1
  inter gi0/0/4
  eth-trunk 1



sys
sysname core-sw1
vlan batch 10 20 30 40 50 60 100 
vlan batch 200 210 220 230 240 250 


stp region-configuration 
region-name huawei
revision-level 1
instance 1 vlan 10 20 30
instance 2 vlan 40 50 60
instance 3 vlan 200 210 220
instance 4 vlan 230 240 250
instance 5 vlan 100
active region-configuration
q


stp instance 1 root primary
stp instance 3 root primary
stp instance 5 root primary

stp instance 2 root secondary
stp instance 4 root secondary


inter gi0/0/1
port link trunk
port trunk all vlan all

inter gi0/0/2
port link trunk
port trunk all vlan all

  interface Eth-Trunk 1
  p l t
  p t a v all
  inter gi0/0/3
  eth-trunk 1
  inter gi0/0/4
  eth-trunk 1



interface Vlanif 10
ip address 172.16.0.253 23
vrrp vrid 10 virtual-ip 172.16.1.254
vrrp vrid 10 priority 100

interface Vlanif 20
ip address 172.16.2.253 23
vrrp vrid 10 virtual-ip 172.16.3.254
vrrp vrid 10 priority 100

interface Vlanif 30
ip address 172.16.4.253 23
vrrp vrid 10 virtual-ip 172.16.5.254
vrrp vrid 10 priority 100

interface Vlanif 40
ip address 172.16.6.253 23
vrrp vrid 10 virtual-ip 172.16.7.254
vrrp vrid 10 priority 120

interface Vlanif 50
ip address 172.16.8.253 23
vrrp vrid 10 virtual-ip 172.16.9.254
vrrp vrid 10 priority 120

interface Vlanif 60
ip address 172.16.10.253 23
vrrp vrid 10 virtual-ip 172.16.11.254
vrrp vrid 10 priority 120


dhcp enable
ip pool vlan10
network 172.16.0.0 mask 23
gateway-list 172.16.1.254
dns-list 192.168.150.1
excluded-ip-address 172.16.0.1 172.16.0.254
q

interface Vlanif 10 
dhcp select global
q

ip pool vlan20
network 172.16.2.0 mask 23
gateway-list 172.16.3.254
dns-list 192.168.150.1
excluded-ip-address 172.16.2.1 172.16.2.254
q

interface Vlanif 20
dhcp select global
q

ip pool vlan30
network 172.16.4.0 mask 23
gateway-list 172.16.5.254
dns-list 192.168.150.1
excluded-ip-address 172.16.4.1 172.16.4.254
q

interface Vlanif 30 
dhcp select global
q

ip pool vlan40
network 172.16.6.0 mask 23
gateway-list 172.16.7.254
dns-list 192.168.150.1
excluded-ip-address 172.16.6.1 172.16.6.254
q

interface Vlanif 40
dhcp select global
q

ip pool vlan50
network 172.16.8.0 mask 23
gateway-list 172.16.9.254
dns-list 192.168.150.1
excluded-ip-address 172.16.8.1 172.16.8.254
q

interface Vlanif 50
dhcp select global
q

ip pool vlan60
network 172.16.10.0 mask 23
gateway-list 172.16.11.254
dns-list 192.168.150.1
excluded-ip-address 172.16.10.1 172.16.10.254
q

interface Vlanif 60
dhcp select global
q



interface Vlanif 200
ip address 172.200.1.252 23
vrrp vrid 20 virtual-ip 172.200.1.254
vrrp vrid 20 priority 100

interface Vlanif 210
ip address 172.210.3.252 23
vrrp vrid 20 virtual-ip 172.210.3.254
vrrp vrid 20 priority 100

interface Vlanif 220
ip address 172.220.5.252 23
vrrp vrid 20 virtual-ip 172.220.5.254
vrrp vrid 20 priority 100

interface Vlanif 230
ip address 172.230.7.252 23
vrrp vrid 20 virtual-ip 172.230.7.254
vrrp vrid 20 priority 120

interface Vlanif 240
ip address 172.240.9.252 23
vrrp vrid 20 virtual-ip 172.240.9.254
vrrp vrid 20 priority 120

interface Vlanif 250
ip address 172.250.11.252 23
vrrp vrid 20 virtual-ip 172.250.11.254
vrrp vrid 20 priority 120

interface Vlanif 100
ip address 192.168.100.252 24
vrrp vrid 20 virtual-ip 192.168.100.254
vrrp vrid 20 priority 100



  vlan 80
  inter vlan 80
  ip address 10.1.80.1 30


  inter gi0/0/5
  p l ac
  p de vlan 80


inter loop 0
ip address 3.3.3.3 32

router id 3.3.3.3
ospf 1
silent-interface Vlanif 10
silent-interface Vlanif 20
silent-interface Vlanif 30
silent-interface Vlanif 40
silent-interface Vlanif 50
silent-interface Vlanif 60
silent-interface Vlanif 200
silent-interface Vlanif 210
silent-interface Vlanif 220
silent-interface Vlanif 230
silent-interface Vlanif 240
silent-interface Vlanif 250
silent-interface Vlanif 100
area 0
network 10.1.80.0 0.0.0.3
network 172.16.0.0 255.255.254.0
network 172.16.2.0 255.255.254.0
network 172.16.4.0 255.255.254.0
network 172.16.6.0 255.255.254.0
network 172.16.8.0 255.255.254.0
network 172.16.10.0 255.255.254.0
network 172.200.0.0 255.255.254.0
network 172.210.2.0 255.255.254.0
network 172.220.4.0 255.255.254.0
network 172.230.6.0 255.255.254.0
network 172.240.8.0 255.255.254.0
network 172.250.10.0 255.255.254.0
network 192.168.100.0 255.255.255.0
network 3.3.3.3 0.0.0.0 
q

四、sum-sw1

复制代码
sys
sysname sum-sw1

vlan batch 10 20 30 40 50 60 100 
vlan batch 200 210 220 230 240 250 

port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/9
port link-type trunk
port trunk allow-pass vlan all
q

stp region-configuration 
region-name huawei
revision-level 1
instance 1 vlan 10 20 30
instance 2 vlan 40 50 60
instance 3 vlan 200 210 220
instance 4 vlan 230 240 250
instance 5 vlan 100
active region-configuration
q

五、sum-sw2

复制代码
sys
sysname sum-sw2

vlan batch 10 20 30 40 50 60 100 
vlan batch 200 210 220 230 240 250 
port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/9
port link-type trunk
port trunk allow-pass vlan all
q


stp region-configuration 
region-name huawei
revision-level 1
instance 1 vlan 10 20 30
instance 2 vlan 40 50 60
instance 3 vlan 200 210 220
instance 4 vlan 230 240 250
instance 5 vlan 100
active region-configuration
q

六、sw1-6

复制代码
system-view
sysname SW1
vlan batch 10 100 200

  inter gi0/0/1
  port link-type trunk
  port trunk allow-pass vlan 10 100 200
  quit

  inter gi0/0/2
  port link-type trunk
  port trunk allow-pass vlan 10 100 200
  quit

  inter gi0/0/3
  port link-type access
  port default vlan 10
  quit

  inter gi0/0/4

system-view
sysname SW2
vlan batch 20 100 210

  inter gi0/0/1
  port link-type trunk
  port trunk allow-pass vlan 20 100 210
  quit

  inter gi0/0/2
  port link-type trunk
  port trunk allow-pass vlan 20 100 210
  quit

  inter gi0/0/3
  port link-type access
  port default vlan 20
  quit

system-view
sysname SW3
vlan batch 30 100 220

  inter gi0/0/1
  port link-type trunk
  port trunk allow-pass vlan 30 100 220
  quit

  inter gi0/0/2
  port link-type trunk
  port trunk allow-pass vlan 30 100 220
  quit

  inter gi0/0/3
  port link-type access
  port default vlan 30
  quit

system-view
sysname SW4
vlan batch 40 100 230

  inter gi0/0/1
  port link-type trunk
  port trunk allow-pass vlan 40 100 230
  quit

  inter gi0/0/2
  port link-type trunk
  port trunk allow-pass vlan 40 100 230
  quit

  inter gi0/0/3
  port link-type access
  port default vlan 40
  quit

system-view
sysname SW5
vlan batch 50 100 240

  inter gi0/0/1
  port link-type trunk
  port trunk allow-pass vlan 50 100 240
  quit

  inter gi0/0/2
  port link-type trunk
  port trunk allow-pass vlan 50 100 240
  quit

  inter gi0/0/3
  port link-type access
  port default vlan 50
  quit

system-view
sysname SW6
vlan batch 60 100 250

  inter gi0/0/1
  port link-type trunk
  port trunk allow-pass vlan 60 100 250
  quit

  inter gi0/0/2
  port link-type trunk
  port trunk allow-pass vlan 60 100 250
  quit

  inter gi0/0/3
  port link-type access
  port default vlan 60
  quit

六、FW1

复制代码
admin
Huawei@123
Admin@123
sys
sysname FW1


firewall zone untrust
 add interface GigabitEthernet1/0/4


firewall zone trust
 add interface GigabitEthernet0/0/0
 add interface GigabitEthernet1/0/0
 add interface GigabitEthernet1/0/1
 add interface GigabitEthernet1/0/3


firewall zone dmz
 add interface GigabitEthernet1/0/2


inter gi1/0/0
ip address 10.1.70.2 30

  inter gi1/0/1
  ip address 10.1.80.2 30

inter loop 0
ip address  1.1.1.1 32

router id 1.1.1.1
ospf 1
default-route-advertise always
area 0	
network 10.1.70.0 0.0.0.3
network 10.1.80.0 0.0.0.3

七、DMZ-SW1

复制代码
sys
sysname DMZ-SW1
vlan batch 150 160 170

interface Vlanif150
 ip address 192.168.150.254 255.255.255.0

interface Vlanif160
 ip address 192.168.160.254 255.255.255.0

interface Vlanif170
 ip address 192.168.170.254 255.255.255.0

inter gi0/0/2
p l a
p d v 150

inter gi0/0/3
p l a
p d v 160

inter gi0/0/4
p l a
p d v 170

vlan 90
inter vlan 90
 ip address 10.1.90.1 30
inter gi0/0/1
p l a
p d v 90
q


int LoopBack 0
ip add 4.4.4.4 32

router id 4.4.4.4
ospf 1
 area 0.0.0.1
  network 192.168.150.0 0.0.0.255
  network 192.168.160.0 0.0.0.255
  network 192.168.170.0 0.0.0.255
  network 10.1.90.0 0.0.0.3
  network 4.4.4.4 0.0.0.0
quit

结语


具体操作访问

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

相关推荐
集成显卡1 小时前
PlayWright | 初识微软出品的 WEB 应用自动化测试框架
前端·chrome·测试工具·microsoft·自动化·edge浏览器
搬码临时工2 小时前
电脑同时连接内网和外网的方法,附外网连接局域网的操作设置
运维·服务器·网络
藥瓿亭2 小时前
K8S认证|CKS题库+答案| 3. 默认网络策略
运维·ubuntu·docker·云原生·容器·kubernetes·cks
Gaoithe2 小时前
ubuntu 端口复用
linux·运维·ubuntu
b***25113 小时前
动力电池点焊机:驱动电池焊接高效与可靠的核心力量|比斯特自动化
人工智能·科技·自动化
沉到海底去吧Go3 小时前
【行驶证识别成表格】批量OCR行驶证识别与Excel自动化处理系统,行驶证扫描件和照片图片识别后保存为Excel表格,基于QT和华为ocr识别的实现教程
自动化·ocr·excel·行驶证识别·行驶证识别表格·批量行驶证读取表格
gsls2008084 小时前
ocrapi服务docker镜像使用
运维·docker·容器
文牧之4 小时前
PostgreSQL 的扩展pg_freespacemap
运维·数据库·postgresql
AWS官方合作商5 小时前
基于AWS Serverless架构:零运维构建自动化SEO内容生成系统
运维·serverless·aws
Iamccc13_5 小时前
智能仓储的未来:自动化、AI与数据分析如何重塑物流中心
人工智能·数据分析·自动化