H3C交换机常用巡检命令

system-view #进入系统视图
user-interface vty 0 4 #vty就是用telnet/ssh远程进入交换机的界面(虚拟界面)
screen-length 0 #指定要在屏幕上显示行数,0默认是没有分页(全部显示)

硬件状态、IOS版本信息检查

display clock  #系统时间
display version #查看版本信息,最近一次重新启动的时间
display enviroment #设备温度
display device #单板运行状态
display device manuinfor #查看设备序列号
display power #查看电源状况
display fan  #查看风扇状况
display cpu-usage  #查看cpu最近5S、1m、5m占用率
display cpu history #查看cpu使用记录
display cpu-usage task #查看CPU利用率
display memory  #查看内存大小和占用率
display logbuffer #日志缓冲区
dir flash: #查看flash
dis boot-loader #显示软件映像文件
display arp #查看arp表(目的IP与目的MAC的映射关系)
display mac-address #查看mac地址表(二层转发通过mac地址表)
display ntp status #ntp状态信息
reset counters interface #清除接口统计信息,方便下次巡检查看接口错误包是否增加
display elabel #路由器设备命令—查看电子标签信息(华为)改用display device manuinfo
display ndp #路由器设备命令—华三V5版本支持,现在改用display lldp neighbor-information
display diagnostic-information #故障信息收集

系统运行配置状态检查

display interface #接口流量、链路状态
dis current-configuration inter #地址分配
dis current-configuration |include ospf #路由扩散
display ip routing-table #路由信息
display ip interface #显示 vlan 端口统计数据
display saved-configuration #保存配置文件
display logbuffer #日志信息
display port trunk #查看参与 trunk 的端口

STP 信息检查

display stp root #查看 stp 根情况
display stp brief #查看 stp 简单信息
display stp abnormal-port #查看是否有非正常端口
display stp region-configuration #生成树区域配置
display lldp neighbor-information #查看链路层邻居发现协议(邻居信息)
display tcp status #路由器设备命令—tcp统计数据
display tcp statistics #交换机设备命令—tcp统计数据

vrrp 和端口聚合检查

display vrrp #查看虚拟路由冗余协议
display vrrp statistics #查看主备用状态
display link-aggregation summary #查看链路聚合组的情况

H3C交换机的基本配置

基本配置

<H3C> //用户直行模式提示符,用户视图
<H3C>system-view //**进入系统视图**
[H3C] sysname xxx //设置主机名成为xxx这里使用修改特权用户密码

用户配置

<H3C>system-view
[H3C]super password H3C //设置用户分级密码
[H3C]undo superpassword //删除用户分级密码
[H3C]localuser bigheap 1234561 //Web网管用户设置,1为管理级用户
[H3C]undo localuser bigheap //删除Web网管用户
[H3C]user-interface aux 0 //只支持0
[H3C-Aux]idle-timeout 250 //设置超时为2分50秒,若为0则表示不超时,默认为5分钟
[H3C-Aux]undoidle-timeout //恢复默认值
[H3C]user-interface vty 0 //只支持0和1
[H3C-vty]idle-timeout 250 //设置超时为2分50秒,若为0则表示不超时,默认为5分钟
[H3C-vty]undoidle-timeout //恢复默认值
[H3C-vty]set authentication password123456 //设置telnet密码,必须设置
[H3C-vty]undo set authentication password //取消密码
[H3C]displayusers //显示用户
[H3C]displayuser-interface //用户界面状态

vlan配置

[H3C]vlan 2 //创建VLAN2
[H3C]undo vlan all //删除除缺省VLAN外的所有VLAN,缺省VLAN不能被删除
[H3C-vlan2]port Ethernet 0/4 to Ethernet0/7 //将4到7号端口加入到VLAN2中,此命令只能用来加access端口,不能用来增加trunk或者hybrid端口
[H3C-vlan2]port-isolate enable //打开VLAN内端口隔离特性,不能二层转发,**默认不启用该功能**
[H3C-Ethernet0/4]port-isolate uplink-portvlan 2 //设置4为VLAN2的**隔离上行端口**,用于转发二层数据,只能配置一个上行端口,若为trunk,则建议允许所有VLAN通过,隔离不能与汇聚同时配置
[H3C]display vlan all //**显示所有VLAN的详细信息**
[H3C]user-group 20 //创建user-group 20,默认只存在user-group 1
[H3C-UserGroup20]port Ethernet 0/4 toEthernet 0/7 //**将4到7号端口加入到VLAN20中,**初始时都属于user-group 1中
[H3C]display user-group 20 //显示user-group 20的相关信息

交换机IP配置

[H3C]vlan 20 //**创建vlan**
[H3C]management-vlan 20 //管理vlan
[H3C]interface vlan-interface 20 //**进入并管理vlan20**
[H3C]undo interface vlan-interface 20 //删除管理VLAN端口
[H3C-Vlan-interface20]ip address192.168.1.2 255.255.255.0 //**配置管理VLAN接口静态IP地址**
[H3C-Vlan-interface20]undo ipaddress //删除IP地址
[H3C-Vlan-interface20]ip gateway 192.168.1.1 //指定缺省网关(默认无网关地址)
[H3C-Vlan-interface20]undo ip gateway
[H3C-Vlan-interface20]shutdown //**关闭接口**
[H3C-Vlan-interface20]undo shutdown //开启
[H3C]display ip //显示管理VLAN接口IP的相关信息
[H3C]display interface vlan-interface20 //查看管理VLAN的接口信息
<H3C>debugging ip //开启IP调试功能
<H3C>undo debugging ip

DHCP客户端配置

[H3C-Vlan-interface20]ip address dhcp-alloc // 管理VLAN接口**通过DHCP方式获取IP地址**
[H3C-Vlan-interface20]undo ip address dhcp-alloc // 取消
[H3C]display dhcp //显示DHCP客户信息
<H3C>debugging dhcp-alloc //开启DHCP调试功能
<H3C>undo debugging dhcp-alloc

端口配置

[H3C]interface Ethernet0/3 //进入端口
[H3C-Ethernet0/3]shutdown //关闭端口
[H3C-Ethernet0/3]speed 100 //速率可为10,100,1000和auto(缺省)
[H3C-Ethernet0/3]duplexfull //**双工,可**为half,full和auto,光口和汇聚后不能配置
[H3C-Ethernet0/3]flow-control //**开启流控,默认为关闭**
[H3C-Ethernet0/3]broadcast-suppression 20 //设置抑制广播百分比为20%,可取5,10,20,100,缺省为100,同时组播和未知单播也受此影响
[H3C-Ethernet0/3]loopback internal //内环测试
[H3C-Ethernet0/3]port link-type trunk //设置链路的**类型为trunk**
[H3C-Ethernet0/3]port trunk pvid vlan 20 //设置20为该trunk的缺省VLAN,默认为1(trunk线路两端的PVID必须一致)
[H3C-Ethernet0/3]port access vlan 20 //将当前**access端口加入指定的VLAN**
[H3C-Ethernet0/3]port trunk permit vlan all //允许**所有的VLAN通过当前的trunk端口,**可多次使用该命令
[H3C]link-aggregation Ethernet 0/1 to Ethernet 0/4 //**将1-4口加入汇聚组,**1为主端口,两端需要同时配置,设置了端口镜像以及端口隔离的端口无法汇聚
[H3C]undo link-aggregation Ethernet 0/1 //删除该汇聚组
[H3C]link-aggregation mode egress //配置端口汇聚模式为根据目的MAC地址进行负荷分担,可选为 ingress,egress和both,缺省为both
[H3C]monitor-port Ethernet 0/2 //**将该端口设置为镜像端口**,必须先设置镜像端口,删除时必须先删除被镜像端口,而且它们不能同在一个端口,该端口不能在汇聚组中,设置新镜像端口时,新取代旧,被镜像不变
[H3C]mirroring-port Ethernet 0/3 toEthernet 0/4 both //将**端口3和4设置为被镜像端口**,both为同时监控接收和发送的报文,inbound表示仅监控接收的报文,outbound表示仅监控发送的报文
[H3C]display mirror
[H3C]display interface Ethernet 0/3
<H3C>resetcounters //**清除所有端口的统计信息**

H3C路由器恢复密码

H3C的路由器需要先关闭电源,重新启动路由器,注意终端上显示 press CTRL+B to enter extended boot menu 的时候,请迅速按下ctrl+B,这样将进入扩展启动选项。

接着,你就可以进入路由器视图:

低端H3C设备

重启完成后即可直接进入系统视图。

中端H3C设备

中端H3C.jpg

重启完成后,即可直接进入系统视图[Router],此时再更或新增改类型为admin的exec密码,保存即可。