在 Junos OS CLI 操作和配置模式之间切换
监控和配置运行 Junos OS 的设备时,可能需要在操作模式和配置模式之间切换。若切换为配置模式,命令提示符也会发生变化。操作模式提示符为右尖括号 (>),配置模式提示符为井号 (#)。
要在操作模式和配置模式之间切换:
- 登录设备并键入 cli 命令后,系统将自动进入操作模式:
--- JUNOS 17.2B1.8 built 2018-05-09 23:41:29 UTC % cli user@host>
- 要进入配置模式,请在 CLI 操作模式下键入 configure 命令或 edit 命令。方括号 ([edit]) 中的提示符,也称为 横幅,表示您处于层级结构顶层的配置编辑模式。例如:
user@host> configure Entering configuration mode [edit] user@host#
CLI 提示符从 user@host> 变为 user@host#,并出现横幅,以指示层次结构级别。
您可以通过下列任一方式返回到操作模式:
提交配置并退出:
[edit]user@host# commit and-quitcommit completeExiting configuration modeuser@host>退出而不提交:
[edit]user@host# exitExiting configuration modeuser@host>
- 要显示 show 等操作模式命令的输出,请在配置模式下,发出run 配置模式命令,然后指定操作模式命令:[edit]user@host# run operational-mode-command
例如,要在修改备份设备的 VRRP 配置时,显示当前设置的虚拟路由器冗余协议 (VRRP) 的主设备优先级值:
[edit interfaces xe-4/2/0 unit 0 family inet vrrp-group 27]user@host# showvirtual-address [ 192.168.1.15 ];[edit interfaces xe-4/2/0 unit 0 family inet vrrp-group 27]user@host# run show vrrp detailPhysical interface: xe-5/2/0, Unit: 0, Address: 192.168.29.10/24Interface state: up, Group: 10, State: backupPriority: 190, Advertisement interval: 3, Authentication type: simplePreempt: yes, VIP count: 1, VIP: 192.168.29.55Dead timer: 8.326, Master priority: 201, Master router: 192.168.29.254[edit interfaces xe-4/2/0 unit 0 family inet vrrp-group 27]user@host# set priority ...