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

结语


具体操作访问

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/411939.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

基于雷达影像的洪水监测技术方法详解

洪水发生时候大多数是阴雨天气,光学影像基本上拍不到有效影像。雷达影像这时候就能发挥其不受天气影像的优点。现在星载的雷达卫星非常多,如高分三号、陆探一号、海丝一号(巢湖一号)、哨兵1号等。本文以哨兵1号L1地距(GRD)产品来介…

机器学习YOLO操作全流程​​编

YOLO介绍 Ultralytics YOLOv8,是最新的著名实时目标检测和图像分割模型。它基于深度学习和计算机视觉的最新进展,提供了无与伦比的速度和精度性能。由于其精简的设计,适用于各种应用,并且可以轻松适配不同的硬件平台,从边缘设备到云端API。 探索 YOLOv8 文档,这是一个全…

pytorch -- CIFAR10 完整的模型训练套路

网络结构 代码 # CIFAR 10完整的模型训练套路: import torch.optim import torchvision from torch import nn from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriterfrom model import *# 1. 准备数据集 train_data torch…

TensorFlow2.x 精选笔记(2)自动求导与概率

学习参考: 动手学深度学习2.0Deep-Learning-with-TensorFlow-bookpytorchlightning ①如有冒犯、请联系侵删。 ②已写完的笔记文章会不定时一直修订修改(删、改、增),以达到集多方教程的精华于一文的目的。 ③非常推荐上面(学习参考&#x…

Premiere企业发展历程公司历史回顾视频制作pr时间线模板

企业发展历程公司历史回顾视频制作PR时间线模板mogrt。 项目特点:色彩控件,适用于任何字体,包含视频帮助,适用于Premiere Pro 2021及以上版本。 更多PR资源下载:https://prmuban.com/37916.html

手机和windows的便签怎么共享账号使用

在忙碌的生活中,我经常需要在手机和电脑之间同步记事信息。可是,每次当我在手机上记下一些重要事项后,想要在电脑上查看或继续编辑时,总是遇到各种麻烦。因为手机和电脑上的便签软件各不相同,无法实现账号共享和内容同…

用 React 实现搜索 GitHub 用户功能

用 React 实现搜索 GitHub 用户功能 在本篇博客中,我们将介绍如何在 React 应用中搜索 GitHub 用户并显示他们的信息。 创建 React 应用 首先,我们使用 Create React App 创建一个新的 React 应用。Create React App 是一个快速搭建 React 项目的工具…

好用的IP反查接口

IP-API.com - Geolocation API - Documentation - JSON 自定义返回参数调用(1): http://ip-api.com/json/24.48.0.1?fieldsstatus,message,country,countryCode,region,regionName,cityhttp://ip-api.com/json/24.48.0.1?fieldscountry,co…

用C#开发Excel插件的强大开源工具

推荐一个开源项目,方便我们使用C#为Excel开发插件。 01 项目简介 Excel-DNA是一个.Net开源项目,为开发者提供了一种便利的方法,可以将.Net代码与Excel集成,能够轻松的为Excel创建自定义函数、图表、表单等,一方面不仅…

IT廉连看——Uniapp——页面样式与布局

IT廉连看——Uniapp——页面样式与布局 目标: 了解样式与布局的规范 熟记px和rpx的区别 全局样式与index样式的区别 一、查看uniapp框架简介——尺寸单位 px尺寸单位的使用是贯穿始终的。 [IT廉连看] 二、尺寸单位——实操效果 1、打开Hbuilder X并进入in…

组态王连接施耐德M580PLC

组态王连接施耐德M580 网络架构 网线连接PLC和装组态王软件的PC组态设置帮助 可先查看帮助:菜单栏点击【帮助】->【驱动帮助】,在弹出窗口中PLC系列选择莫迪康PLC的“modbusRtu\ASSCII\TCP”查看组态配置流程: 相关说明: 1、…

Springboot中如何记录好日志

Springboot中如何记录日志 日志体系整体介绍 日志一直在系统中占据这十分重要的地位,他是我们在系统发生故障时用来排查问题的利器,也是我们做操作审计的重要依据。那么如何记录好日志呢?选择什么框架来记录日志,是不是日志打越…

uni-app原生api的promise化以解决异步等待问题分析

相信各位在进行uni-app开发的时候会遇到各种关于异步回调问题,例如要传code给后端以换取session_key,在这之前需要先调用 uni.login,所以执行的顺序是必须同步等待的。在写这篇文章之前对于整体的流程概念需要做一个梳理,以便能更…

SpringCloud-Docker安装与详解

Docker 是一款强大的容器化平台,通过其轻量级的容器技术,使应用程序的开发、部署和管理变得更加便捷和高效。本文将深入探讨 Docker 的安装过程,并详细解析其基本概念、组件及常用命令,以帮助读者充分理解和熟练使用 Docker。企业…

【kubernetes】关于k8s集群中kubectl的陈述式资源管理

目录 一、k8s集群资源管理方式分类: (1)陈述式资源管理方式:增删查比较方便,但是改非常不方便 (2)声明式资源管理方式:yaml文件管理 二、陈述式资源管理方法: 三、ku…

linux查看服务器内核CUP版本相关命令

服务器参考 计算架构:x86-64产品系列:华为云耀云服务器操作系列:CentOS 7 执行uname -a查看服务器内核版本 Linux hecs-82210 3.10.0-1160.92.1.el7.x86_64 #1 SMP Tue Jun 20 11:48:01 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux执行hostn…

【Flink CDC(一)】实现mysql整表与增量读取

文章目录 一. 运行前准备1. 依赖1.1. Maven dependency1.2. SQL Client JAR(推荐) 2. 配置 MySQL 服务器(必须) 二. 功能说明1. 启动模式2. 全量阶段支持 checkpoint3. 关于无主键表Exactly-Once 处理 三. 实战1. 实现mysql整表与…

交叉编译qt到arm平台

使用pkg-config命令查看xxx包是否存在: pkg-config --print-errors xxx pkg-config的搜索路径可以通过环境变量PKG_CONFIG_PATH指定。需要在运行./configure 之前指定。 ./configure -release -qt-libjpeg -qt-libpng -qt-zlib -qt-pcre -xplatform linux-aarch64-…

一文读懂 Python 值传递和引用传递

文章目录 版本前言形参和实参值传递和引用传递Python 变量存储值语义和引用语义值语义引用语义 探讨 Python 值传递和引用传递不可变(immutable)类型可变(mutable)类型案例一案例二 拓展:不可变类型真的不可变&#xf…

华为---RSTP(三)---P/A机制及RSTP的生成树形成过程

目录 1. P/A机制简介 1.1 P/A机制的作用 1.2 P/A协商的前提条件 1.3 RSTP选举思路 2. P/A协商过程 3. 举例说明RSTP的生成树形成过程 3.1 示例环境要求 3.2 RSTP的生成树形成过程 3.2.1 SW和SW1之间链路上抓包分析 3.2.2 SW和SW2之间链路上抓包分析 3.2.3 SW1和SW2之…