How to reset a FortiGate with the default factory settings/without losing management access
Description
This article tells you how to reset a FortiGate to its factory settings.
Scope
This command works on FortiGates and FortiProxys.
Solution
When you do this it clears all the changes you made to the FortiGate configuration. The system goes back to how it was when you first got it with the default factory settings.The FortiGate will still have the firmware version. The antivirus and IPS attack definitions will also stay the same.You can also reset the FortiGate to factory settings without losing access to manage it.If you want to reset the FortiGate to its factory defaults you can do it using the CLI interface. This will get rid of all your configurations. The FortiGate will be like new again, like when you took it out of the box. You will need to connect to the FortiGate to use it again.
1.Open an SSH to the system and execute the following command:
⦁ execute factoryreset
2.A warning will appear.
⦁ This operation will reset the system to factory default!
⦁ Do you want to continue? (y/n)
3.The system will reboot and load a basic configuration.
Note:
You will need a username and password to use it.If you forget your admin password check out the KB article to learn how to reset it:
Factory reset without losing management access.This option will reset the FortiGate to its factory settings.. Some settings will stay the same. These include VDOM, interface and static route settings.After resetting FortiGate will not have any firewall policies. It also will not have any IPsec settings.You can still access FortiGate remotely. You can use its IP address to do this.This option is only available, in CLI.To use it you need to open an SSH connection to the system.Then execute the following command:execute factoryreset2This operation will reset the FortiGate to factory settings except for a few specific sections related to VDOMs, interfaces, and static route settings. The following is a list of configuration sections that remain unchanged after using the factoryreset2 command:
⦁ system.global.vdom-mode
⦁ system.global.long-vdom-name
⦁ system.virtual-switch
⦁ system.interface
⦁ system.settings
⦁ router.static
⦁ router.static6
Do you want to continue? (y/n) --> This warning will appear after running the command.Since FortiOS v7.0, it is possible to keep the central management configurations after factory-reset. The command below resets the FortiGate to the factory default, except system.central-management.serial-number/system.central-management.fmg.execute factoryreset-for-central-managementThe following is an option in all versions:execute factoryreset-shutdown <- Reset to factory default and shutdown.
Note:
Keep a backup of the settings before you reset the unit to its factory settings. This is important if the unit was working well. You had set it up before.When you restart the FortiGate it will go back to its default settings. You will still be able to manage it. The default IP address for management is 192.168.1.99.All admin users will be. You can log in to the FortiGate using the default login details, which are admin with no password.After you reset the unit all the old logs will be deleted. The only logs that will be available are the ones that are created after the FortiGate restarts.If you cannot do the steps and want to reset the unit to its factory settings using a button on the outside then follow the instructions, in this KB article: