命令 概述Configure
您(网络管理员)使用命令进入 CLI 配置模式。configure
您还可以使用它来收集其他信息,例如哪些其他用户当前处于配置模式。
命令的形式configure
Junos OS
支持三种形式的 命令:configure 、 和 。configure
configure private
configure exclusive
这些表单控制用户编辑和提交配置的方式。您可以使用此命令协调管理网络和设备配置的多个用户的工作。
命令 |
编辑权限 |
提交访问 |
---|---|---|
|
|
|
|
|
|
|
|
|
另请参阅
如何使用命令configure
最多 32 个用户可以同时在配置模式下工作;所有人都可以同时对配置进行更改。当您提交对配置的更改时,您可能会提交您和其他用户所做的更改的组合。因此,您必须跟踪与您处于配置模式的人员。
要查看当前以配置模式登录到同一设备的其他用户,请执行以下操作:
configure
如果其他用户处于配置模式,则显示的消息将指示用户是谁以及每个人正在查看或编辑的配置部分。
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
如果在另一个用户也处于配置模式并已锁定配置时进入配置模式,则会显示一条消息来标识该用户。该消息还标识用户正在查看或编辑的配置部分。例如,在以下示例中, 锁定配置以进行独占访问的用户为 1088:pid_number
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
不支持使用命令 配置第三方 YANG 数据模型(如 OpenConfig 数据模型或自定义 YANG 数据模型)对应的语句。Junos OSconfigure private