交换机学习全套

发布时间 2023-11-13 03:19:37作者: 梭梭666

Top

常用配置命令

华三——S5560 交换机常用命令学习

状态信息查看

# 查看设备CPU占用率的统计信息,以及各个进程的cpu占用率
dis cpu-usage summary
# 查看交换机内存使用情况 
dis memory summary
# 查看交换机风扇使用情况
dis fan 
# 查看交换机型号信息
dis device verbose
dis device slot 1
# 查看交换机完整配置信息
display current-configuration  # 简写为: dis  cur  
# 查询端口下配置信息
dis cur interface GigabitEthernet 1/0/10
# 查看交换机路由表(Ctrl + l )
display ip routing-table
# 显示静态路由表信息 
display route-static routing-table
# 查看交换机 Mac 地址表
display mac-address
# 查看交换机 ARP 表
dis arp all
# 查询用户信息 
dis local-user
dis local-user service-type   ssh
# 显示所有连接用户
dis tcp
# 交换机命名配置
sysname <name>
点我回顶部

配置欢迎消息

# 可多行配置
# 配置 motd 消息
header motd ################ SUOSUO 25G Switch Welcome You !  ################
# 配置 shell 欢迎消息
header shell **************** SUOSUO 25G Switch Welcome You ! ****************
# 配置 login 消息
header login SUOSUO 25G Switch Welcome You !
# 配置 incoming 消息,  
# 配置 legal 消息

配置通过Web登录设备

为了方便用户对网络设备进行配置和维护,设备提供Web功能。用户可以通过PC登录到设备上,使用Web界面直观地配置和维护设备。设备支持两种Web登录方式
1. HTTP 
2. HTTPS 

# 显示Web用户的相关信息
display web users
# 显示HTTP的状态信息
display ip http
# 强制在线Web用户下线
free web users { all | user-id user-id | user-name user-name }
# 配置开启 HTTP 服务
ip http enable

H3C -- 登录设备配置指导

交换机生成树协议

# 在全局视图下: 
# 开启全局的stp  
stp global enable 
# 查看各个端口 stp  tc 报文统计信息 
display stp tc
# 查看 stp 拓补结构
dis stp brief
# 设置端口为边缘端口
stp edged-port 

H3C -- 二层技术-以太网交换 -- 生成树配置指导

检测网口自环

# 在全局视图下: 
# 全局开启环路检测功能
loopback-detection global enable vlan all
# 配置环路检测的间隔时间为 30 秒
loopback-detection interval-time 30
# 配置全局环路检测的处理模式为 shutdown 模式
loopback-detection global action shutdown
# 查看设备上环路检测的配置和运行情况
display loopback-detection
# 关闭环路检测功能
undo loopback-detection global enable  vlan all
点我回顶部

设置端口流量限制

当网络中的广播报文增多时,广播报文占用的网络资源将随之增多,进而严重影响了网络业务的正常运行。
为了防止广播风暴,可以使用broadcast-suppression命令配置基于接口的广播报文流量的阈值。当广播报文流量超过配置的阈值时,系统将丢弃多余的广播报文,使广播报文流量降低到合理的范围内
# 在端口视图下: 
# 限制广播包
broadcast-suppression 30
broadcast-suppression pps 30
# 限制组播报
multicast-suppression 30
multicast-suppression pps 30
# 限制未知单播风暴抑制功能
unicast-suppression 30
unicast-suppression pps 30
# 取消接口下的广播报文流量限制
undo broadcast-suppression
# 取消接口下的组播报文流量限制
undo multicast-suppression

服务:DHCP

# 查看DHCP配置情况
display dhcp server statistics
# 查看地址池已分配的地址
display dhcp server ip-in-use
# 查看地址池剩余没有分配的地址
display dhcp server free-ip
# 查看地址池中已经过期的地址
display dhcp server expried
# 查看交换机下地址池的配置
display dhcp server pool
# 开启DHCP服务
dhcp enable
# 创建DHCP地址池,并进入DHCP地址池视图
dhcp server ip-pool <pool-name>
# 查看DHCP服务器为客户端分配的IP地址
display dhcp server ip-in-use

# 完整配置 DHCP 服务--地址池设置
# 创建DHCP地址池,并进入DHCP地址池视图
dhcp server ip-pool 172.16.0 
# 配置DHCP地址池动态分配的主网段
network 172.16.0.0 17
# 配置地址池动态分配的IP地址范围,即公共地址范围 
address range 172.16.100.1 172.16.120.254
# 配置动态分配的IP地址的租约有效期限
expired day 3 hour 12 minute 30 second 30
# 配置DHCP客户端使用的域名后缀
domain-name suosuo
# 配置DHCP客户端使用的网关地址
gateway-list 172.16.7.77
# 配置DHCP客户端使用的DNS服务器地址
dns-list 14.14.14.14
# 配置DHCP客户端使用的TFTP服务器地址, 这里为 PXE 服务器地址
tftp-server ip-address 172.16.1.10
# 退回系统视图
quit
# 保存配置
save
############################ 其他-----------------
# 屏蔽 IP  
forbidden-ip  xx.xx.xx.xx
# 配置 TFTP 服务器地址 
next-server 172.16.1.10
# 配置选项值
option 66 ip-address 172.16.1.10
option 67 ascii snponly.efi
# Mac 地址绑定
static-bind ip-address 172.16.17.17 mask 255.255.128.0 hardware-address 6805-cabd-9b8e
# tftp 设置 
tftp-server domain-name pxe
tftp-server ip-address 172.16.1.10

H3C -- 三层技术-IP业务配置指导 --- DHCP 配置

点我回顶部

设置时钟

# 在用户视图下, 设置时间
clock datetime 16:25:00 04/12/2022  # 时:分:秒  月/日/年
# 有两种时钟获取方式
1.开取NTP ,由网络时钟服务器获取时间    clock protocol ntp mdc mdc-id
2.不置时钟服务器,               clock protocol none
# 在系统视图下: 设置不使用时钟服务器, 关闭protocol ,缺省情况下,默认开启,由缺省MDC获取系统时间
clock protocol none
# 在系统视图下: 设置时区 北京 在UTC偏移8小时
clock timezone BJ add 08:00:00
# 在接口视图下: 设置时间
clock datetime 20:15:00 2022/03/26

配置VTY终端

line vty 0 20
 authentication-mode none  # 表示无认证模式 
 user-role network-admin   # admin 权限可保存配置,否则无法保存 
 user-role network-ads
 user-role network-operator
 idle-timeout 1441 0      # 连接空闲超时的时间【分钟, 秒】, 若配置为:[0 0 ], 则表示不关闭,永久保持连接 
 screen-length 0          # 表示无需敲击 空格键,  即可显示所有命令内容 
#
line vty 21 40
 authentication-mode scheme  # 表示用户认证
 user-role network-admin   
 user-role network-ads
 user-role network-operator
 idle-timeout 1441 0
 screen-length 0
 authentication-mode password  # 表示直接密码认证 

配置DHCP 地址池

dhcp server ip-pool 172.17.0
gateway-list 172.17.7.77 172.16.7.77
network 172.17.0.0 mask 255.255.128.0
address range 172.17.10.1 172.17.90.254
dns-list 14.14.14.14
domain-name suosuo
expired day 3
forbidden-ip 172.17.1.10
forbidden-ip 172.17.7.77
forbidden-ip 172.17.17.18
next-server 172.17.1.10
option 66 ip-address 172.16.1.10
option 67 ascii snponly.efi
static-bind ip-address 172.16.17.17 mask 255.255.128.0 hardware-address 6805-cabd-9b8e
tftp-server domain-name pxe
tftp-server ip-address 172.16.1.10

设置配置文件

1. 首先配置交换机 FTP
2. 登入 FTP 
3. 将自定义的配置文件上传至交换机 flash 空间: put xxxx.cfg 
4. 然后进入交换机配置界面,在用户视图下,使用如下命令设置该配置文件为交换机配置文件
5. 敲击 reboot 命令重启, 紧接着会提示是否保存原有配置,输入 “N”,  然后再确认重启,输入 “Y”,  重启即可。 
点我回顶部

配置tty用户终端

 user-interface vty 15 63  #  进入 tty 区间终端 
 authentication-mode scheme
 user-role network-admin
 user-role network-ads
 user-role network-operator
 idle-timeout 1441 0
 screen-length 0

端口下配置

# 清除端口统计数据信息 
reset counters interface GigabitEthernet 1/0/12
# 查询端口详细数据
dis interface Twenty-FiveGigE 1/0/7
# 查询端口下配置
dis cur interface GigabitEthernet 1/0/10

Mac 地址表项

# 查看交换机 Mac 地址表
display mac-address
# 显示动态 Mac 地址表项
display mac-address dynamic
# 显示具体 Vlan 下的 Mac 地址表项
dis mac-address vlan 111
# 配置动态MAC地址表项的老化时间
mac-address timer aging 400 
# 显示 MAC地址表项的老化时间
dis mac-address aging-time
# 查看某一个端口下得学习到的 Mac 地址表
dis mac-address interface HGE1/0/27

# 显示所有端口的 MAC地址学习功能的使能状态, 
display mac-address mac-learning
# 显示具体端口的 MAC地址学习功能的使能状态, 
display mac-address mac-learning interface HundredGigE 1/0/25

# 关闭 全局 的MAC地址学习功能
undo mac-address mac-learning enable
# 关闭 接口 的MAC地址学习功能
undo mac-address mac-learning enable
# 关闭 Vlan 的MAC地址学习功能
undo mac-address mac-learning enable
# 添加一个动态MAC地址表项
mac-address dynamic 0000-1111-2222 interface HGE1/0/25 vlan 111
# 添加一个静态MAC地址表项
mac-address static 000f-e235-dc71 interface HGE1/0/25 vlan 111
# 撤销端口下的一个动态MAC地址表项
undo mac-address dynamic 0000-1111-2222 interface HundredGigE 1/0/25 vlan 111
# 增加一个黑洞MAC地址表项, 使该用户主机接收不到报文
mac-address blackhole 000f-e235-abcd vlan 1
# 查看黑洞MAC地址表信息。
display mac-address blackhole

# 配置接口的MAC地址数学习上限
mac-address max-mac-count 30
# 开启全局的MAC地址同步功能
mac-address mac-roaming enable
# 配置快速更新ARP表项
mac-address mac-move fast-update

# 查看某一个用户的所有操作命令历史记录
dis logbuffer  | include 172.16.17.18

MAC地址表配置

点我回顶部

Arp 表项

# 查看所有的ARP映射表项
dis arp all
# 查看动态 ARP 表, 自己学习的
dis arp dynamic
# 查看静态 ARP 表, 管理员配置的
dis arp static 
# 查看 arp表项老化时间
dis arp timer aging
# 设置 arp 表项老化时间,(单位:分钟)
arp timer aging  20

 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn1
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn2
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn3
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn4
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn5
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn6
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn7
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn8
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn9
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn10
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn11
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn12
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn13
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn14
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn15
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn16
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn17
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn18
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn19
 arp static 88.88.88.4 741f-4aa8-7448 vpn-instance vpn20


resource-monitor resource ac slot 1 cpu 0 by-percent minor-threshold 10 severe-threshold 5
 resource-monitor resource agg_group slot 1 cpu 0 by-percent minor-threshold 50 severe-threshold 20
 resource-monitor resource arp slot 1 cpu 0 by-percent minor-threshold 50 severe-threshold 20
 resource-monitor resource ecmpgroup slot 1 cpu 0 by-percent minor-threshold 50 severe-threshold 20
 resource-monitor resource g_rsvd_vlan slot 1 cpu 0 by-percent minor-threshold 10 severe-threshold 5
 resource-monitor resource ipv4l2mc slot 1 cpu 0 by-percent minor-threshold 50 severe-threshold 20
 resource-monitor resource ipv4l3mc slot 1 cpu 0 by-percent minor-threshold 50 severe-threshold 20
 resource-monitor resource ipv6_128 slot 1 cpu 0 by-percent minor-threshold 50 severe-threshold 20
 resource-monitor resource ipv6_64 slot 1 cpu 0 by-percent minor-threshold 50 severe-threshold 20
 resource-monitor resource ipv6l2mc slot 1 cpu 0 by-percent minor-threshold 50 severe-threshold 20
 resource-monitor resource ipv6l3mc slot 1 cpu 0 by-percent minor-threshold 50 severe-threshold 20
 resource-monitor resource mac slot 1 cpu 0 by-percent minor-threshold 10 severe-threshold 5
 resource-monitor resource mqcin slot 1 cpu 0 by-percent minor-threshold 30 severe-threshold 10
 resource-monitor resource mqcout slot 1 cpu 0 by-percent minor-threshold 30 severe-threshold 10
 resource-monitor resource nd slot 1 cpu 0 by-percent minor-threshold 50 severe-threshold 20
 resource-monitor resource nexthoppool1 slot 1 cpu 0 by-percent minor-threshold 50 severe-threshold 20
 resource-monitor resource openflow slot 1 cpu 0 by-percent minor-threshold 30 severe-threshold 10
 resource-monitor resource pbr slot 1 cpu 0 by-percent minor-threshold 30 severe-threshold 10
 resource-monitor resource pfilterin slot 1 cpu 0 by-percent minor-threshold 30 severe-threshold 10
 resource-monitor resource pfilterout slot 1 cpu 0 by-percent minor-threshold 30 severe-threshold 10
 resource-monitor resource route slot 1 cpu 0 by-percent minor-threshold 50 severe-threshold 20
 resource-monitor resource rport slot 1 cpu 0 by-percent minor-threshold 50 severe-threshold 20
 resource-monitor resource subrport slot 1 cpu 0 by-percent minor-threshold 50 severe-threshold 20
 resource-monitor resource vlan slot 1 cpu 0 by-percent minor-threshold 10 severe-threshold 5
 resource-monitor resource vlaninterface slot 1 cpu 0 by-percent minor-threshold 50 severe-threshold 20
 resource-monitor resource vsi slot 1 cpu 0 by-percent minor-threshold 10 severe-threshold 5
 resource-monitor resource vsiintf slot 1 cpu 0 by-percent minor-threshold 10 severe-threshold 5

查看光模块信息

# 查看 PN 号  和  SN 号 , 厂商 
# 输入probe进入交换机拓展模式
[SW_B_4_25_H3C]probe
[SW_B_4_25_H3C-probe]dis transceiver information interface WGE1/0/47
Twenty-FiveGigE1/0/47 transceiver information:
  Transceiver Type              : 10G_BASE_LR_SFP
  Connector Type                : LC
  Wavelength(nm)                : 1310
  Transfer Distance(km)         : 10(SMF)
  Digital Diagnostic Monitoring : YES
  Vendor Name                   : H3C
  Ordering Name                 : SFP-XG-LX-SM1310-E
  Max. TX Power(dBm)            : 0.5
  Min. TX Power(dBm)            : -8.2
  Min. RX Power(dBm)            : -10.3
  Max. RX Power(dBm)            : 0.5
  Original Manufacturer         : INNOLIGHT
  Part Number                   : TR-PX13L-N00-H3C
  Rev Number                    : 1B
  Serial Number                 : INEAD0180864
  Product Date                  : 14-02-11


# 查看 模块的当前故障告警信息 
display transceiver alarm interface ten-gigabitethernet 1/0/1
# 查看 光模块的数字诊断参数的当前测量值
display transceiver diagnosis interface ten-gigabitethernet 1/0/1
# 查看 接口模块的主要特征参数
[SW_B_4_25_H3C]display transceiver interface WGE1/0/1
Twenty-FiveGigE1/0/1 transceiver information:
  Transceiver Type              : 10G_BASE_SR_SFP
  Connector Type                : LC
  Wavelength(nm)                : 850
  Transfer Distance(m)          : 80(OM2),20(OM1),300(OM3)
  Digital Diagnostic Monitoring : YES
  Vendor Name                   : H3C
  Ordering Name                 : SFP-XG-SX-MM850-E
# 查看 模块的电子标签信息
[SW_B_4_25_H3C-probe]display transceiver manuinfo interface WGE1/0/1
Twenty-FiveGigE1/0/1 transceiver manufacture information:
  Manu. Serial Number : 210231A2L4X181002759
  Manufacturing Date  : 2018-01-12
  Vendor Name         : H3C
点我回顶部

账户配置

local-user ftp class manage
 password hash $h$6$oQw5pa3RLwIC/LV+$aYs4uyFURRPCbhEm4dcssULxRjUvZOxZ+SNLXaRhuQn0riUueaoa5pFyj2xiMrMnHFV2EE8Pp2UXfTY3SS7uDA==
 # 创建账户,不存在则自动创建
 local-user <qiangqiang>                           
 # 配置账户验证服务类型
 service-type [ftp | ssh | telnet]
 # 账户权限等级
 authorization-attribute user-role network-admin
 authorization-attribute user-role network-operator
 # 用户密码相关配置
 password-control aging 365
 password-control length 7
 password-control composition type-number 2 type-length 1
 password-control complexity same-character check
 password simple  123456  # 设置密码
# 删除账户
undo local-user ll class manage                            
save                     # 保存配置
# 显示系统账户信息
display local-user  

H3C --- 安全配置指导

协议服务配置

Telnet -- 配置

# 开启 telnet 服务
telnet server enable
# 终端与角色配置
line vty 0 31
authentication-mode scheme
user-role network-admin
user-role network-operator
protocol inbound telnet
idle-timeout 20 0
# 密码与权限配置
local-user superuser_ydd class manage
password simple YDD@963
service-type telnet http https
authorization-attribute user-role network-admin
authorization-attribute user-role network-operator
password-control aging 365
password-control length 7
password-control composition type-number 2 type-length 1
password-control complexity same-character check
# 保存配置
save
y
------------------------------------------------------
# 或者直接配置密码登录, 则只需修改配置 vty 终端的验证方式为 password  
authentication-mode password
set authentication password simple YDD@963
protocol inbound telnet
点我回顶部

SSH -- 配置

# 开启 SSH 服务 
ssh server enable
ssh server authentication-retries 5
ssh server authentication-timeout 120
ssh server compatible-ssh1x enable
# 终端与角色配置
line vty 32 63
authentication-mode scheme
user-role network-admin
user-role network-operator
idle-timeout 30 0
# 密码与权限配置
local-user ssh class manage
 password simple ydd@123
 service-type ssh
 authorization-attribute user-role network-admin
 authorization-attribute user-role network-operator
 password-control aging 365
 password-control length 7
 password-control composition type-number 2 type-length 1
 password-control complexity same-character check
# 保存配置
save
y

FTP -- 配置

# 开启 FTP 服务
ftp server enable
ftp timeout 10
# 终端与角色配置
line vty 32 63
authentication-mode scheme
user-role network-admin
user-role network-operator
idle-timeout 30 0
# 密码与权限配置
local-user ftp class manage
password simple ydd@123
service-type ftp
authorization-attribute user-role network-admin
authorization-attribute user-role network-operator
password-control aging 365
password-control length 7
password-control composition type-number 2 type-length 1
password-control complexity same-character check
# 保存配置
save
y

H3C -- 基础配置配置指导 -- FTP

点我回顶部

Console 串口登录认证配置

# 进入 console 视图
user-interface console 0
# 配置认证模式, 密码认证 或 用户认证 或 无密码
authentication-mode [password|scheme|none]
# 配置密码 
set authentication password simple xxxxxx
# 配置用户角色
user-role <network-admin | network-operator | guest-manager | security-audit>
# 若认证模式为用户认证,则配置用户时使用该 服务类型 
service-type terminal

# 有的交换机可做如下配置:
line aux 0
	# 设置密码
	set authentication password simple xxxxxx
	# 取消密码 
	undo set authentication password

日志相关

# 清除当前 logbuffer日志  
	1.  进入用户视图 
	2.  执行:  reset logbuffer 
# 显示消息当前设置
dis info-center
# 在用户视图下
# 清除回收站中的文件,释放Flash空间
reset recycle-bin /force
# 清除当前 buffer 日志  
reset logbuffer
# 删除文件到回收站中
delete xxx 

点我回顶部

Vlan 划分

基于 Mac 地址的划分

# 显示MAC VLAN表项
display mac-vlan { all | dynamic | mac-address mac-address }
# 显示所有开启了MAC VLAN功能的接口  
display mac-vlan interface
# 配置 MAC地址与 VLAN 200 关联
mac-vlan mac-address 000d-88f8-4e71 vlan 200

基于端口的划分

基于 IP 子网的划分

# 配置子网192.168.5.0/24与 VLAN 100关联, 在 Vlan 100 视图下: 
ip-subnet-vlan ip 192.168.5.0 255.255.255.0    

基于协议的 Vlan 划分

# 查看所有协议VLAN的信息  
display protocol-vlan vlan all    
# 查看所有端口关联的协议VLAN的信息
display protocol-vlan interface all

H3C --- 二层技术-以太网交换配置指导 -- Vlan 配置

点我回顶部

交换机堆叠设置--IRF

 #1> 设置 域 ID  
 irf domain 1
 #2> 设置该成员交换机成员 ID, 设置完,需要重启 
 irf member 1 renumber
 #3> 设置该成员交换机优先级级别
 irf member 1 priority 32
 #4> 重启后,设置该成员交换机的 irf 互联口,即 irf 端口
 	#1. 先进入端口视图 
 	#2. 进入物理二层端口视图并关闭接口
 	#3. 创建 IRF 端口并进入
 		irf-port  <member-id>/<irf-port-number( 从1 开始)>
 	#4. 为 IRF 端口绑定物理端口,缺省情况下,IRF 端口未和任何物理端口绑定,可多次执行该命令,为 IRF端口绑定多个物理端口,从而实现 IRF 链路的备份和负载分担;
 		port group interface Ten-GigabitEthernet1/0/36 mode enhanced
	#5. 进入物理二层端口视图并打开接口
 	#6. 保存配置
 		save
 	#7. 激活 IRF 端口下的配置 
 		irf-port-configuration active 	
#5> 连接 IRF 物理端口: 在各个成员交换机之间需要交叉连接 
#6> 访问 IRF 设备:可通过任意成员交换机的Console 口或者其他方式(telnet , ssh, ftp ), 实际上访问的都是主设备;主设备是 IRF 系统的配置和控制中心,在主设备上配置后,主设备会将配置同步给从设备,以便保证主设备和从设备配置的一致性;

# 综上,在配置时, 可一台一台成员交换机来配置,都配置好后,可重启让其自动适配;
irf domain 1
irf mac-address persistent always
irf auto-update enable
undo irf link-delay
irf member 1 priority 32
irf member 2 priority 30
irf member 3 priority 20
irf member 4 priority 10

irf-port 1/1
port group interface Ten-GigabitEthernet1/0/35 mode enhanced
irf-port 1/2
port group interface Ten-GigabitEthernet1/0/36 mode enhanced
irf-port 2/1
port group interface Ten-GigabitEthernet2/0/35 mode enhanced
irf-port 2/2
port group interface Ten-GigabitEthernet2/0/36 mode enhanced
irf-port 3/1
port group interface Ten-GigabitEthernet3/0/35 mode enhanced
irf-port 3/2
port group interface Ten-GigabitEthernet3/0/36 mode enhanced
irf-port 4/1
port group interface Ten-GigabitEthernet4/0/35 mode enhanced
irf-port 4/2
port group interface Ten-GigabitEthernet4/0/36 mode enhanced

H3C --- 虚拟化技术配置指导

点我回顶部

端口镜像配置

# 显示所有镜像组的配置信息
dis mirroring-group  all

本地端口镜像配置

# 1. 显式创建本地目的镜像组
mirroring-group 2 local
# 2. 配置镜像CPU  
mirroring-group 2 mirroring-cpu slot 1 both
# 3. 配置镜像源端口
mirroring-group 2 mirroring-port inbound
# 4. 配置镜像目的端口
mirroring-group 2 monitor-port


http://www.h3c.com/cn/d_202112/1508693_30005_0.htm#_Toc90027248

二层远程端口镜像配置

# 配置镜像目的设备
1.  交换机互联口无需做配置
2.  需要显式创建远程目的镜像组
	mirroring-group 3 remote-destination
3.  配置镜像目的端口, 在接口视图下
	mirroring-group 3 monitor-port
	# 需关闭该端口生成树协议	
4.  需要显式配置远程镜像 Vlan  
	mirroring-group 3 remote-probe vlan 300
5.  显式将镜像目的端口添加入远程镜像 Vlan, --- 普通添加 Vlan 的方式,存在指定该 Vlan 可通行即可; 
	port link-type trunk
	port trunk permit vlan 300

# 中间设备配置,---- 报文广播通过
	暂无
	1. 需关闭该镜像 Vlan 的 Mac 地址学习功能,默认关闭
	2. 交换机互联口需配置镜像 Vlan 显式通过 
	

# 配置镜像源设备  -----  出端口方式
1.  需要显式创建远程源镜像组
	mirroring-group 3 remote-source
2.  需将交换机互联口设置为镜像出端口,可无需将该端口添加入镜像 Vlan --- 广播所复制的报文
	mirroring-group 3 monitor-egress
3.  配置镜像源端口,在接口视图下
	mirroring-group 3 mirroring-port inbound
4.  需要显式配置远程镜像 Vlan  
	mirroring-group 3 remote-probe vlan 300
	# 需关闭该 Vlan 的 Mac 地址学习功能,默认关闭
		undo mac-address mac-learning enable
5. 	配置源 CPU  
	mirroring-group 3 mirroring-cpu slot 1 both

点我回顶部

ARP 攻击防御配置

# 开启
arp source-suppression enable
# 设置阈值
arp source-suppression limit 10

策略路由配置

https://blog.csdn.net/weixin_51173317/article/details/123724529

环路检测常用命令

# 全局开启环路检测功能
loopback-detection global enable vlan 1
# 全局配置环路检测的处理模式 
loopback-detection global action shutdown
# 配置环路检测的时间间隔
loopback-detection interval-time 30
# 查看环路检测的配置和运行情况
display loopback-detection

Acl 与 Qos 配置

https://www.h3c.com/cn/d_201810/1117721_30005_0.htm

Qos技术--H3C白皮书

静态路由配置

http://www.h3c.com/cn/d_202112/1508682_30005_0.htmls
# 显示静态路由下一条详细信息 
dis route-static nib  verbose
# 显示静态路由表信息 
display route-static routing-table
# 配置静态路由
ip route-static 1.1.1.1 24 2.2.2.2
# 配置向静态路由下一跳发送 ARP 请求功能, 缺省为关闭状态
ip route-static arp-request

点我回顶部

配置保存与重置

# 同时删除除 vlan 1  以外的所有vlan   
undo vlan all 
# 批量创建所有vlan  
vlan all 

# 在用户视图下
# 重置交换机的配置 
reset saved-configuration
# 保存配置
save 
# 设备恢复到出厂状态
restore factory-default

IPV6

# 查看 IPV6 地址
dis ipv6 interface brief

# 链路本地地址 一定是 FE80 开头 , 其后的部分则是 根据 Mac 地址换算而来的。 

限速

qos lr outbound cir 40960  # 单位为: kbps ;  40960kbps = 40Mbps = 5MB/s
# QoS-基于IP网段限速配置
https://blog.csdn.net/u013573262/article/details/125794307
# 三层交换基于IP限速 
https://www.cnblogs.com/weijie0717/p/14830641.html
# 华为交换机常见QoS操作
https://blog.csdn.net/Tony_long7483/article/details/120978662
# QoS-服务质量(5)-流量监管、流量整形和接口限速
https://zhuanlan.zhihu.com/p/579225166

点我回顶部

其他

# 查看拥塞drop包(弃包/丢包)
dis packet-drop interface Twenty-FiveGigE 1/0/3
# 显示所有接口的WRED配置情况和统计信息
dis qos wred interface
# 显示 Qos trust设置, 优先级信任模式信息
dis qos trust  interface Twenty-FiveGigE 1/0/3
# 显示接口的PFC信息
dis priority-flow-control interface Twenty-FiveGigE 1/0/11

# 查看 console 信息 
dis user-interface console 0
# 查看 vty 终端信息 
dis user-interface vty  0
# 查看所有 用户接口 
dis user-interface

# 查看交换机下 IP 配置信息 
dis ip int brief
# 查看 Vlan 200 内 ARP 条目 
dis arp vlan  200
# 指定 源地址 发送 ICMP数据包 
ping -a 11.11.11.46  11.11.11.23

dis current-configuration  interface  Twenty-FiveGigE 1/0/1
dis cu int Vlan-interface 100
dis lldp  neighbor-information list

# 删除指定 IP 的 ARP 条目 
undo arp 22.22.22.46
# 查看指定 IP 的 ARP 条目 
dis arp 22.22.22.23



ip vpn-instance vpn1
 route-distinguisher 1:1
 vpn-target 1:1 import-extcommunity
 vpn-target 1:1 export-extcommunity
 
# 网络基础知识 
https://www.cnblogs.com/xig112635/p/15034259.html
# 单模光纤和多模光纤的区别 详解两者的优缺点 
https://www.cnblogs.com/xig112635/p/15102953.html
# 华为交换机上部署DHCP服务以及DHCP中继
https://www.cnblogs.com/xig112635/p/15078017.html
# MAC地址飘移
https://blog.csdn.net/weixin_33928137/article/details/85176534
# iptables 共享上网
https://www.cnblogs.com/xig112635/p/15075542.html

华为交换机 DHCPV6 配置

// 第 1 步、配置接口地址
[Huawei] ipv6
[Interface] ipv6 enable
[Interface] ipv6 address <prefix/length>

// 第 2 步、配置地址池
[Huawei] dhcp enable
[Huawei] dhcpv6 pool <pool-name>
[Pool] address prefix <prefix/length>
[Pool] dns-server 2008::8

// 第 3 步、开启 RA 发送
[Interface] undo ipv6 nd ra halt
[Interface] ipv6 nd autoconfig managed-address-flag   # 指示 Client 以 DHCPv6 获取网络地址
[Interface] ipv6 nd autoconfig other-flag             # 指示 Client 以 DHCPv6 获取其他参数

// 第 4 步、选择地址池
[Interface] dhcpv6 server <pool-name>

配置客户端获取地址

interface GigabitEthernet0/0/2
 ipv6 enable 
 ipv6 address auto link-local
 ipv6 address auto dhcp
 
[AR1]display ipv6 interface GigabitEthernet 0/0/2
GigabitEthernet0/0/2 current state : UP 
IPv6 protocol current state : UP
IPv6 is enabled, link-local address is FE80::2E0:FCFF:FEAC:2EC5
  Global unicast address(es):
    2001::3, subnet is 2001::3/128
  Joined group address(es):
    FF02::1:FF00:3
    FF02::2
    FF02::1
    FF02::1:FFAC:2EC5
  MTU is 1500 bytes
  ND DAD is enabled, number of DAD attempts: 1
  ND reachable time is 30000 milliseconds
  ND retransmit interval is 1000 milliseconds
  Hosts use stateless autoconfig for addresses
  
点我回顶部