华为设备常用命令

[Huawei-Ethernet0/0/1]
0/0/1:第一个“0”代表槽位号,第二个“0”代表子卡号,“1”代表接口号
<Huawei>system-view 进入系统试图
[Huawei]interface GigabitEthernet 0/0/0 接口视图
[Huawei]quit 退出 ctrl+z
[Huawei]sysname 12 改名
[Huawei]display version 查看设备版本
[Huawei]display current-configuration 查看配置
(uawei]user-interface console 0
[Huawei-ui-console0]authentication-mode password
[Huawei-ui-console0]set authentication password simple 123
交换机设置明文和密文密码 *
[Huawei]user-interface console 0
[Huawei-ui-console0]authentication-mode password
[Huawei-ui-console0]set authentication password cipher 123)
([Huawei]user-interface console 0
[Huawei-ui-console0]authentication-mode password
Please configure the login password (maximum length 16):123
路由器设置密码)
([Huawei]aaa
[Huawei-aaa]local-user admin01 password cipher 123456
[Huawei]user-interface console 0
[Huawei-ui-console0]authentication-mode aaa
交换机设置用户
[Huawei]aaa
[Huawei-aaa]local-user admin01 password simple 123456
[Huawei]user-interface console 0
[Huawei-ui-console0]authentication-mode aaa)
([Huawei]aaa
[Huawei-aaa]local-user admin01 password cipher 123456
[Huawei]user-interface console 0
[Huawei-ui-console0]authentication-mode aaa
交换机设置用户)
<Huawei>save 保存
<Huawei>reboot 重启
<Huawei>reset saved-configuration 恢复出厂配置
([Huawei]user-interface console 0
[Huawei-ui-console0]idle-timeout 10 10
设置关闭时间)
([Huawei]user-interface 0
[Huawei-ui0]screen-length 24
设置显示命令行数)
<Huawei>undo terminal monitor 不起动提示
[Huawei]clear configuration interface Ethernet 0/0/3 清空端口配置
<Huawei>display mac-address 查看MAC地址表
[Huawei]display bridge mac-address 查看交换机MAC地址
[Huawei]lldp enable 开启lldp邻居信息
[Huawei]display lldp neighbor brief 查看邻居设备信息
[Huawei]display lldp neighbor 查看邻居设备信息摘要
[Huawei]display lldp neighbor interface Ethernet 0/0/5 按接口查看
[Huawei-Ethernet0/0/3]display this 查看当前配置
[Huawei-Ethernet0/0/3]undo negotiation auto 关闭自动协商双工配置
[Huawei-Ethernet0/0/3]duplex half 开启半双工
[Huawei-Ethernet0/0/3]duplex full 开启全双工
[Huawei-Ethernet0/0/3]speed 100 配置速率在非自动协商模式下
<Huawei>display ip routing-table 查看路由表
[Huawei]ip route-static 目标网络ID 子网掩码 下一跳地址 配置静态路由
[Huawei]user-interface vty 0 4 开启远程
[Huawei-ui-vty0-4]authentication-mode password 设置密码
Please configure the login password (maximum length 16):123
[Huawei-ui-vty0-4]protocol inbound telnet 设置
[Huawei-ui-vty0-4]user privilege level 15 设置权限
PC端telnet ip地址 远程

VLAN配置相关命令
[Huawei]vlan 12 创建单个vlan
[Huawei-vlan12]description vlan-qq VLAN改名
[Huawei]vlan batch 10 20 30 批量创建VLAN
[Huawei]vlan batch 10 to 20 连续创建VLAN
[Huawei]undo vlan 10 删除VLAN
[Huawei]interface Ethernet 0/0/1 进入端口
[Huawei-Ethernet0/0/1]port link-type access 修改模式
[Huawei-Ethernet0/0/1]port default vlan 10 端口加入VLAN
[Huawei]port-group 1 创建组批量加入VLAN
[Huawei-port-group-1]group-member Ethernet 0/0/1 to Ethernet 0/0/2 加入VLAN
[Huawei]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/6 创建临时组
<Huawei>display vlan 查看VLAN配置
[Huawei-Ethernet0/0/5]port link-type trunk 开启创客
[Huawei-Ethernet0/0/5]port trunk allow-pass vlan all 允许所有通过
[Huawei-Ethernet0/0/5]port trunk allow-pass vlan 10 允许单个通过
[Huawei-Ethernet0/0/1]port link-type hybrid 设置HYBRID 模式
[Huawei-Ethernet0/0/1]port hybrid pvid vlan 10 为HYBRID端口配置pvid
[Huawei-Ethernet0/0/1]port hybrid tagged vlan 10 有标签允许帧通过
[Huawei-Ethernet0/0/1]port hybrid untagged vlan 10 没有标签允许帧通过
配置GRP功能 交换机互相学习
[Huawei]gvrp 开启
[Huawei]interface Ethernet 0/0/20 进入端口
[Huawei-Ethernet0/0/20]port link-type trunk 开TRUNK
[Huawei-Ethernet0/0/20]port trunk allow-pass all 允许所有VLAN [Huawei-Ethernet0/0/20]gvrp 端口开启
[Huawei-Ethernet0/0/20]gvrp registration normal 配置GVRP

静态路由配置
[Huawei]ip route-static 192.168.2.0 255.255.255.0 192.168.23.3 静态路由
[Huawei]display ip interface brief 查看路由
[Huawei]display ip routing-table 查看路由
[Huawei]ip route-static 0.0.0.0 0.0.0.0 192.168.100.2 preference 80 浮动路由配置 数字大小代表优先级高低

[Huawei]interface vlanif 13 VLAN配置IP
ip address 192.168.13.254 255.255.255.0 VLAN配置IP

STP配置相关命令
[huawei]stp disable 关闭 该交换机的 STP 功能
[huawei]stp enable 开启 该交换机的 STP 功能,默认就是开启的
[huawei]stp mode {stp | rstp | mstp } 配置 交换机运行的 STP 的模式,华为默认是 MSTP
[huawei]stp priority 32768 STP的优先级,默认是 32768 ,设置时数值必须是 4096的倍数
[huawei]interface gi0/0/23 进入接口
[huawei-gi0/0/23] stp {enable | disable } 默认是开启的,也可以基于实际应用场景选择关闭STP
[huawei-gi0/0/23] stp cost 20000 修改一个端口上的 STP 的 cost 。
[huawei]display stp 可以查看到交换机运行的 STP 的模式,以及自己和根交换机的 BID 信息。
[huawei]display stp brief 可以查看到交换机上的每个启用了 STP 的端口的角色与状态;
[huawei]display stp interface gi0/0/23 可以查看该接口的 cost ,以及发送和接收BPDU的情况

MSTP配置:创建VLAN
vlan batch 10 20 30 40 在每个交换机上批量创建 vlan ; [SWA]port-group group-member gi0/0/1 gi0/0/2 临时组
[SWA-port-group] port link-type trunk 开启创客
[SWA-port-group] port trunk allow-pass vlan all 允许所有 vlan通过
[SWA] stp mode mstp 开启MSTP模式
[SWA]stp region-configuration 进入
[SWA-mst-region]region-name HCIE 创建区域
[SWA-mst-region] instance 1 vlan 10 20 创建实例 1
[SWA-mst-region] instance 2 vlan 30 40 创建实例2
[SWA-mst-region] active region-configuration 激活
[SWA] stp instance 1 priority 0 设置优先级
[SWA] stp instance 2 priority 4096 设置优先级
[SWA]display stp 查看 STP 的运行模式;
[SWA]display stp instance 1/2 在交换机上查看修改之后的优先级是否生效;
[SWA]display stp instance 1/2 brief 查看属于某个特定 instance 的

DHCP 配置相关命令
[Huawei]dhcp enable 开启DHCP服务
[Huawei]ip pool 1 创建DHCP 地址池
[Huawei-ip-pool-1]network 192.168.1.1 mask 255.255.255.0 设置IP
[Huawei-ip-pool-1]gateway-list 192.168.1.254 设置网关
[Huawei-ip-pool-1]dns-list 8.8.8.8 设置DNS
[Huawei]interface GigabitEthernet 0/0/1 进入接口
[Huawei-GigabitEthernet0/0/1]dhcp select global 开启接口
开启DHCP中继
[Huawei-GigabitEthernet0/0/1]dhcp select relay DHCP中继
[Huawei-GigabitEthernet0/0/1]dhcp relay server-ip 192.168.2.1 DHCP中继
[Huawei-GigabitEthernet0/0/1]dhcp select interface DHCP 端口
[Huawei-GigabitEthernet0/0/1]dhcp server excluded-ip-address 192.168.1.1 192.168.1.100 设置保留地址

动态路配置相关命令
[Huawei]rip 进入模式
[Huawei-rip-1]version 2 选择版本
[Huawei-rip-1]network 192.168.1.0 宣告路由

VRRP配置相关命令
interface gi0/0/2
ip address 192.168.1.254 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.1.250 配置虚拟IP vrrp vrid 1 priority 200 配置优先级为 200,确保为主设备
display vrrp 查看命令
interface gi0/0/0
vrrp vrid 1 timer {数值} <---更改 master 设备发送报文的周期时间。
(VRRP认证:明文, simple密文, md5
interface gi0/0/0
vrrp vrid 1 authentication-mode simple HCIE
注意:如果 VRRP 认证不成功的话,有可能会导致网络中同时存在多个master;)
[R1]interaface gi0/0/1 进入端口
[R1-gi0/0/1] vrrp vrid 1 track interface gi0/0/0 reduced 150 端口跟踪

ACL配置相关命令
[R1] acl 2000 配置基本ACL
[R1-acl-basic-2000] rule 5 deny source 192.168.1.0 0.0.0.255调用ACL
[R1]interface gi0/0/2 进入端口
[R1-gi0/0/2] traffic-filter inbound acl 2000 调用ACL
[R1] display acl 2000 查看ACL
display traffic-filter applied-record : 查看的是本地设备上的 ACL 的调用情况
display traffic-filter statistic interface gi0/0/2 inbound/outbound 查看的特定端口的特定方向上的 ACL 的批量的流量以及处理动作。
display acl all : 查看设备上创建的所有的 ACL ;
display acl 3333 : 查看设备上特定的 ACL 3333 ;
acl 3333 创建高级ACL
rule 5 deny icmp source 192.168.1.254 0.0.0.0 destination 192.168.23.3 0.0.0.0
interface gi0/0/0 进入接口
traffic-filter outbound acl 3333 调用

{NAT配置相关命令} 转换成该接口的 公网IP 地址
[R1] nat static global 100.1.12.3 inside 192.168.1.1 静态NAT转换条目
[R1]interface gi0/0/1 在出端口开启NAT装换[R1-gi0/0/1] nat static enable 在出端口开启NAT装换
PAT/PNAT/NAT-Port/端口复用/端口NAT/ port NAT
[R1] acl 2000 创建ACL
[R1-acl-basic-2000] rule 5 permit source 192.168.1.1 0.0.0.0
[R1]interface gi0/0/1 端口调用
[R1-gi0/0/1] nat outbound 2000 端口调用

{OSPF设置相关命令}
<R1>reset ospf 1 process OSPF协议1 进行重启;
<R1> reset ospf process OSPF协议进程重启
<AR21>display ospf interface OSPF查看接口配置
<AR21>display ospf interface GigabitEthernet 0/0/2 查看单个接口明细
[AR22]ospf 创建OSPF
[AR22-ospf-1]area 0 创建区域
[AR22-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.255 广播

[AR22-GigabitEthernet0/0/0]ospf dr-priority 10 更改该端口用于竞选DR/BDR 时使用的优先级
[AR22-GigabitEthernet0/0/0]ospf network-type p2p 更改该端口的 OSPF 网络类型;

转载于:https://blog.51cto.com/13598094/2105145

  • 5
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值