You are on page 1of 18

命令行基础 (1)

HUAWEI TECHNOLOGIES CO., LTD.


前言

熟悉 VRP 命令行并且熟练掌握 VRP 配置是高效管理华为网络设备的必备


基础。

Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 2
学习目标

学完本课程后,您应该能:
 掌握 VRP 命令行的基础知识

 利用 VRP 命令行进行基本的配置

Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 3
设备初始化启动

BIOS
BIOS Creation
Creation Date
Date :: Jan
Jan 55 2013,
2013, 18:00:24
18:00:24
DDR
DDR DRAM
DRAM init
init :: OK
OK
Start
Start Memory
Memory Test
Test ?? ('t'
('t' or
or 'T'
'T' is
is test):skip
test):skip
Copying
Copying Data
Data :: Done
Done
Uncompressing
Uncompressing :: Done
Done
……
……
Press
Press Ctrl+B
Ctrl+B to
to break
break auto
auto startup
startup ...
... 11
Now
Now boot
boot from
from sd1:/AR2220-V200R003C00SPC200.cc,
sd1:/AR2220-V200R003C00SPC200.cc,
……
……
<Huawei>
<Huawei>
Warning:
Warning: Auto-Config
Auto-Config is
is working.
working. Before
Before configuring
configuring the
the device,
device,
stop
stop Auto-Config.
Auto-Config. If
If you
you perform
perform configurations
configurations when
when Auto-Config
Auto-Config is
is
running,
running, the
the DHCP,
DHCP, routing,
routing, DNS,
DNS, and
and VTY
VTY configurations
configurations will
will be
be
lost.
lost. Do
Do you
you want
want to
to stop
stop Auto-Config?
Auto-Config? [y/n]:Y
[y/n]:Y

Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 4
命令行视图

查看运行状态或其他参数
用户视图

系统视图 配置设备的系统参数等

接口视图
配置接口参数

协议视图 配置路由协议

<Huawei>system-view
<Huawei>system-view
Enter
Enter system
system view,
view, return
return user
user view
view with
with Ctrl+Z.
Ctrl+Z.
[Huawei]interface
[Huawei]interface GigabitEthernet
GigabitEthernet 0/0/0
0/0/0
[Huawei-GigabitEthernet0/0/0]
[Huawei-GigabitEthernet0/0/0]

Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 5
命令行功能

命令 功能

CTRL+A 把光标移动到当前命令行的最前端

CTRL+C 停止当前命令的运行

CTRL+Z 回到用户视图,等同 return 命令

CTRL+] 终止当前连接或切换连接

<Huawei>system-view
<Huawei>system-view
Enter
Enter system
system view,
view, return
return user
user view
view with
with Ctrl+Z.
Ctrl+Z.
[Huawei]^z
[Huawei]^z //Ctrl+Z
//Ctrl+Z
<Huawei>display
<Huawei>display hotkey
hotkey

Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 6
命令行功能

命令 功能

Backspace 删除光标左边的第一个字符

← or Ctrl+B 光标左移一位

→ or Ctrl+F 光标右移一位

TAB 输入一个不完整的命令并按 TAB 键,就可以补全该命令

[Huawei]inter
[Huawei]inter //TAB
//TAB
[Huawei]interface
[Huawei]interface

Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 7
命令行在线帮助

<Huawei> d?
部分帮助
<Huawei> display h?
命令行在线帮助
<Huawei> ?
完全帮助

<Huawei> display ?

[Huawei]d?
[Huawei]d?
ddns
ddns dhcp
dhcp
dhcpv6
dhcpv6 diagnose
diagnose
display
display dns
dns
domain
domain dot1x
dot1x

Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 8
基本配置步骤

命令 功能

sysname 配置设备名称

<Huawei>system-view
<Huawei>system-view
Enter
Enter system
system view,
view, return
return user
user view
view with
with Ctrl+Z.
Ctrl+Z.
[Huawei]sysname
[Huawei]sysname RTA
RTA
[RTA]
[RTA]

Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 9
配置系统时钟

命令 功能

clock timezone 设置所在时区

clock datetime 设置当前时间和日期

clock daylight-saving-time 设置采用夏时制

<Huawei>clock
<Huawei>clock timezone
timezone BJ
BJ add
add 08:00:00
08:00:00
<Huawei>clock
<Huawei>clock datetime
datetime 10:20:29
10:20:29 2013-04-11
2013-04-11
<Huawei>display
<Huawei>display clock
clock
2013-04-11
2013-04-11 10:20:48
10:20:48
Thursday
Thursday
Time
Time Zone(BJ)
Zone(BJ) :: UTC+08:00
UTC+08:00

Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 10
配置标题消息

命令 功能

header login 配置在用户登陆前显示的标题消息

header shell 配置在用户登陆后显示的标题消息

[Huawei]header
[Huawei]header login
login information
information "welcome
"welcome to
to huawei
huawei certification!"
certification!"
[Huawei]header
[Huawei]header shell
shell information
information "Please
"Please don't
don't reboot
reboot the
the device!"
device!"
……
……
welcome
welcome to
to huawei
huawei certification!
certification!
Login
Login authentication
authentication
Password:
Password:
Please
Please don't
don't reboot
reboot the
the device!
device!
<Huawei>
<Huawei>

Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 11
命令等级

用户等级 命令等级 名称

0 0 访问级

1 0 and 1 监控级

2 0,1 and 2 配置级

3-15 0,1,2 and 3 管理级

<Huawei>
<Huawei> system-view
system-view
[Huawei]command-privilege
[Huawei]command-privilege level
level 33 view
view user
user save
save

Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 12
用户界面

用户界面类型 编号

Console 0

VTY 0-4

<Huawei>system-view
<Huawei>system-view
[Huawei]user-interface
[Huawei]user-interface vty
vty 00 44
[Huawei-ui-vty0-4]
[Huawei-ui-vty0-4]

 VTY 接口最大可配范围为 0-14 。


Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 13
配置用户界面命令

命令 功能

idle-timeout 设置超时时间

screen-length 设置指定终端屏幕的临时显示行数

history-command
设置历史命令缓冲区的大小
max-size

## Set
Set the
the size
size of
of the
the history
history command
command buffer
buffer to
to 20.
20.
<Huawei>system-view
<Huawei>system-view
[Huawei]user-interface
[Huawei]user-interface console
console 00
[Huawei-ui-console0]history-command
[Huawei-ui-console0]history-command max-size
max-size 20
20
## Set
Set the
the timeout
timeout duration
duration to
to 11 minute
minute and
and 30
30 seconds.
seconds.
[Huawei-ui-console0]idle-timeout
[Huawei-ui-console0]idle-timeout 11 30
30

Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 14
配置登陆权限

命令 功能

user privilege 配置指定用户界面下的用户级别

set authentication password 配置本地认证密码

## Set
Set the
the user
user level
level on
on the
the VTY0
VTY0 user
user interface
interface to
to 2.
2.
<Huawei>system-view
<Huawei>system-view
[Huawei]user-interface
[Huawei]user-interface vty
vty 00
[Huawei-ui-vty0]user
[Huawei-ui-vty0]user privilege
privilege level
level 22
[Huawei-ui-vty0-4]set
[Huawei-ui-vty0-4]set authentication
authentication password
password cipher
cipher huawei
huawei

Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 15
配置接口 IP 地址

RTA RTB

10.0.12.1/24
1.1.1.1/32
G0/0/0 G0/0/0

# Configure an IP address 10.0.12.1/24 and an IP


address 1.1.1.1/32 for LoopBack0.
<Huawei>system-view
[Huawei]interface gigabitethernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 10.0.12.1
255.255.255.0
[Huawei-GigabitEthernet0/0/0]interface loopback 0
[Huawei-LoopBack0]ip address 1.1.1.1 32

Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 16
总结

 华为网络设备支持多少个用户同时使用 console 口登录 ?


 在使用命令 interface loopback 0 之后, loopback 0 接口的状态是什么?

Copyright © 2013 Huawei Technologies Co., Ltd. All rights reserved. Page 17
谢谢
www.huawei.com

You might also like