华为交换机常用命令

Posted by Sunday on 2019-06-11

#指定管理IP

1
2
3
4
5
system-view
interface vlan 1
ip add 192.168.1.2 24
#ip address 192.168.1.2 255.255.255.0
quit

#开启常用服务

1
2
3
http server enable
telnet server enable
stelnet server enable

#配置认证模式为aaa

1
2
3
4
5
6
7
8
9
10
user-interface vty 0 4
protocol inbound all
authentication-mode aaa
quit

user-interface con 0
authentication-mode aaa
user-interface vty 0 4
authentication-mode aaa
protocol inbound all

#配置aaa帐户密码权限

1
2
3
4
5
6
7
8
aaa
local-user root password cipher sunday
local-user root privilege level 15
local-user root service-type terminal http telnet ssh

local-user admin password cipher sunday
local-user admin privilege level 15
local-user admin service-type terminal http telnet ssh

#ssh帐户认证类型

1
2
ssh user root authentication-type password
ssh user root service-type all

#lacp

1
2
3
4
5
6
7
8
9
10
11
12
13
system-view
interface eth-trunk10
mode lacp
lacp timeout fast
quit

interface gigabitethernet 0/0/1
eth-trunk 10
quit

interface gigabitethernet 0/0/2
eth-trunk 10
quit

接口限速

1
2
3
4
5
interface gigabitethernet 0/0/3
qos lr outbound cir 5120 #5M
quit
display qos lr outbound
undo qos lr outbound #取消qos

#查看相关信息

1
2
3
4
display current-configuration  #查看配置信息显示系统运行配置信息
dis int brief #查看接口
display this #查看接口配置
display transceiver interface XGigabi 0/0/2 verbose

vlan

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Vlan
interface g0/0/1
port link-type access
port default vlan 10
quit

Vlan
interface g0/0/2
port link-type access
port default vlan 20
quit

display vlan

interface g0/0/23
port link-type trunk # 交换机
port allow-pass vlan 10 20
quit

undo link-type
vlan batch 10 20 30 #创建多个vlan

vlan 30
port gigabitethernet 0/0/1 to 0/0/3 #批量加入vlan

Trunk
vlan 40
quit
port-group pg1
group-member g 0/0/4 to g 0/0/6
port link-type trunk
port trunk allow-pass vlan 40