命令概述Configure
您(网络管理员)使用命令 configure 进入 CLI 配置模式。您还可以使用它来收集其他信息,例如当前处于配置模式的其他用户。
命令的形式configure
Junos OS 演化版支持三种形式的configure命令:configure、 和 configure privateconfigure exclusive。这些表单控制用户编辑和提交配置的方式。您可以使用此命令来协调管理网络和设备配置的多个用户的工作。
命令 |
编辑访问权限 |
提交访问 |
|---|---|---|
|
|
|
|
|
|
|
|
|
也可以看看
如何使用 configure 命令
最多 32 个用户可同时在配置模式下工作;所有人都可以同时对配置进行更改。对配置进行更改时,可能会提交您和其他用户所做的更改的组合。因此,您必须跟踪谁与您一起处于配置模式。
要查看当前在配置模式下登录到同一设备的其他用户:
configure进入 CLI 配置模式。
如果其他用户处于配置模式,则显示的消息指示用户是谁以及每个用户正在查看或编辑配置的哪个部分。
user@host> configure
Entering configuration mode
Current configuration users:
root terminal p3 (pid 1088) on since 2018-05-13 01:03:27 EDT
[edit interfaces et-3/0/0 unit 0 family inet]
The configuration has been changed but not committed
[edit]
user@host#
如何使用 configure exclusive 命令
如果使用命令进入 configure exclusive 配置模式,则只要您仍处于配置模式,就会锁定候选全局配置。(候选全局配置也称为共享配置或共享配置数据库。)使用该 configure exclusive 命令,您可以在不受其他用户干扰的情况下进行更改。其他用户可以进入和退出配置模式,但不能对配置进行任何永久更改。此外,一旦其他用户退出配置模式,其他用户在配置处于锁定状态时尝试进行的任何更改都会被丢弃。
如果其他用户锁定了配置,而您需要将其强制注销,请使用作模式命令 request system logout pid pid_number。您可以在进入配置模式时收到的通知中找到 当 pid_number 其他人将其锁定以进行独占访问时。
如果进入配置模式,而其他用户也处于配置模式并已锁定配置,则会出现一条消息,用于识别该用户。该消息还标识用户正在查看或编辑的配置部分。例如,在以下示例中, pid_number 已锁定独占访问配置的用户为 1088:
user@host> configure
Entering configuration mode
Users currently editing the configuration:
root terminal p3 (pid 1088) on since 2018-10-30 19:47:58 EDT, idle 00:00:44
exclusive [edit interfaces et-3/0/0 unit 0 family inet]
在模式下 configure exclusive ,退出时将丢弃任何未提交的更改:
user@host>configure exclusivewarning: uncommitted changes will be discarded on exit Entering configuration mode [edit] user@host#set system host-name cool[edit] user@host#quitThe configuration has been changed but not committed warning: Auto rollback on exiting 'configure exclusive' Discard uncommitted changes? [yes,no]yeswarning: discarding uncommitted changes load complete Exiting configuration mode
当您使用退出模式选项yesconfigure exclusive时,Junos OS 演化版会放弃任何未提交的更改,并将配置回滚到之前提交的状态。该no选项使您能够继续编辑或在模式下提交更改configure exclusive。
当一个用户退出 configure exclusive 模式而另一个用户处于 configure private 模式时, Junos OS 演化版 会回滚专用模式会话中任何未提交的更改。
如果使用命令进入 configure exclusive 配置模式并发出命令 commit confirmed ,但未在指定的时间间隔内确认提交,则可能会发生另一次回滚。如果未在指定的时间间隔内确认提交,则会触发自动回滚。自动回滚发生后,作系统将从会话中删除排他锁。结果,出现错误消息“访问权限已被撤销”。出现此错误消息是因为会话不再是独占会话。这意味着配置将恢复到默认状态:任何有访问权限的人都可以编辑配置和/或提交配置。要重新锁定配置,必须再次使用该 configure exclusive 命令。
user@host>configure exclusivewarning: uncommitted changes will be discarded on exit Entering configuration mode [edit] user@host#commit confirmed 1commit confirmed will be automatically rolled back in 1 minutes unless confirmed commit # commit confirmed will be rolled back in 1 minute Commit was not confirmed; automatic rollback complete. [edit] user@host#commiterror: access has been revoked. user@host#commit checkerror: access has been revoked. user@host>configure exclusivewarning: uncommitted changes will be discarded on exit Entering configuration mode
如果启动 configure exclusive 会话、发出 commit confirmed 命令并确认提交,则会话将保留排他锁。您可以继续在锁定的独占会话中对配置进行更改。
user@host>configure exclusivewarning: uncommitted changes will be discarded on exit Entering configuration mode [edit] user@host#commit confirmed 1commit confirmed will be automatically rolled back in 1 minutes unless confirmed commit complete # commit confirmed will be rolled back in 1 minute [edit] user@host#commitcommit complete
也可以看看
如何使用正确的配置
处于 configure private 模式下时,必须使用最近提交的共享配置的副本。如果全局配置发生变化,您可以发出命令 update 来更新专用候选配置。更新专用候选配置时,该配置将包含最近提交的配置的副本,其中合并了您的专用更改。
发出 update 命令时可能会发生合并冲突。
您还可以发出命令 rollback 来放弃专用候选配置更改并获取最近提交的配置。
Junos OS 演化版 不支持使用该 configure private 命令配置与第三方 YANG 数据模型(如 OpenConfig 数据模型或自定义 YANG 数据模型)对应的语句。
在机箱群集中发出命令 configure 时,系统会带您进入 configure private 模式。