> For the complete documentation index, see [llms.txt](https://jncia-workbook.gitbook.io/workbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jncia-workbook.gitbook.io/workbook/junos-basics/7-recovery-configuration.md).

# 7) Recovery Configuration

### Pre-Work

If you made any changes, you can quickly revert the lab using the **load\_config\_on\_nodes.py** script.

```
python3 load_config_on_nodes.py --lab_dir three-routers --config_filename basic.addressing.cfg
```

### Lab

Connect to R1 and change the hostname to RECOVERY-MODE:

```
[edit]
admin@R1# set system host-name RECOVERY-MODE

[edit]
admin@R1# commit 
commit complete

[edit]
admin@RECOVERY-MODE# 
```

Save this config so that it will be loaded upon bootup if the active configuration becomes corrupted.

### Answer

<details>

<summary>Expand to reveal</summary>

In operational mode, use `request system configuration rescue save`

```
admin@RECOVERY-MODE> request system configuration rescue save    
Rescue configuration operation on re0
Success

admin@RECOVERY-MODE> 
```

\
You can view the rescue configuration using `show configuration rescue`

</details>

### Explanation

<details>

<summary>Expand to reveal</summary>

A rescue config is also known as a "backup config" or "known-good config." It can prevent the device from loading the factory-default config if the active config becomes corrupt.

\
By default, a rescue config does not exist. You must create it. When you create a rescue config, it is saved to `/config/rescue.conf.gz`.

\
This rescue configuration can be rolled back to via `rollback rescue`.

\
The rescue config is automatically loaded and committed as the active configuration upon bootup if the active configuration is corrupt or missing. The order of configuration is as follows, where the next stage is used if the current stage fails:

1. Active configuration (config #0)
2. Rescue configuration (if it exists)
3. Rollback #1 (the previous config)
4. Factory-default configuration

</details>

### Further Reading

<https://www.juniper.net/documentation/us/en/software/junos/junos-install-upgrade/topics/topic-map/rescue-and-recovery-config-file.html>
