配置回退
2025/10/29大约 3 分钟
配置回退
网络需求
当网络管理员通过远程方式变更 FortiGate 配置时,错误的配置可能会造成访问丢失。这种情况下,需要在配置错误并失去访问连接的情况下,自动回退 FortiGate 配置到错误配置下发前的状态。
配置步骤
重要
强烈建议在修改设备关键配置(特别是与设备连通性相关的配置时),避免通过远程的方式进行操作。如果必须通过远程的方式进行操作,才考虑使用此方法。
在进行远程配置变更前,将 FortiGate 的配置保存方式设置为
revert,cfg-revert-timeout默认值为 600s。重要
在配置变更结束后,请将配置保存模式恢复为“自动”。

config system global set cfg-save revert set cfg-revert-timeout 600 end配置保存模式有以下 3 种:
Automatic(默认):配置更改会实时下发到 Memory 和 Flash。manual:配置更改只会下发到 Memory,不下发到 Flash,必须手动下发到 Flash 中(通过 GUI 或exe cfg save),未手动保存到 Flash 的配置将会在重启后丢失。修改配置后,会显示有配置未保存的提示,点击提示可以查看具体修改的配置内容。revert:配置更改只会下发到 Memory,不下发到 Flash。当配置更改后,如果在 cfg-revert-timeout 时间内未手动保存配置(通过 GUI 或exe cfg save),设备会 Reload 并恢复 Flash 中的原有配置文件(重启前 GUI 会提示相关告警信息提示手动保存配置)。配置文件 Reload 期间,设备业务会产生中断,所以在配置变更结束后,请将配置保存模式恢复为“自动”。
修改设备配置,例如修改接口 IP,查看修改接口前的 IP 地址如下。
config system interface edit "wan1" set ip 3.3.3.3 255.255.255.0 next end修改该接口 IP 到其他 IP 地址,此时配置会下发到内存中并生效,而不会下发到 Flash 中。
config system interface edit "wan1" set ip 4.3.3.3 255.255.255.0 next end如果 GUI 仍然可以访问,GUI 页面右上角会提示配置已变更,若未在 600s 内手动点击“保存阶段性更改”(或 CLI 执行
exe cfg save)将配置保存到 Flash 中,设备会 Reload 并恢复 Flash 中的原有配置。
假如步骤 3 为误操作,导致 FortiGate 无法远程管理,等待 600s 后,FortiGate 会重载(Reload,非重启设备)Flash 中的配置文件。可以看到 Reload 之后,接口 IP 恢复到修改之前的 IP 地址。
重要
- Reload 期间,设备业务会产生中断,所以在配置变更结束后,请将配置保存模式恢复为“自动”。
- 在 HA 环境下,所有 HA 成员都会同时执行 Reload。
config system interface edit "wan1" set ip 3.3.3.3 255.255.255.0 next end设备 Reload 期间的 Console 记录。
FortiGate # System will reload in the next 10 seconds... System will reload in the next 9 seconds... System will reload in the next 8 seconds... System will reload in the next 6 seconds... System will reload in the next 5 seconds... System will reload in the next 4 seconds... System will reload in the next 3 seconds... System will reload in the next 1 seconds... ...... FortiGate login: