Tip
This is the documentation for the 23.06 version. Looking for the documentation of the latest version? Have a look here.
Configuration Database¶
TNSR maintains three separate configuration databases: startup, candidate, and running. These files are stored as XML in plain text files.
- startup:
The configuration loaded when the host boots up.
Note
A restart of TNSR services is not the same as a reboot. If, for example, the clixon services are restarted, TNSR will still be using the running database.
- candidate:
An in-process potential configuration that exists while the TNSR configuration is being actively edited. When committed, this configuration will be accepted as the running configuration by TNSR if it is free of errors.
- running:
The active running configuration, which reflects the current state of TNSR.
Note
These databases are located in /var/tnsr/
on the host, but these files
are not intended to be accessed outside of TNSR.
The configuration database is managed using the configuration
command from
within config
mode.
See also
Configuration Backups for information on configuration backups.
Configuration History for information on working with the automatic configuration history feature.
Configuration Rollback for information on the timed configuration rollback feature.
Saving the Configuration¶
For changes to persist between reboots of the TNSR host, the running configuration must be copied to the startup configuration as shown in this example:
tnsr# configure
tnsr(config)# configuration copy running startup
There is a shortcut command for this specific operation as well, which may be familiar for certain users:
tnsr(config)# write
Viewing the Configuration¶
To view the configuration databases, use the show configuration
command
followed by the database name, for example:
tnsr# show configuration running
or:
tnsr# show conf run
The output format can be given after the database name using one of the following names:
- xml [(explicit|report-all)]:
XML format. The default output format, and the native format of the configuration databases.
The optional parameters control which information is returned by the command:
- explicit:
Only reports configuration items which have explicitly been configured by the user. This is the default behavior.
- report-all:
Report not only explicitly configured configuration values, but default values assumed by TNSR.
- json [(explicit|report-all)]:
JSON format, similar to the data format used by RESTCONF. The optional parameters work the same as they do for XML format noted previously.
- cli [<section>]:
Outputs a set of CLI commands which can be pasted back into a terminal to re-create the current configuration.
Tip
The
cli
format is useful for replicating parts of a configuration on another TNSR instance without restoring a full configuration database.When using the
cli
format, an optional configuration area name can limit the output to a certain portion of the database. For example, to show only the DHCP server configuration:tnsr# show configuration running cli kea dhcp4 enable dhcp4 server option domain-name data example.com exit description LAN DHCP Server lease persist true lease lfc-interval 0 interface listen LAN interface socket raw subnet 10.2.0.0/24 interface LAN option domain-name-servers data 10.2.0.1 exit option routers data 10.2.0.1 exit pool 10.2.0.129-10.2.0.191 exit exit exit
There is a shortcut command to view the CLI format output, which may be familiar for certain users:
tnsr(config)# show running-configuration
This command can be abbreviated to sh run
. Like its fully typed out
counterpart, the output can be limited by adding a section name to the end of
the command.
Reverting to the Startup Configuration¶
TNSR can also revert to the previously saved startup configuration to remove undesirable changes to the running configuration, should a regression in behavior occur.
For example:
tnsr# configure
tnsr(config)# configuration copy startup candidate
tnsr(config)# configuration candidate commit
tnsr(config)# exit
Warning
It is not possible to copy the startup configuration directly to the running configuration as that will not result in the settings being active. The configuration must be committed after copying to the candidate.
Configuration Database Commands¶
These brief examples show other available configuration database management commands.
Delete the candidate database entirely, which if committed will leave TNSR with an empty configuration:
tnsr(config)# configuration candidate clear
Commit changes made to the candidate database, which if successful will become the running database:
tnsr(config)# configuration candidate commit
Note
Nearly all changes made in the TNSR CLI will be committed automatically as commands are entered by the user. There is rarely a need to perform this step manually.
Discard the current candidate database to remove a change that has failed to validate, returning to the running configuration without the attempted changes:
tnsr(config)# configuration candidate discard
Attempt to validate the current candidate configuration to locate errors:
tnsr(config)# configuration candidate validate
Load a file from the host into the candidate database. The contents of the file can replace the candidate entirely, or merge a new section into an existing configuration. After loading, the candidate must be committed manually.
tnsr(config)# configuration candidate load <filename> [(replace|merge)]
Copy the candidate configuration to the startup configuration:
tnsr(config)# configuration copy candidate startup
Copy the running configuration to either the candidate or startup configuration:
tnsr(config)# configuration copy running (candidate|startup)
Copy the startup configuration to the candidate configuration:
tnsr(config)# configuration copy startup candidate
Save either the candidate or running configuration to a file on the host.
tnsr(config)# configuration save (candidate|running) <filename>
While not a configuration database command directly, the TNSR CLI automatically discards the candidate database if it fails to validate. This behavior can be changed using the following command:
tnsr(config)# no cli option auto-discard