> 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/5-candidate-configuration-part-2.md).

# 5) Candidate Configuration (Part 2)

### Pre-Work

From here on out, we will usually reset the lab by loading a configuration file from the git repo. Run the **load\_config\_on\_nodes.py** script on your containerlab server to do this. You must be in the main directory (`~/jncia-junos-labs`)

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

The script will load the config onto all nodes via HTTP.

```
clab@clab:~/jncia-junos-labs$ python3 load_config_on_nodes.py --lab_dir three-routers --config_filename basic.addressing.cfg
docker cp clab-three-routers-R1:/juniper.conf ./three-routers/lab_configs/R1/juniper.conf
docker cp clab-three-routers-R2:/juniper.conf ./three-routers/lab_configs/R2/juniper.conf
docker cp clab-three-routers-R3:/juniper.conf ./three-routers/lab_configs/R3/juniper.conf
10.200.255.3 - - [10/Jul/2026 13:10:14] "GET /three-routers/lab_configs/R2/juniper.conf HTTP/1.1" 200 -
10.200.255.2 - - [10/Jul/2026 13:10:14] "GET /three-routers/lab_configs/R1/juniper.conf HTTP/1.1" 200 -
10.200.255.4 - - [10/Jul/2026 13:10:14] "GET /three-routers/lab_configs/R3/juniper.conf HTTP/1.1" 200 -
10.200.255.3 - - [10/Jul/2026 13:10:15] "GET /three-routers/lab_configs/R2/basic.addressing.cfg HTTP/1.1" 200 -
10.200.255.2 - - [10/Jul/2026 13:10:15] "GET /three-routers/lab_configs/R1/basic.addressing.cfg HTTP/1.1" 200 -
10.200.255.4 - - [10/Jul/2026 13:10:15] "GET /three-routers/lab_configs/R3/basic.addressing.cfg HTTP/1.1" 200 -
clab@clab:~/jncia-junos-labs$ 
```

This process only takes a few seconds, and is much more streamlined than creating many different containerlab topology files, each with a different startup-config, which take a few minutes to boot every time.

### Lab

Connect to R1, make a change, but do not commit it.

```
admin@R1> configure 
Entering configuration mode

[edit]
admin@R1# set system host-name XYZ 

[edit]
admin@R1# 
```

Exit configuration mode **without retaining any changes you made**.

### Answer

<details>

<summary>Expand to reveal</summary>

We must use the rollback command to revert any changes we have made to the candidate configuration. We can either use `rollback 0`, to rollback the candidate config to the active config, or simply `rollback` for short. (`rollback` is a shortcut for `rollback 0`).

```
admin@R1# rollback 
load complete

[edit]
admin@R1# 
```

\
By using `show | compare` in configure mode, we can prove that there are no pending changes any longer:

```
admin@R1# show | compare 

[edit]
admin@R1# 

```

\
There is also a second way, which is manually deleting the configuration we have set using `delete` statements, or to `set` the configuration back to how it was before.

\
Below is an example where we would need to set the configuration back to how it was before:

```
admin@R1# set system host-name XYZ       

[edit]
admin@R1# show | compare              
[edit system]
-  host-name R1;
+  host-name XYZ;

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

[edit]
admin@R1# show | compare             

[edit]
admin@R1# 

```

\
Below is an example where we would use the `delete` command:

```
admin@R1# set system name-server 1.2.3.4    

[edit]
admin@R1# show | compare                    
[edit system]
+  name-server {
+      1.2.3.4;
+  }

[edit]
admin@R1# delete system name-server 

[edit]
admin@R1# show | compare               

[edit]
admin@R1# 

```

</details>

### Explanation

<details>

<summary>Expand to reveal</summary>

The default **configure** mode produces a shared candidate configuration file, as explained in the previous lab. The default behavior is that upon exiting, the staged but not-yet-committed changes are retained.

\
For this reason, you must be very careful when working with other team members. Make sure to revert any changes before exiting, so that someone else does not inadvertently commit your changes.

\
Junos warns you if you try to exit with uncommitted changes:

```
[edit]
admin@R1# exit 
The configuration has been changed but not committed
Exit with uncommitted changes? [yes,no] (yes) 

Exiting configuration mode

admin@R1> 
```

\
You will also see a warning if you enter **configure** mode and there are pending changes to the candidate config already.&#x20;

```
admin@R1> configure 
Entering configuration mode
The configuration has been changed but not committed

[edit]
admin@R1# 
```

\
These changes will also be displayed upon using `show | compare` in **configure** mode.

```
admin@R1> configure 
Entering configuration mode
The configuration has been changed but not committed

[edit]
admin@R1# show | compare 
[edit system]
-  host-name R1;
+  host-name XYZ;

[edit]
admin@R1# 
```

</details>

### Further Reading

<https://community.juniper.net/discussion/author-of-candidate-configuration>
