1视图切换与基本操作
system-view进入系统视图(<H3C> → [H3C]),简写 sys
quit退出当前视图,简写 qu
return直接退回用户视图,快捷键 Ctrl+Z
save用户视图保存配置,重启不丢,简写 sa
reset saved-configuration用户视图清除保存的配置(恢复出厂配合 reboot)
reboot用户视图重启设备,简写 reb
sysname 名字修改设备名称(如 sysname SW1)
clock datetime 时:分:秒 年-月-日设置系统时间
screen-length disable关闭分屏(输出一次滚到底)
display this查看当前视图下的配置
?显示可用命令,命令后加空格 + ? 看参数
Tab自动补全命令
三个视图层次:用户视图 <H3C> → 系统视图 [H3C] → 接口/VLAN子视图。display 在所有视图都能用;save/reboot/reset 只在用户视图用。
2查看类命令(display 系列)
display version型号、软件版本、序列号、运行时间 最常用
display current-configuration当前运行的完整配置 简写 dis cu
display saved-configuration已保存的配置文件
display device硬件信息(槽位、单板状态)
display device manuinfo出厂信息(序列号、生产日期)
display interface brief所有接口简要(UP/DOWN、速率)
display interface E1/0/1指定接口的详细信息
display vlan briefVLAN 列表和接口归属
display vlan 10指定 VLAN 详情
display ip interface brief三层接口 IP 状态(SVI)
display ip routing-table路由表
display mac-addressMAC 地址表
display arpARP 表(IP 和 MAC 对应)
display cpu-usageCPU 占用率
display memory内存使用
display power电源模块状态
display fan风扇状态
display logbuffer系统日志(排查故障)
display alarm当前告警
display stp brief生成树状态
display clock系统当前时间
display local-user本地用户账号
display ssh server statusSSH 服务状态
3接口配置
interface E1/0/1进入接口视图,简写 int e1/0/1
undo shutdown开启接口
shutdown关闭接口
port link-mode bridge设为二层模式(出厂默认)
port link-mode route设为三层模式(物理口配IP)
port link-type access设为 access 模式(属一个VLAN)
port link-type trunk设为 trunk 模式(承载多VLAN)
port link-type hybrid设为 hybrid 模式
port access vlan 10access 接口划入 VLAN 10
port trunk permit vlan 10 20trunk 放行 VLAN 10 和 20
port trunk permit vlan alltrunk 放行所有 VLAN
port trunk pvid vlan 1设置 trunk 的 PVID
ip address 192.168.1.1 24给三层接口配 IP
undo ip address删除接口 IP
speed 100强制速率 100M
duplex full强制全双工
description 描述给接口加描述
4VLAN 配置
vlan 10创建 VLAN 10 并进入 VLAN 视图
vlan 10 to 20批量创建 VLAN 10-20
name 名字给 VLAN 命名
undo vlan 10删除 VLAN 10
interface Vlan-interface 10进入 VLAN 10 三层接口(SVI),简写 int vlan 10
ip address 192.168.10.1 24给 SVI 配网关 IP
undo interface Vlan-interface 10删除 SVI
SVI 状态规律:Vlan-interface 的 Physical 取决于该 VLAN 下有没有 UP 的 access 端口。端口全 DOWN → SVI 也 DOWN;有端口 UP → SVI 自动 UP。
5三层路由
ip routing开启三层 IP 路由转发
undo ip routing关闭三层路由
ip route-static 0.0.0.0 0 192.168.1.254配默认路由
ip route-static 10.0.0.0 24 192.168.1.2配静态路由
undo ip route-static ...删除静态路由
display ip routing-table查看完整路由表
display ip routing-table protocol direct只看直连路由
display ip routing-table protocol static只看静态路由
直连路由:给 SVI 或三层接口配了 IP 就自动生成直连路由,不用手动写。跨 VLAN 通信靠直连路由即可。
6远程管理(Telnet / SSH)
telnet server enable开启 Telnet 服务
ssh server enable开启 SSH 服务
local-user admin创建/进入本地用户 admin
password simple 密码设密码
service-type telnet允许 Telnet 登录
service-type ssh允许 SSH 登录
authorization-attribute level 3设权限级别(3=管理员)
user-interface vty 0 4进入 VTY 虚拟终端
authentication-mode schemeVTY 用本地用户认证
protocol inbound sshVTY 只允许 SSH 入站
undo local-user admin删除本地用户
前提:交换机必须有配了 IP 的三层接口(通常是 SVI),电脑能 ping 通这个 IP,才能远程登录。
7系统维护与排查
ping 192.168.1.1从交换机 ping 目标
ping -a 192.168.10.1 192.168.20.1指定源 IP ping
tracert 192.168.1.1追踪路径(排查路由跳数)
display diagnostic-information收集全套诊断信息
display cpu-usageCPU 使用率
display memory内存使用率
display environment温度信息
display transceiver diagnosis interface光模块诊断
tftp 服务器IP get 文件名从 TFTP 下载文件
tftp 服务器IP put 文件名上传文件到 TFTP
8常用简写对照
sys= system-view
qu= quit
dis= display
dis cu= display current-configuration
dis ver= display version
dis int br= display interface brief
dis vlan br= display vlan brief
dis ip int br= display ip interface brief
dis ip rt= display ip routing-table
dis mac= display mac-address
int e1/0/1= interface Ethernet1/0/1
int vlan 10= interface Vlan-interface 10
shut= shutdown
und shut= undo shutdown
sa= save
reb= reboot
简写规则:前缀能唯一区分即可缩写。不确定时输入前几个字母按 Tab 自动补全。
9undo 删除速查
undo vlan 10删除 VLAN
undo port access vlan接口移出 VLAN(改回 VLAN 1)
undo ip address删除接口 IP
undo interface Vlan-interface 10删除 SVI
undo ip route-static ...删除静态路由
undo local-user admin删除本地用户
undo acl number 3001删除 ACL
default恢复接口默认配置(接口视图下)
undo 万能规律:原配置命令前面加 undo 就是删除它。读懂了配置写了什么,就知道怎么删。
没有找到匹配的命令