-
第
1
章
系统基本配置命令
1.1
系统基本配置命令
1.1.1
clock datetime
【命令】
clock datetime time date
【视图】
用户视图
【参数】
time
:当前时间,格式为
HH:MM:SS
(小时
:
分钟
:
秒)
,
HH
取值范
围为
0
~
23
,
MM
和
SS
取值范围为
0
~
59<
/p>
。
date
:为当前日期,格式为
MM/DD/YYYY
< br>(月
/
日
/
年)或者
YYYY/MM/DD
(年
/
月
/
日)
,
MM
的取值范围为
1
~
12
,
DD
的取值范
围与月份有关,
YYYY
的取值范围为
2000
~
2035
。
【描述】
clock
datetime
命令用来设置系统时间和日期。
在需要严格获取绝对时间的应用环境中,
必须设定设备当前日期
和时钟。在输入时间参数时,可以不输入秒。
设置完成后,可以使用
display
clock
命令进行查看。
【举例】
#
设置设备当前日期为
2005
p>
年
8
月
1
日
14
时
10
分
20
秒。
1.1.2
clock summer-time
【命令】
clock
summer-
time
zone-name
one-off
start-time
start-date
end-time end-date offset-time
clock
summer-
time
zone-name
repeating
{
start-time
start-date
end-time
end-date
|
start-
time
start-year
start-month
start-week
start-day
end-time
end-year
end-month end-week end-day
} offset-time
undo clock
summer-time
【视图】
用户视图
【参数】
zone-name
:夏令时名称,为
1
~
32
个字符的字符串,区分大小<
/p>
写。
one-
off
:表示仅对某一年的夏令时时间进行设置。
repeating
:表示对从某一
年开始的以后每年的夏令时时间的设
置。
start-time
:起始时间,
格式为
HH:MM:SS
。
start-date
:起始日期,
格式为
YYYY/MM/DD
或
MM/
DD/YYYY
。
end-time
:结束时间,格式
为
HH:MM:SS
。
end-date
:结束日期,格式
为
YYYY/MM/DD
或
MM/DD
/YYYY
。
offset-time
:增加的时间,格式为
HH:MM:SS
。
start-year
:开始的年份,取值范围
2000
~
2035
。
start-month
:
开始的月份,
取值如下:
J
anuary
、
February
、<
/p>
March
、
April
、
May
、
June
、
July
、
Augu
st
、
September
、
October
、
November
、
December
。
start-week
:
开始的星期,
取值为当月的第几个星期,
取值如下
:
first
、
second
、
third
、
fou
rth
、
fifth
、
last
。
start-day
:起始日,取值为:
Sunday
、
Monday
、
p>
Tuesday
、
Wednesday
p>
、
Thursday
、
Friday
、
Saturday
。
end-year
:结束的年份,和起始年份应该在同一年。取值范围
2000
~
2035
。
end-month
:
结束的月份,
取值如下:
January
、
February
、
M
arch
、
April
、
May
、
June
、
July
、
Aug
ust
、
September
、
October
、
November
、
December
。
end-week
:结束的星期,取
值为当月的第几个星期,取值如下:
first
、
second
、
third
、
fourth
、
fifth
、
last
。
end-day
:
< br>结束日,
取值为:
Sunday
、
Monday
、
Tuesday
p>
、
Wednesday
、
< br>Thursday
、
Friday
、
Saturday
。
【描述】
clock summer-time
命令用来设置夏令时的名
称、起始的时间和
日期、
结束的时间和日期、
< br>增加的时间。
undo
clock
summer-
time
命令用来取消夏令时设置。
设置完成后,
可以使用
display
clock
命令进行查看。
日志、
p>
debug
等信息时间将采用经过时区和夏令时调整过的本地时间。
需要注意的是:
l
从“起始日期”的“起始时间
”到“结束日期”
的“结束时间”这个时间段长度必须大于
1<
/p>
天小于
1
年,否则视
为无效参数,配置失败。
l
如果当前系统时间在该命令指
定的时间段内,
则执行该命令后,系统时间将自动增加“
off
set-time
”
。
相关配置可参考命令
clock
timezone
。
【举例】
#
设置夏令时
abc1
,从
2005
年
8
月
1
日的
06:00:
00
开始,到
2005
年
9
月
1
日的
06:00:00
结束,比标准时间延迟
1
小时。
clock
summer-time
abc1
one-off
06:00:00
08/01/2005 06:00:00 09/01/2005 01:00:00
#
设置夏令时
abc2
,从
2007
年开始(包
括
2007
年)以后每年
的
8
月
1
日的
06:00:00
到
9
月<
/p>
1
日的
06:00:00
,比当前系统时
间增加
1
小时
。
clock
summer-time
abc2
repeating
06:00:00
08/01/2007 06:00:00
09/01/2007 01:00:00
1.1.3 clock timezone
【命令】
clock timezone zone-name { add | minus
} time
undo clock timezone
【视图】
用户视图
【参数】
zone-name
:时区名称,为
1
~
32
个字符的字符串,区分大小写。
add
:
比
UTC
(
Universal
Time Coordinated
,通用协调时间)
标准时间
增加。
minus
:比
UTC
标准时间减少。
time
:时间值,格式为
HH:MM:SS
,
HH
取值范围为
0
~
23
,
MM
和
SS
取值范围为
0
~
59
。
【描述】
clock
timezone
命令用
来对本地时区信息进行设置。
undo
clock
timezone
命令用来恢复缺省情况。
缺省情况下,本地址时区采用
UTC
时区。
设置生效后,
可以用
display
clock
命令进行查看。
日志、
p>
debug
等信息时间将采用经过时区和夏令时调整过的本地时间。
相关配置可参考命令
clock summer-
time
。
【举例】
#
设置本地时区名称为
Z5
,比
UTC
标准时间增加
5
小时。
1.1.4 command-
privilege
【命令】
command-privilege level
level view view command
undo command-privilege view view
command
【视图】
系统视图
【参数】
level
:命令的优先级,取值范围为
0
~
3
。
view
:命令行视图的名称。
command
:需要设置的命令。
【描述】
command-privilege
命令用来设置指定视图内
的命令的级别。
undo command-
privilege
命令用来取消当前设置。
命令权限共分为访问、监控、系统、管理
4
个级别,标识为
0
~
3
。管理员可以根据用户需要分配权限,使其在
相应的视图下工
作。用户登录设备时,其所能使用的命令取决于用户的级别。例
如:某用户的级别是
3
级,而
< br>VTY 0
用户界面上的命令级别是
1
< br>级,则该用户从
VTY
0
登录
系统时,可以使用
3
级及
3
级以下的
命令。
表
1-1
缺省情况下的命令优先级
级别
名称
命令
0
访问
p
ing
、
tracert
、
telnet
等
1
监控
display
、
debuggin
g
等
2
系统
所有配置命令(管理级的命令除外)
3
管理
文件
系统命令、
FTP
命令、
TFTP
p>
命令、
XMODEM
命令
< br>
&
说明:
请
用户不要轻易改变命令级别,
否则可能带来维护和操作上的不
便
。
【举例】
#
设置
interface
命令为
0
级,执行视图为系统视图。
[Sysname]
command-privilege
level
0
view
system
interface
1.1.5
display clipboard
【命令】
display clipboard
【视图】
任意视图
【参数】
无
【描述】
display
clipboard
命令用来显示剪贴板的内容。
将指定的内容复制到系统剪贴板的操作过程如下:
l
将光标移到需要剪贴部分的起始位置,按下
<
br> 键 <
br>”是指英文格式的逗号) (.) 指定的内容便复制到系统剪贴板中了。 :显示
如果“ <
br>_ “
“
命令用来显示或保存系统当
逗号
(,)
>
(其中“
,
;
l
将光标移到需要剪贴部分的结
束位置,按下
句号
键
>
(其中“
.
”是指英文格式的句号)
,则
【举例】
#
查看系统剪贴板的内容。
----------------
CLIPBOARD-----------------
ip route 10.1.0.0 255.0.0.0 eth 0
1.1.6 display clock
【命令】
display clock
【视图】
任意视图
【参数】
无
【描述】
display
clock
命令用来显示系统当前的时间和日期。
相关配置可参考命令
clock
datetime
。
【举例】
#
查看系统当前日期和时间。
09:41:23 UTC Thu 12/15/2005
1.1.7 display current-
configuration
【命令】
display current-configuration [
interface interface-type
[
interface-number
]
|
configuration
[
configuration-type ] ] | [ by-linenum ] | [ | {
begin |
include | exclude } text ] ]
【视图】
任意视图
【参数】
interface
:显示接口的配置。
interface-type interface-
number
:接口类型和接口编号。
configuration configuration
:显示非接口配置。如果不带参
数,则显示所有的非接口配置;
如果带参数,具体参数与设备型
号和用户当前的配置有关,例如:
l acl-
adv
:查看高级访问控制列表的配置。
l
rip
:查看
RIP
的配置。
l
timerange
:查看时间范围的配置。
l
isp
:显示网络服务提供商的配置。
l post-
system
:显示
post-
system
的配置。
l radius-template
Radius
模板类型的配
置。
l
system
:显示系统配置。
l user-
interface
:显示用户接口的配置。
by-
linenum
:显示带有行号的系统当前配置。
|
:使用正则表达式过滤显示设备的
配置。
begin
:显示以指定字符串(
text
)开头的配置。
includ
e
:显示包含指定字符串(
text
)
的配置。
exclude
:显示不含指定字符串(
text
)的配置。<
/p>
text
:
正则表达式字符串,区分大小写,允许空格。
表
1-2
正则表达式中的特殊字符
特殊字符
含义
使用说明
_
下划线,类似于一个通配符,可以代表如下字符:
(^|$$|[,(){}])
空格、起始符、结束符
如果表达式的第一个字符不是“
_
”
,则对“
_
”字符的个数不作
限制(受命令行长度的限制)
如
果第一个字符是“
_
”
,那么连续的“
_
”字符个数应小于
5
个
_
”字符不是连续的,以第一组“
”作为输出信息的过滤
规则,对后续的“
_
”不作处理
^
行首匹配符,后面的字符串只能出现在每行的开始
正规表达式
“
^user
”
表示与出现在行首的字符串
user
”
匹配,
不能匹配以“
Auser
”开始的行
$$
行尾匹配符,后面的字符串只能出现在每行的末尾
正规表达式
“
user$$
”
表示与出现在行尾的字符串
user
”
匹配,
不能匹配以“
userA
”结尾的行
.
句点,通配符,匹配任何一个字符,包括空格
无
*
星号,匹配前面的子表达式零次或多次
zo*
能匹配“
z
”以及“
zoo
”
+
加号,匹配前面的子表达式一次或多次
zo+
能匹配“
zo
”以及“
zoo
”
,但不能匹
配“
z
”
【描述】
display current-configuration
命令用来显示设备当前的配置
信息。
当用户完成一组配置之后,
需要验证
是否配置正确,
则可以执行
display current-
configuration
命令来查看当前生效的参数。
对于
某些当前配置的参数,如果与缺省参数相同,则不显示。对
于某些参数,
虽然用户已经配置,
但如果这些参数所在的功能没
有生
效,则不予显示。
相关配置可参考
命令
save
、
reset
saved-configuration
和
display
saved-configuration
。
【举例】
#
显示交换机当前生效的配置参数。
#
sysname Sysname
#
domain default enable
system
#
telnet server enable
#
vlan 1
#
radius scheme system
server-type extended
primary authentication 127.0.0.1 1645
primary accounting
127.0.0.1 1646
user-name-
format without-domain
#
domain system
access-limit disable
state active
idle-cut disable
self-
service-url disable
#
interface
NULL0
#
interface LoopBack0
ip address 1.1.1.100 255.255.255.255
#
interface Vlan-interface1
ip address 192.168.0.53 255.255.255.0
#
interface GigabitEthernet1/0/1
#
interface GigabitEthernet1/0/2
#
interface GigabitEthernet1/0/3
#
interface GigabitEthernet1/0/4
#
interface GigabitEthernet1/0/5
#
interface GigabitEthernet1/0/6
#
interface GigabitEthernet1/0/7
#
interface GigabitEthernet1/0/8
#
interface GigabitEthernet1/0/9
#
interface GigabitEthernet1/0/10
#
interface GigabitEthernet1/0/11
#
interface GigabitEthernet1/0/12
#
interface GigabitEthernet1/0/13
#
interface GigabitEthernet1/0/14
#
interface GigabitEthernet1/0/15
#
interface GigabitEthernet1/0/16
#
interface GigabitEthernet1/0/17
#
interface GigabitEthernet1/0/18
#
interface GigabitEthernet1/0/19
#
interface GigabitEthernet1/0/20
#
interface GigabitEthernet1/0/21
#
interface GigabitEthernet1/0/22
#
interface GigabitEthernet1/0/23
#
interface GigabitEthernet1/0/24
#
interface GigabitEthernet1/0/25
shutdown
#
interface
GigabitEthernet1/0/26
shutdown
#
interface GigabitEthernet1/0/27
shutdown
#
interface GigabitEthernet1/0/28
shutdown
#
rip 1
undo validate-source-
address
timers garbage-
collect 23
#
ip route-static default-preference 100
#
user-interface aux 0
idle-timeout 0 0
user-interface vty 0 4
authentication-mode none
user privilege level 3
idle-timeout 0 0
#
return
#
查看配置信息中包含字符串
10*
的行,
“
*
”表示它前面的“
0<
/p>
”
可以出现
0
次
或连续多次。
vlan 1
primary authentication 127.0.0.1 1645
primary
accounting 127.0.0.1 1646
ip address 1.1.1.100 255.255.255.255
interface Vlan-interface1
ip address 192.168.0.53 255.255.255.0
interface
GigabitEthernet1/0/1
interface GigabitEthernet1/0/2
interface
GigabitEthernet1/0/3
interface GigabitEthernet1/0/4
interface
GigabitEthernet1/0/5
interface GigabitEthernet1/0/6
interface
GigabitEthernet1/0/7
interface GigabitEthernet1/0/8
interface
GigabitEthernet1/0/9
interface GigabitEthernet1/0/10
interface
GigabitEthernet1/0/11
interface GigabitEthernet1/0/12
interface
GigabitEthernet1/0/13
interface GigabitEthernet1/0/14
interface
GigabitEthernet1/0/15
interface GigabitEthernet1/0/16
interface
GigabitEthernet1/0/17
interface GigabitEthernet1/0/18
interface
GigabitEthernet1/0/19
interface GigabitEthernet1/0/20
interface
GigabitEthernet1/0/21
interface GigabitEthernet1/0/22
interface
GigabitEthernet1/0/23
interface GigabitEthernet1/0/24
interface
GigabitEthernet1/0/25
interface GigabitEthernet1/0/26
interface
GigabitEthernet1/0/27
interface GigabitEthernet1/0/28
rip 1
ip route-static default-
preference 100
#
查看以“
user
”开始的配置信息,
“
^
”表示以其后的字符串开
头为匹
配规则。
user-interface aux 0
user-interface vty 0 4
#
查看非接口的配置信息。
#
sysname Sysname
#
domain
default enable system
#
telnet server
enable
#
radius scheme system
server-type extended
primary authentication 127.0.0.1 1645
primary accounting
127.0.0.1 1646
user-name-
format without-domain
#
domain system
access-limit disable
state active
idle-cut disable
self-service-url disable
#
rip 1
undo validate-source-
address
timers garbage-
collect 23
#
ip route-static default-preference 100
#
user-interface aux 0
idle-timeout 0 0
user-interface vty 0 4
authentication-mode none
user privilege level 3
idle-timeout 0 0
#
return
1.1.8
display diagnostic-information
【命令】
display diagnostic-information
【视图】
任意视图
【参数】
无
【描述】
display diagnostic-information
前各个功能模块运行的统计信息。
在系统出现故障时,为了便于问题定位,需要收集很多的
信息,
但相应的
display
命令很
多,
很难一次把信息收集全,
这时可以
使用
display diagnostic-information
命令,显示系统当前各
个功能模块运行的统计信息。
d
isplay
diagnostic-information
命令一次性收集了配置如下各条命令后终端显示的信息,包括:
l display
clock
l
display version
l
display device
l display current-
configuration
l
display saved-configuration
l display interface
l display
memory
l
display logbuffer
l
display vlan all
l
display history-command
l
display trapbuffer
l
display loopback-detection
l display dhcp-snooping
l display
igmp-snooping group
l display mld-snooping
group
l
display gvrp statistics
l
display ipv6 statistics
l
display mac-address
l
display link-aggregation summary
l display stp brief
l display arp
all
l display
ip interface
l
display ip statistics
l
display ipv6 interface
l
display ipv6 fib
l display fib
l display ipv6 neighbors
all
l display
ip routing-table
l
display ipv6 routing-table
l
<
略
>
【举例】
#
保存系统当前各个功能模块运行的统计信息。
Save
or
display
diagnostic
information
N=display)?[Y/N]:y
Please
input
the
name(*.diag)[flash:/]:
file
(Y=save,
Diagnostic information is outputting to
flash:/.
Please wait...
Save successfully.
#
显示系统当前各个功能模块运行的统计信息。
Save
or
display
diagnostic
information
N=display)?[Y/N]:n
由于显示内容较多,此处不详细列出。
1.1.9 display history-
command
【命令】
display history-command
【视图】
(Y=save,
任意视图
【参数】
无
【描述】
display history-command
命令用来显
示历史命令,以便用户查
看。设备显示的历史命令不超过
256
条。
相关配置可参考“登录以太网交换机”中的
history-
command
max-
size
命令部分。
【举例】
#
显示历史命令。
system-view
quit
1.1.10 display hotkey
【命令】
display hotkey
【视图】
任意视图
【参数】
无
【描述】
display
hotkey
命令用来显示系统中快捷键的分配信息。
【举例】
#
显示系统中快捷键的分配信息。
----------------- HOTKEY
-----------------
=Defined
hotkeys=
Hotkeys Command
CTRL_G display current-
configuration
CTRL_L
display ip routing-table
CTRL_O undo debugging all
=Undefined hotkeys=
Hotkeys Command
CTRL_T NULL
CTRL_U NULL
=System
hotkeys=
Hotkeys Function
CTRL_A Move the cursor to
the beginning of the current
line.
CTRL_B Move the cursor
one character left.
CTRL_C
Stop current command function.
CTRL_D Erase current character.
CTRL_E Move the cursor to
the end of the current line.
CTRL_F Move the cursor
one character right.
CTRL_H
Erase the character left of the cursor.
CTRL_K Kill outgoing
connection.
CTRL_N
Display
CTRL_P Display
the previous command from the history
buffer.
CTRL_R
Redisplay the current line.
CTRL_V Paste text from the clipboard.
CTRL_W Delete the word
left of the cursor.
CTRL_X
Delete all characters up to the cursor.
CTRL_Y Delete all
characters after the cursor.
the
next
command
from
the
history
buffer.
CTRL_Z
Return to the User View.
CTRL_] Kill
incoming
connection
or
redirect
connection.
ESC_B Move the cursor
one word back.
ESC_D
Delete remainder of word.
ESC_F Move the cursor forward one
word.
ESC_N Move the
cursor down a line.
ESC_P
Move the cursor up a line.
ESC_< Specify the beginning of
clipboard.
ESC_> Specify
the end of clipboard.
1.1.11 display this
【命令】
display this [ by-linenum ]
【视图】
任意视图
【参数】
by-
linenum
:显示每一行信息的行号。
【描述】
display
this
命令用来显示系统当前视图下生效的配置信息。
当用户在某一视图下完成一组配置之后,需要验证是否配置正
确,则可以执行
display
this
命令来查看当前生效的参数。
需要注意以下几点:
l
对
于已经生效的配置参数如果与缺省工作参数
相同,则不显示;
l
对于某些参数,虽然用户已经配置,但如果这
些参数所在的功能没有生效,则不显示;
l
在
不同接口视图下使用该命令,将直接显示相
应接口下的配置;
l
在
不同协议视图下使用该命令,将显示相应协
议视图的配置;
l
在
协议子视图下使用该命令,将显示此协议子
视图下的配置。
【举例】
#
显示系统当前视图下生效的运行配置参数。
[Sysname] user-interface
vty 0
[Sysname-ui-vty0]
display this
#
user-interface aux 0
idle-timeout 5 0
user-interface vty 0 4
authentication-mode none
user privilege level 3
idle-timeout 0 0
#
return
1.1.12
display version
【命令】
display version
-
-
-
-
-
-
-
-
-
上一篇:Android Camera2提升及调用详解
下一篇:数学名词翻译