华为交换机常用基础命令大全,一看就会,收藏备用!

点击蓝字 关注我们 一起学习
前言
大家好,我是薛哥。华为交换机在弱电工程中经常用到,华为交换机有时候也会配置一些基础的命令,我们大部分都是厂家来弄,有时候厂家技术不在的时候,我们自己也可以弄一下,收藏下面的常用命令吧!
终将渡过成长的海
01
正文
system-view 进入系统视图
quit 退到系统视图
sysname 交换机命名
vlan 20 创建vlan(进入vlan20)
display vlan 显示vlan
undo vlan 20 删除vlan20
display vlan 20 显示vlan里的端口20
Interface e1/0/24 进入端口24
portlink-type access vlan 20 把当前端口放入vlan20
undo porte1/0/10 删除当前VLAN端口10
display current-configuration 显示当前配置
interfacevlan 1 进入VLAN1
ip address192.168.3.100 255.255.255.0 配置IP地址
user-interfacevty 0 4 进入虚拟终端
authentication-modepassword (aut password) 设置口令模式
setauthentication password simple 222 (set aut pass sim 222) 设置口令
userprivilege level 3(use priv lev 3) 配置用户级别
dispcurrent-configuration (disp cur) 查看当前配置
display ipinterface 查看交换机VLANIP配置
resetsaved-configuration(reset saved) 删除配置(必须退到用户模式)
reboot重启交换机
在sw1上:
vlan 10建立VLAN 10
interfacee1/0/5 进入端口5
Portdefault vlan 10 把端口5加入vlan10
vlan 20建立VLAN 20
interfacee1/0/15 进入端口15
portdefault vlan 20 把端口15加入VLAN20
interfacee1/0/24 进入端口24
portlink-type trunk 把24端口设为TRUNK端口
port trunkpermit vlan all 所有端口都能经过此路径
在SW2上:
vlan 10建立VLAN 10
interfacee1/0/20 进入端口20
portdefault vlan 10 把端口20放入VLAN10
interfacee1/0/24 进入端口24
portlink-type trunk 把24端口设为TRUNK端口
port trunkpermit vlan all (port trunk permit vlan 10 只能为vlan10使用)24端口为所有VLAN使用
displayinterface e1/0/24 查看端口24是否为TRUNK
undo porttrunk permit vlan all 删除该句
dispaly version 显示系统软件版本及硬件信息
system-view 切换到系统视图
quit 返回
interface +接口 进入接口视图
ip address +IP +mask 配置IP和子网掩码
return 返回用户视图
<Ctrl+Z> 返回用户视图
sysname R1 修改路由器名称为R1
display current-configuration 查看路由器当前配置
dispaly interface +接口查看路由器接口的状态信息
save 保存当前配置
display ip interface brief 查看接口与IP相关摘要信息
display ip routing-table 查看路由表
user-interface vty 0 4 进入0~4前五个的VTY用户界面进行整体配置
authentication-mode password 设置验证方式为密码
user privilege level 3 设置用户登陆级别
aaa 进入aaa视图
local-user admin password cipher hello privilege level 3在aaa视图下设置账号密码和用户级别
local-user admin service-type telnet 配置该用户接入类型为aaa
q 退回到用户视图
user-interface vty 0 4 进入到VTY用户视图
authentication-mode aaa 设置验证方式aaa
配置SSHserver:rsalocal-key-pair create 生成本地RSA主机密钥对
display rsa local-key-pair public 查看本地密钥对中的公钥信息
user-interface vty 0 4 进入VTY用户视图
authentication-mode aaa 设置用户验证方式为aaa授权验证方式
protocol inbound ssh 指定VTY用户只支持ssh
q 返回到系统视图
aaa 进入aaa视图
local-user huawei1 password cipher huawei1 创建用户和设置用户密码
local-user huawei1 service-type ssh 配置本地用户接入类型为ssh
q 退回到用户视图
ssh user huawei1 authentication-type password新建ssh用户指定ssh用户认证方式为password
aaa 进入aaa视图
local-user huawei1 privilege level 3 设置huawei1用户级别为3级别范围0~15
stelnet server enable 开启ssh功能
display ssh user-information huawei1 查看ssh用户配置信息不指定用户默认查看所有用户
display ssh server status 查看ssh服务器全局配置信息
stp enable 在交换机上启用STP
stp mode stp
dis stp 查看stp配置
dis stp brief 查看接口摘要信息
stp priority 4096 修改交换机优先级为4096
stp root primary 设置交换机为主根交换机
stp root secondary 命令配置备份交换机
display stp interface Ethernet 0/0/2 查看e0/0/2接口的开销值
int e0/0/2
stp cost 2000 配置接口e0/0/2的带价值为2000
stp timer forward-delay 3000 修改STP的ForwardDelay时间为3000cs也就是30s
stp bridge-diameter 3 命令设置网络的直径为3
stp mode rstp 启用RSTP使用RSTP可以缩短收敛时间
int e0/0/1
stp edged-port enable 配置接口e0/0/1为边缘端口不参与生成树的计算
stp region-configuration 进入MST域视图
region-name huawei 配置MST域名为huawei
revision-level 1 配置MSTP的修订级别为1
instance 1 vlan 10 指定VLAN10映射到MSTI1
active region-configuration 激活MST域配置
display stp region-configuration 查看交换机上当前生效的MST域配置信息
dis stp instance 0 brief 查看实例0中的生成树状态和统计的摘要信息
stp instance 2 priority 0 配置交换机成位实例2中的根交换机
rip 创建开启协议进程
network + ip 对指定网段接口使能RIP功能IP地址是与路由器直连的网段
debugging rip 1 查看RIP定期更新情况
terminal debugging
terminal monitor 在屏幕上显示debug信息
undo debugging rip 1undo debug all 命令关闭debug调试功能
在上面的配置基础上配置RIP2
rip 进入子视图模式
version 2 配置版本
或者直接配置
rip 1
version 2
network + ip
ospf 1 进入ospf视图1代表进程号
area 0 创建区域并进入OSPF区域视图,输入要创建的区域ID,骨干区域即区域0
network +IP +匹配码
display ospf interface 命令查看OSPF接口通告是否正确、
display ospf peer 查看OSPF邻居状态
display ip routing-table protocol ospf 查看OSPF路由表
ospf 1
area 1
authentication-mode simple plain huawei plain是口令以明文方式显示
authentication-mode md5 1 huawei 配置区域密文认证
int g0/0/1
ospf authentication-mode md5 1 huawei 在一条链路中的两个接口配置要相同
ospf 1
silent-interface GigabitEthernet 0/0/1 禁止接口g0/0/1接收和发送ospf报文
ospf 1
silent-interface all 抑制所有接口
un
display ip routing-table 10.0.1.1 查看10.0.1.1所在网段的路由条目
int g0/0/0
ospf network-type p2mp 修改ospf的网络类型为多到多点
ospf network-type broadcast 修改ospf的网络类型为广播
ospf dr-priority 100 修改g0/0/0接口的DR优先级为100
reset ospf process 重启ospf进程
ospf cost 1000 修改ospf的开销值为1000
ospf timer hello 20 修改HELLO计时器为20s
ospf timer dead 80 修改dead计时器为80s
ospf 1
preference 110 修改ospf优先级为110值越大优先级越低
ospf 1
import-route rip 1 在ospf进程中引入rip
default-route-advertise always 在ospf进程中引入默认路由
rip
import-route ospf 1 在rip进程中引入ospf
import-route ospf cost 3 ospf 引入rip时配置开销值
default-route originate 在RIP进程中发布默认路由
int g0/0/0
vrrp vrid 1 virtual-ip 172.16.1.254创建VRRP备份组,备份组号为1,配置虚拟IP为172.16.1.254
vrrp vrid 1 priority 120 修改优先级为120
display vrrp 查看vrrp信息
display vrrp brief
display vrrp interface g0/0/0 查看VRRP的工作状态
int g0/0/0
vrrp vrid 1 virtual-ip 172.16.1.254创建VRRP备份组,备份组号为1,配置虚拟IP为172.16.1.254
vrrp vrid 1 priority 120 修改优先级为120
vrrp vrid 2 virtual-ip 172.16.1.253创建VRRP备份组,备份组号为2,配置虚拟IP为172.16.1.253
int g0/0/0
vrrp vrid 1 virtual-ip 172.16.1.254创建VRRP备份组,备份组号为1,配置虚拟IP为172.16.1.254
vrrp vrid 2 virtual-ip 172.16.1.253创建VRRP备份组,备份组号为2,配置虚拟IP为172.16.1.253
vrrp vrid 2 priority 120 修改优先级为120
vrrp vrid 2 preempt-mode disable 开启非抢占方式
int g0/0/1
vrrp vrid 1 track interface GigabitEthernet 0/0/0 reduced 50监视上行接口G0/0/0,当此接口断掉时,裁减优先级50,使优先级为70
vrrp vrid 1 authentication-mode md5 huawei 认证配置
acl 2000 创建一个编号型ACL,基本ACL的范围是2000~29999
rule 5 permit source 1.1.1.1 0指定规则ID为5,允许数据源地址为1.1.1.1的报文通过,反掩码全为0,即精确匹配
rule 10 deny source any 指定ID为10,拒绝任意源地址的数据包通过
display acl all 查看设备上所有的访问控制列表
0
最新精品资料介绍
最近发布了2020年下半年(到12月31号)的公众号文章。里面有方案,有图片,基本涵盖了智能化弱电行业的各个系统的文章,而且还送12套精品资料,每一篇都带着题目,方便大家查找相关内容。比如搜索视频监控方面的资料。此资料非常适合新人学习,尤其没有时间、又不知道怎么搜索资料的,全文件共计2300多个,建议弄一套,绝对有帮助!
文章中的PPT方案,全部赠送了,共计83个PPT,6套完整图纸,206个行业标准规范及施工图集,VISIO图块及拓扑图,各种类型图纸,项目管理及施工方案等等
相关内容可以点击下面的链接查看
2020年下半年公众号文章汇总,资料再升级,赠送2000多个弱电资料
薛哥总结:
如果您需要2019年的下半年文章,可以查看以下链接:
整理汇总2019年下半年公众号文章,资料升级,赠送大量精品资料
如果您需要2020年的上半年文章,可以查看以下链接:
2020年上半年公众号文章,资料再升级,赠送1400多个弱电资料
弱电资料免费送,需要的点下面的链接
好的文章分享出去,分享是一种美德,帮助别人就是帮助自己
如果您在学习弱电行业知识的时遇到问题,不能解决的时候,可以咨询我!我愿意为那些刚入行的人提供一点帮助。欢迎大家加我的QQ号81113907或者微信ruodianxuege
弱电成长俱乐部(VIP群)4群正在招募会员,已经有1600名精英加入我们,欢迎弱电工作者加入!现在入群可以获得精品资料,和1500人脉资源。
我们的宗旨就是分享知识,共享资源,合作共赢,共同成长!
具体详情点击下面的链接:
扫二维码|关注我们
微信号|ruodianxuege
薛哥,一级建造师,弱电成长俱乐部创始人,精通智能化全过程,期待与你合作!
薛哥每天更新智能化弱电知识,欢迎大家交流。
期待你的
分享
点赞
在看

工程师必备
- 项目客服
- 培训客服
- 平台客服
TOP
