扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
在上期的JUNOS播报中,我给大家介绍了候选配置、显式提交和回退功能如何帮助大幅度提高JUNOS中配置变化的可靠性,并降低配置错误风险的问题。我好像是最粗心大意的一个人,什么错误都躲不过。
对我这样笨手笨脚的打字者来说,JUNOS的另一个有利特性在于它会逐个单词地检查语法错误,而不是等到您在配置语句执行完毕后按return键时才进行语法检查– 也就是说,每当您输入一个单词并按空格键后,JUNOS都会开始检查语法错误。
与IOS一样,JUNOS也支持用户为指令字规定最少字母限制以便区分它们。例如,如果您希望查看IOS中的单播路由表,可键入:
sh ip rou
IOS将这个命令理解成:
show ip route
JUNOS也采用同样的方法,只是每当您按下空格键时,它还会立刻开始检查已执行命令的语法错误。例如,JUNOS用于显示单播路由表的命令是:
show route
您可键入sh,在按下空格键时系统立刻显示show。然后您可键入rou,在按下空格键时系统立刻显示route。
上述举例说明的环境是配置模式。现在,我希望更改机箱配置,于是键入:
[edit]
jeff@Juniper5# set cha
按下空格键命令执行完毕:
[edit]
jeff@Juniper5# set chassis
如果这时按下return,JUNOS将告诉我不存在足够信息:
[edit]
jeff@Juniper5# set chassis
^
missing argument.
这个消息与命令行不完整时IOS显示的消息极为相似。与IOS一样,在JUNOS中,问号(?)也是您的主要参考工具:
[edit]
jeff@Juniper5# set chassis ?
Possible completions:
> alarm Global alarm settings
+ apply-groups Groups from which to inherit configuration data
+ apply-groups-except Don't inherit configuration data from these groups
> config-button Config button behavior settings
craft-lockout Disable craft interface input
> fpc Flexible PIC Concentrator parameters
> routing-engine Routing Engine settings
[edit]
jeff@Juniper5# set chassis
请注意,当命令执行即将完成时,系统将再次显示我刚刚键入的命令行,以便我选择命令行中的下一个单词。我以单词缩写形式添加了字母“c”,但是,当我按下空格键时遭到了JUNOS的反对,因为字母“c”可能代表多个单词,JUNOS不清楚我的具体所指,告诉我可能匹配的单词包括:
[edit]
jeff@Juniper5# set chassis c
^
'c' is ambiguous.
Possible completions:
> config-button Config button behavior settings
craft-lockout Disable craft interface input
jeff@Juniper5# set chassis c
噢,我本想键入craft-lockout命令,没想到犯了错(我经常犯这个错误):
jeff@Juniper5# set chassis crof
^
syntax error.
jeff@Juniper5# set chassis crof
现在的我有些迟疑。因为简短的选项列表指出执行这个命令已关闭了操作接口输入功能。这是什么意思?是我的本意吗?我需要一些帮助,于是运行非常有用的help命令。
当我键入help reference并指出希望使用的命令时,系统显示简短参考:
[edit]
jeff@Juniper5# help reference chassis craft-lockout
craft-lockout
Syntax
craft-lockout;
Hierarchy Level
[edit chassis]
Release Information
Statement introduced in JUNOS Release 8.1.
Deion
Disable the physical operation of the craft interface front panel.
Usage Guidelines
See "Disabling Physical Operation of the Craft Interface".
Required Privilege Level
interface--To view this statement in the configuration.
interface-control--To add this statement to the configuration.
[edit]
jeff@Juniper5#
但这个参考只是简单地告诉我如何使用命令,我却希望针对命令的作用获得更多解释,于是选择运行help topic命令:
[edit]
jeff@Juniper5# help topic chassis craft-lockout
Disabling Physical Operation of the Craft Interface
You can disable the physical operation of the craft interface front panel
on the routing platform. When you disable the operation of the craft
interface, the buttons on the front panel, such as the alarm cutoff
button, no longer function. To disable the craft interface operation,
include the craft-lockout statement at the [edit chassis] hierarchy level:
[edit chassis]
craft-lockout;
For more information about how to configure the craft interface, see
Configuring Conditions That Trigger Alarms.
[edit]
jeff@Juniper5#
此时,我将能够充分了解如何设置机箱组件锁定功能。但是,如果我希望更加详细地了解chassis关键字,该怎么办?这种情况下,我可以使用help apropos来了解与机箱相关的所有不同的上下文:
[edit]
jeff@Juniper5# help apropos chassis
set system location lcc
Line-card chassis location
set system processes chassis-control
Chassis control process
set system processes chassis-control disable
Disable chassis control process
set system processes chassis-control failover
How to handle failure of chassis control process
set chassis
Chassis configuration
set chassis fpc
SHDSL chassis configuration
set chassis disable-power-management
Disable Power Management in this chassis
set chassis network-services
Chassis network services configuration
set chassis lcc
Line-card chassis configuration
set chassis lcc
SHDSL chassis configuration
set snmp trap-group
Chassis or environment notifications
set class-of-service interfaces
Scheduler map applied to chassis queues (not PIC queues)
set class-of-service traceoptions flag hardware-database
Trace chassis hardware database related processing
[edit]
jeff@Juniper5#
运行help apropos命令只能显示与您当时所在的配置级别相关的上下文。如果我在顶部的[edit] 级别输入help apropos interface,将看到极长的上下文列表,内含可供我设置接口选项的所有上下文。在下面的例子中,我将迁移到可以配置OSPF area 0的级别。在这个级别输入help apropos interface将只显示可供我为OSPF area 0配置接口的上下文:
[edit]
jeff@Juniper5# edit protocols ospf area 0
[edit protocols ospf area 0.0.0.0]
jeff@Juniper5# help apropos interface
set virtual-link neighbor-id
Interface functions as a demand circuit
set sham-link-remote
demand-circuitInterface functions as a demand circuit
set interface
Include an interface in this area
set interface
Interface name
set interface
Disable OSPF on this interface
set interface
Type of interface
set interface
Interface metric
set interface
Interface functions as a demand circuit
set interface
Learn neighbors dynamically on a p2mp interface
set interface
Poll interval for NBMA interfaces
set label-switched-path
Interface metric
set peer-interface
Configuration for peer interface
set peer-interface
Name of peer interface
set peer-interface
Interface functions as a demand circuit
[edit protocols ospf area 0.0.0.0]
jeff@Juniper5#
如果对所要完成的配置只有一个大概的了解,可使用问号和help命令在JUNOS中更改配置,无需查看配置手册– 因为JUNOS在CLI上提供微缩手册。
然而,我们现在还不支持这项功能。您可以在整个配置的上下文中添加一些配置语句,这些语句单看并没有什么问题,但却不存在任何意义或者并不完整。在下一篇文章中,我将介绍一些脚本编制工具,以便帮助您在提交配置之前确保整个配置的连贯性。
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者