Configure
命令概述
您(网络管理员)使用 configure
命令进入 CLI 配置模式。您也可使用它来收集其他信息,例如当前处于配置模式的其他用户。
命令的表 configure
单
Junos OS 支持三种形式的 configure
命令:configure
、 configure private
和 configure 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 so-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 so-3/0/0 unit 0 family inet]
在 configure exclusive
模式下,退出时,任何未提交的更改将被丢弃:
user@host>configure exclusive
warning: uncommitted changes will be discarded on exit Entering configuration mode [edit] user@host#set system host-name cool
[edit] user@host#quit
The configuration has been changed but not committed warning: Auto rollback on exiting 'configure exclusive' Discard uncommitted changes? [yes,no]yes
warning: discarding uncommitted changes load complete Exiting configuration mode
使用 yes
选项退出 configure exclusive
模式时, Junos OS 丢弃任何未提交的更改,并将配置回滚至先前提交的状态。该 no
选项允许您继续编辑或提交模式更改 configure exclusive
。
当一个用户退出 configure exclusive
模式,而另一个用户处于模式时 configure private
, Junos OS 请回滚私有模式会话中任何未提交的更改。
如果使用 命令进入配置模式 configure exclusive
并发出 commit confirmed
命令,但未在指定间隔内确认提交,则可能再次回滚。如果不在指定间隔内确认提交,将触发自动回滚。自动回滚之后,操作系统会从会话中卸下专属锁。因此,将显示错误消息“访问已被撤销”。出现此错误消息是因为会话不再是专属会话。这意味着配置已恢复到默认状态:任何有访问权限的人员都可以编辑配置、提交或同时提交配置。要重新锁定配置,必须再次使用 configure exclusive
命令。
user@host>configure exclusive
warning: uncommitted changes will be discarded on exit Entering configuration mode [edit] user@host#commit confirmed 1
commit 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#commit
error: access has been revoked. user@host#commit check
error: access has been revoked. user@host>configure exclusive
warning: uncommitted changes will be discarded on exit Entering configuration mode
如果您发起会 configure exclusive
话、发出 commit confirmed
命令并确认提交,则会话将保留专属锁定。您仍可在锁定的专属会话中继续更改配置。
user@host>configure exclusive
warning: uncommitted changes will be discarded on exit Entering configuration mode [edit] user@host#commit confirmed 1
commit 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#commit
commit complete
另请参阅
如何使用正确的配置
处于 configure private
模式时,必须使用最近提交的共享配置的副本。如果全局配置发生变化,您可以发出 update
命令更新您的专用候选配置。更新专用候选配置时,该配置包含最近提交的配置副本,您的私有更改合并在其中。
发出 update
命令时,可能会发生合并冲突。
您也可发出 rollback
命令,放弃专用候选配置更改并获取最近提交的配置。
Junos OS 不支持使用 configure private
命令配置对应于第三方 YANG 数据模型的语句,例如 OpenConfig 数据模型或自定义 YANG 数据模型。