华为交换机常用的配置命令
原创
©著作权归作者所有:来自51CTO博客作者mb677b6e733196d的原创作品,请联系作者获取转载授权,否则将追究法律责任
<Huawei> system-view //进入全局模式
[Huawei] interface g0/0/0 //进入接口配置模式
[Huawei] sysname SW1 //修改交换机的名称
[Huawei] dispaly history-command //查看历史命令
[Huawei] dispaly current-configuration //查看当前生效配置信息
[Huawei] dispaly this //查看当前视图生效的配置信息
//为console口配置登录密码:
user-infterface con 0
authentication-mode password
set authentication password cipher abc123456
//配置本地登录信息:
aaa
local-user admin password cipher abc123456 //创建一个本地帐户为admin,密码为abc123456
local-user admin privilege level 15 //配置帐户优先级为15,数值越高,权限越大
local-user admin service-type telnet //配置本地用户接入为telnet
user-interface vty 0 4 //进入VTY0`4用户界面视图
authentication-mode aaa //配置VTY类型用户验证方式为aaa
//创建、修改和删除vlan
[Huawei] vlan 10 //创建vlan 10
[Huawei] vlan batch 2 to 8 20 to 25 //批量创建vlan 2到8, 20到25;
Access接口加入VLAN
<HUAWEI> system-view
[HUAWEI] interface gigabitethernet0/0/1
[HUAWEI-GigabitEthernet0/0/1] port link-type access //设置接口的链路类型为Access
[HUAWEI-GigabitEthernet0/0/1] port default vlan 10 //把接口GigabitEthernet0/0/1加入VLAN 10
Trunk接口加入VLAN
<HUAWEI> system-view
[HUAWEI] interface gigabitethernet0/0/1
[HUAWEI-GigabitEthernet0/0/1] port link-type trunk //设置接口的链路类型为Trunk
[HUAWEI-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 //把接口GigabitEthernet0/0/1加入VLAN 10
Hybrid接口加入VLAN
<HUAWEI> system-view
[HUAWEI] interface gigabitethernet0/0/1
[HUAWEI-GigabitEthernet0/0/1] port link-type hybrid //设置接口的链路类型为Hybrid
[HUAWEI-GigabitEthernet0/0/1] port hybrid tagged vlan 10 //接口GigabitEthernet0/0/1以Tagged方式加入VLAN 10
[HUAWEI-GigabitEthernet0/0/1] port hybrid untagged vlan 20 //接口GigabitEthernet0/0/1以Untagged方式加入VLAN 20
QinQ接口加入VLAN
<HUAWEI> system-view
[HUAWEI] interface gigabitethernet0/0/1
[HUAWEI-GigabitEthernet0/0/1] port link-type dot1q-tunnel //设置接口的链路类型为QinQ
[HUAWEI-GigabitEthernet0/0/1] port default vlan 10 //接口GigabitEthernet0/0/1加入VLAN 10
//通过端口组vlan10-group批量添加端口到vlan10
[Huawei] port-group vlan10-group //创建端品组vlan10-group
[Huawei-port-group-vlan10-group] group-member g0/0/1 to g0/0/10 //为端口组添加1到10号端口
[Huawei-port-group-vlan10-group] port link-type access //批量修改VLAN链路类型为access
[Huawei-port-group-vlan10-group] port default vlan 10 //批量把端口1-10加入vlan10
将接口类型修改为Access
<HUAWEI> system-view
[HUAWEI] interface gigabitethernet0/0/1
[HUAWEI-GigabitEthernet0/0/1] port link-type access
[HUAWEI-GigabitEthernet0/0/1] port default vlan 10 //设置接口的PVID为VLAN 10,并同时将VLAN 10加入接口
删除单个VLAN10
<HUAWEI> system-view
[HUAWEI] undo vlan 10
|