diff options
-rw-r--r-- | docs/configuration-overview.rst | 820 | ||||
-rw-r--r-- | docs/image-mgmt.rst | 225 |
2 files changed, 690 insertions, 355 deletions
diff --git a/docs/configuration-overview.rst b/docs/configuration-overview.rst index 593fadfb..85abbfce 100644 --- a/docs/configuration-overview.rst +++ b/docs/configuration-overview.rst @@ -1,117 +1,143 @@ .. _configuration-overview: +###################### Configuration Overview -====================== +###################### -VyOS makes use of a unified configuration file for all system configuration: -`config.boot`. This allows for easy template creation, backup, and replication -of system configuration. - -The current active configuration -aka running configuration- can be viewed using the show configuration command. - -.. code-block:: none - - vyos@vyos:~$ show configuration - interfaces { - ethernet eth0 { - address dhcp - hw-id 00:0c:29:44:3b:0f - } - loopback lo { - } - } - service { - ssh { - port 22 - } - } - system { - config-management { - commit-revisions 20 - } - console { - device ttyS0 { - speed 9600 - } - } - login { - user vyos { - authentication { - encrypted-password **************** - } - level admin - } - } - ntp { - server 0.pool.ntp.org { - } - server 1.pool.ntp.org { - } - server 2.pool.ntp.org { - } - } - syslog { - global { - facility all { - level notice - } - facility protocols { - level debug - } - } - } - } - vyos@vyos:~$ - -By default the configuration is displayed in a hierarchy like the example above, -this is only one of the possible ways to display the configuration. - -When the configuration is generated and the device is configured, changes are added through a collection of `set` and `delete` commands. You can see that collection of commands by entering `show configuration commands`, which is another way of seeing the running configuration. - - -.. code-block:: none - - vyos@vyos:~$ show configuration commands - set interfaces ethernet eth0 address 'dhcp' - set interfaces ethernet eth0 hw-id '00:0c:29:44:3b:0f' - set interfaces loopback 'lo' - set service ssh port '22' - set system config-management commit-revisions '20' - set system console device ttyS0 speed '9600' - set system login user vyos authentication encrypted-password '<removed>' - set system login user vyos level 'admin' - set system ntp server '0.pool.ntp.org' - set system ntp server '1.pool.ntp.org' - set system ntp server '2.pool.ntp.org' - set system syslog global facility all level 'notice' - set system syslog global facility protocols level 'debug' - vyos@vyos:~$ - -Both these commands should be executed when in operational mode, they do not work in configuration mode. - - -Configuration terminology -------------------------- +VyOS makes use of a unified configuration file for the entire system's +configuration: ``/config/config.boot``. This allows easy template +creation, backup, and replication of system configuration. A system can +thus also be easily cloned by simply copying the required configuration +files. +Terminology +=========== +live A VyOS system has three major types of configurations: -Active or running configuration -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The active or running configuration is the system configuration that is loaded and currently being used by VyOS. Any change in the configuration will have to be committed to belong to the active/running configuration. - -Working configuration -^^^^^^^^^^^^^^^^^^^^^ -The working configuration is the configuration which is currently being modified in configuration mode. Changes made to the working configuration do not go into effect until the changes are committed with the `commit` command. At which time the working configuration will become the active or running configuration. - -Saved configuration -^^^^^^^^^^^^^^^^^^^ -A saved configuration is a configuration saved to a file using the `save` command. It allows you to keep safe a configuration for future uses. There can be multiple configuration files. The default or "boot" configuration is saved and loaded from the file config.boot. - - -Navigating in Configuration Mode ---------------------------------- -When entering the configuration mode you are navigating inside the tree structure exported in the overview above, -to enter configuration mode enter the command `configure` when in operational mode +* **Active** or **running configuration** is the system configuration + that is loaded and currently active (used by VyOS). Any change in + the configuration will have to be committed to belong to the + active/running configuration. + +* **Working configuration** is the one that is currently being modified + in configuration mode. Changes made to the working configuration do + not go into effect until the changes are committed with the + :cfgcmd:`commit` command. At which time the working configuration will + become the active or running configuration. + +* **Saved configuration** is the one saved to a file using the + :cfgcmd:`save` command. It allows you to keep safe a configuration for + future uses. There can be multiple configuration files. The default or + "boot" configuration is saved and loaded from the file + ``/config/config.boot``. + +Seeing and navigating the configuration +======================================= + +.. opcmd:: show configuration + + View the current active configuration, also known as the running + configuration, from the operational mode. + + .. code-block:: none + + vyos@vyos:~$ show configuration + interfaces { + ethernet eth0 { + address dhcp + hw-id 00:53:00:00:aa:01 + } + loopback lo { + } + } + service { + ssh { + port 22 + } + } + system { + config-management { + commit-revisions 20 + } + console { + device ttyS0 { + speed 9600 + } + } + login { + user vyos { + authentication { + encrypted-password **************** + } + level admin + } + } + ntp { + server 0.pool.ntp.org { + } + server 1.pool.ntp.org { + } + server 2.pool.ntp.org { + } + } + syslog { + global { + facility all { + level notice + } + facility protocols { + level debug + } + } + } + } + +By default, the configuration is displayed in a hierarchy like the above +example, this is only one of the possible ways to display the +configuration. When the configuration is generated and the device is +configured, changes are added through a collection of :cfgcmd:`set` and +:cfgcmd:`delete` commands. + +.. opcmd:: show configuration commands + + Get a collection of all the set commands required which led to the + running configuration. + + .. code-block:: none + + vyos@vyos:~$ show configuration commands + set interfaces ethernet eth0 address 'dhcp' + set interfaces ethernet eth0 hw-id '00:53:dd:44:3b:0f' + set interfaces loopback 'lo' + set service ssh port '22' + set system config-management commit-revisions '20' + set system console device ttyS0 speed '9600' + set system login user vyos authentication encrypted-password '$6$Vt68...QzF0' + set system login user vyos level 'admin' + set system ntp server '0.pool.ntp.org' + set system ntp server '1.pool.ntp.org' + set system ntp server '2.pool.ntp.org' + set system syslog global facility all level 'notice' + set system syslog global facility protocols level 'debug' + +Both these ``show`` commands should be executed when in operational +mode, they do not work directly in configuration mode. There is a +special way on how to :ref:`run_opmode_from_config_mode`. + +.. hint:: Use the ``show configuration commands | strip-private`` + command when you want to hide private data. You may want to do so if + you want to share your configuration on the `forum`_. + +.. _`forum`: https://forum.vyos.io + + +The config mode +--------------- + +When entering the configuration mode you are navigating inside a tree +structure, to enter configuration mode enter the command +:opcmd:`configure` when in operational mode. .. code-block:: none @@ -119,11 +145,17 @@ to enter configuration mode enter the command `configure` when in operational mo [edit] vyos@vyos# -.. note:: When going into configuration mode, prompt changes from *$* to *#*. To exit configuration mode, type `exit`. -All commands executed here are relative to the configuration level you have entered. You can do everything from the top level, but commands will be quite lengthy when manually typing them. +.. note:: When going into configuration mode, prompt changes from + ``$`` to ``#``. + + +All commands executed here are relative to the configuration level you +have entered. You can do everything from the top level, but commands +will be quite lengthy when manually typing them. -To change the current hierarchy level use the command: `edit` +The current hierarchy level can be changed by the :cfgcmd:`edit` +command. .. code-block:: none @@ -133,13 +165,19 @@ To change the current hierarchy level use the command: `edit` [edit interfaces ethernet eth0] vyos@vyos# -You are now in a sublevel relative to `interfaces ethernet eth0`, -all commands executed from this point on are relative to this sublevel. -Use either the `top` or `exit` command to go back to the top of the hierarchy. You can also use the `up` command to move only one level up at a time. +You are now in a sublevel relative to ``interfaces ethernet eth0``, all +commands executed from this point on are relative to this sublevel. Use +eithe the :cfgcmd:`top` or :cfgcmd:`exit` command to go back to the top +of the hierarchy. You can also use the :cfgcmd:`up` command to move only +one level up at a time. -The `show` command within configuration mode will show the working configuration -indicating line changes with `+` for additions, `>` for replacements and `-` for deletions. +.. cfgcmd:: show +The :cfgcmd:`show` command within configuration mode will show the +working configuration indicating line changes with ``+`` for additions, +``>`` for replacements and ``-`` for deletions. + +**Example:** .. code-block:: none @@ -149,7 +187,7 @@ indicating line changes with `+` for additions, `>` for replacements and `-` for ethernet eth0 { description MY_OLD_DESCRIPTION disable - hw-id 52:54:00:0e:82:d9 + hw-id 00:53:dd:44:3b:03 } loopback lo { } @@ -165,31 +203,34 @@ indicating line changes with `+` for additions, `>` for replacements and `-` for + address dhcp > description MY_NEW_DESCRIPTION - disable - hw-id 52:54:00:0e:82:d9 + hw-id 00:53:dd:44:3b:03 } loopback lo { } - [edit] - vyos@vyos# -It is also possible to display all `set` commands within configuration mode using `show | commands` +It is also possible to display all `set` commands within configuration +mode using :cfgcmd:`show | commands` .. code-block:: none vyos@vyos# show interfaces ethernet eth0 | commands set address dhcp - set hw-id 00:0c:29:44:3b:0f + set hw-id 00:53:ad:44:3b:03 -These commands are also relative to the level you are inside and only relevant configuration blocks will be displayed when entering a sub-level. +These commands are also relative to the level you are inside and only +relevant configuration blocks will be displayed when entering a +sub-level. .. code-block:: none [edit interfaces ethernet eth0] vyos@vyos# show address dhcp - hw-id 00:0c:29:44:3b:0f + hw-id 00:53:ad:44:3b:03 -Exiting from the configuration mode is done via the `exit` command from the top level, executing `exit` from within a sub-level takes you back to the top level. +Exiting from the configuration mode is done via the :cfgcmd:`exit` +command from the top level, executing :cfgcmd:`exit` from within a +sub-level takes you back to the top level. .. code-block:: none @@ -198,229 +239,458 @@ Exiting from the configuration mode is done via the `exit` command from the top [edit] vyos@vyos# exit Warning: configuration changes have not been saved. - vyos@vyos:~$ +Editing the configuration +========================= + +The configuration can be edited by the use of :cfgcmd:`set` and +:cfgcmd:`delete` commands from within configuration mode. -Managing the configuration --------------------------- +.. cfgcmd:: set -The configuration is managed by the use of `set` and `delete` commands from within configuration mode. -Configuration commands are flattened from the tree into 'one-liner' commands shown in `show configuration commands` from operation mode. + Use this command to set the value of a parameter or to create a new + element. -These commands are also relative to the level where they are executed and all redundant information from the current level is removed from the command entered. +Configuration commands are flattened from the tree into 'one-liner' +commands shown in :opcmd:`show configuration commands` from operation +mode. Commands are relative to the level where they are executed and all +redundant information from the current level is removed from the command +entered. .. code-block:: none [edit] - vyos@vyos# set interface ethernet eth0 address 203.0.113.6/24 + vyos@vyos# set interface ethernet eth0 address 192.0.2.100/24 + + +.. code-block:: none [edit interfaces ethernet eth0] vyos@vyos# set address 203.0.113.6/24 -These two commands above are essentially the same, just executed from different levels in the hierarchy. -To delete a configuration entry use the `delete` command, this also deletes all sub-levels under the current level you've specified in the `delete` command. -Deleting an entry will also result in the element reverting back to its default value if one exists. +These two commands above are essentially the same, just executed from +different levels in the hierarchy. -.. code-block:: none +.. cfgcmd:: delete - [edit interfaces ethernet eth0] - vyos@vyos# delete address 203.0.113.6/24 + To delete a configuration entry use the :cfgcmd:`delete` command, + this also deletes all sub-levels under the current level you've + specified in the :cfgcmd:`delete` command. Deleting an entry will + also result in the element reverting back to its default value if one + exists. -Any change you do on the configuration, will not take effect until committed using the `commit` command in configuration mode. + .. code-block:: none -.. code-block:: none + [edit interfaces ethernet eth0] + vyos@vyos# delete address 192.0.2.100/24 - vyos@vyos# commit - [edit] - vyos@vyos# exit - Warning: configuration changes have not been saved. - vyos@vyos:~$ +.. cfgcmd:: commit -In order to preserve configuration changes upon reboot, the configuration must -also be saved once applied. This is done using the `save` command in -configuration mode. + Any change you do on the configuration, will not take effect until + committed using the :cfgcmd:`commit` command in configuration mode. -.. code-block:: none + .. code-block:: none - vyos@vyos# save - Saving configuration to '/config/config.boot'... - Done - [edit] - vyos@vyos# + vyos@vyos# commit + [edit] + vyos@vyos# exit + Warning: configuration changes have not been saved. + vyos@vyos:~$ +.. cfgcmd:: save -Configuration mode can not be exited while uncommitted changes exist. To exit -configuration mode without applying changes, the exit discard command can be -used. + In order to preserve configuration changes upon reboot, the + configuration must also be saved once applied. This is done using the + :cfgcmd:`save` command in configuration mode. -.. code-block:: none + .. code-block:: none - vyos@vyos# exit - Cannot exit: configuration modified. - Use 'exit discard' to discard the changes and exit. - [edit] - vyos@vyos# exit discard - exit - vyos@vyos:~$ + vyos@vyos# save + Saving configuration to '/config/config.boot'... + Done + .. code-block:: none + vyos@vyos# save [tab] + Possible completions: + <Enter> Save to system config file + <file> Save to file on local machine + scp://<user>:<passwd>@<host>/<file> Save to file on remote machine + ftp://<user>:<passwd>@<host>/<file> Save to file on remote machine + tftp://<host>/<file> Save to file on remote machine + vyos@vyos# save tftp://192.168.0.100/vyos-test.config.boot + Saving configuration to 'tftp://192.168.0.100/vyos-test.config.boot'... + ######################################################################## 100.0% + Done -.. code-block:: none +.. cfgcmd:: exit [discard] - vyos@vyos# save [tab] - Possible completions: - <Enter> Save to system config file - <file> Save to file on local machine - scp://<user>:<passwd>@<host>/<file> Save to file on remote machine - ftp://<user>:<passwd>@<host>/<file> Save to file on remote machine - tftp://<host>/<file> Save to file on remote machine - vyos@vyos# save tftp://192.168.0.100/vyos-test.config.boot - Saving configuration to 'tftp://192.168.0.100/vyos-test.config.boot'... - ######################################################################## 100.0% - Done + Configuration mode can not be exited while uncommitted changes exist. + To exit configuration mode without applying changes, the + :cfgcmd:`exit discard` command must be used. -Operational info from config mode ---------------------------------- + All changes in the working config will thus be lost. -When inside configuration mode you are not directly able to execute operational commands. + .. code-block:: none -Access to these commands are possible through the use of the `run [command]` command. -From this command you will have access to everything accessible from operational mode. + vyos@vyos# exit + Cannot exit: configuration modified. + Use 'exit discard' to discard the changes and exit. + [edit] + vyos@vyos# exit discard -Command completion and syntax help with `?` and `[tab]` will also work. -.. code-block:: none +.. cfgcmd:: commit-confirm - [edit] - vyos@vyos# run show interfaces - Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down - Interface IP Address S/L Description - --------- ---------- --- ----------- - eth0 0.0.0.0/0 u/u + Commit the current set of changes if ``confirm`` is also entered + within 10 minutes. Otherwise the system reboot into the previous + configuration. -Configuration archive ---------------------- + What if you are doing something dangerous? Suppose you want to setup + a firewall, and you are not sure there are no mistakes that will lock + you out of your system. You can use confirmed commit. If you issue + the ``commit-confirm`` command, your changes will be commited, and if + you don't issue issue the ``confirm`` command in 10 minutes, your + system will reboot into previous config revision. -VyOS automatically maintains backups of previous configurations. + .. code-block:: none + + vyos@router# set interfaces ethernet eth0 firewall local name FromWorld + vyos@router# commit-confirm + commit confirm will be automatically reboot in 10 minutes unless confirmed + Proceed? [confirm]y + [edit] + vyos@router# confirm + [edit] -Local archive and revisions -^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Revisions are stored on disk. You can view them, compare them, and rollback to previous revisions if anything goes wrong. + .. note:: A reboot because you did not enter ``confirm`` will not + take you necessarily to the *saved configuration*, but to the + point before the unfortunate commit. -To view existing revisions, use `show system commit` operational mode command. -.. code-block:: none +.. cfgcmd:: copy + + Copy a configuration element. + + You can copy and remove configuration subtrees. Suppose you set up a + firewall ruleset ``FromWorld`` with one rule that allows traffic from + specific subnet. Now you want to setup a similar rule, but for + different subnet. Change your edit level to + ``firewall name FromWorld`` and use ``copy rule 10 to rule 20``, then + modify rule 20. - vyos@vyos-test-2# run show system commit - 0 2015-03-30 08:53:03 by vyos via cli - 1 2015-03-30 08:52:20 by vyos via cli - 2 2015-03-26 21:26:01 by root via boot-config-loader - 3 2015-03-26 20:43:18 by root via boot-config-loader - 4 2015-03-25 11:06:14 by root via boot-config-loader - 5 2015-03-25 01:04:28 by root via boot-config-loader - 6 2015-03-25 00:16:47 by vyos via cli - 7 2015-03-24 23:43:45 by root via boot-config-loader -To compare configuration revisions in configuration mode, use the compare command: + .. code-block:: none + + vyos@router# show firewall name FromWorld + default-action drop + rule 10 { + action accept + source { + address 203.0.113.0/24 + } + } + [edit] + vyos@router# edit firewall name FromWorld + [edit firewall name FromWorld] + vyos@router# copy rule 10 to rule 20 + [edit firewall name FromWorld] + vyos@router# set rule 20 source address 198.51.100.0/24 + [edit firewall name FromWorld] + vyos@router# commit + [edit firewall name FromWorld] + + +.. cfgcmd:: rename + + Rename a configuration element. + + You can also rename config subtrees: + + .. code-block:: none + + vyos@router# rename rule 10 to rule 5 + [edit firewall name FromWorld] + vyos@router# commit + [edit firewall name FromWorld] + + Note that ``show`` command respects your edit level and from this + level you can view the modified firewall ruleset with just ``show`` + with no parameters. + + .. code-block:: none + + vyos@router# show + default-action drop + rule 5 { + action accept + source { + address 203.0.113.0/24 + } + } + rule 20 { + action accept + source { + address 198.51.100.0/24 + } + } + + +.. cfgcmd:: comment <config node> "comment text" + + Add comment as an annotation to a configuration node. + + The ``comment`` command allows you to insert a comment above the + ``<config node>`` configuration section. When shown, comments are + enclosed with ``/*`` and ``*/`` as open/close delimiters. Comments + need to be commited, just like other config changes. + + To remove an existing comment from your current configuration, + specify an empty string enclosed in double quote marks (``""``) as + the comment text. + + Example: + + .. code-block:: none + + vyos@vyos# comment firewall all-ping "Yes I know this VyOS is cool" + vyos@vyos# commit + vyos@vyos# show + firewall { + /* Yes I know this VyOS is cool */ + all-ping enable + broadcast-ping disable + ... + } + + .. note:: An important thing to note is that since the comment is + added on top of the section, it will not appear if the ``show + <section>`` command is used. With the above example, the `show + firewall` command would return starting after the ``firewall + {`` line, hiding the comment. -.. code-block:: none - vyos@vyos# compare [tab] - Possible completions: - <Enter> Compare working & active configurations - saved Compare working & saved configurations - <N> Compare working with revision N - <N> <M> Compare revision N with M - Revisions: - 0 2013-12-17 20:01:37 root by boot-config-loader - 1 2013-12-13 15:59:31 root by boot-config-loader - 2 2013-12-12 21:56:22 vyos by cli - 3 2013-12-12 21:55:11 vyos by cli - 4 2013-12-12 21:27:54 vyos by cli - 5 2013-12-12 21:23:29 vyos by cli - 6 2013-12-12 21:13:59 root by boot-config-loader - 7 2013-12-12 16:25:19 vyos by cli - 8 2013-12-12 15:44:36 vyos by cli - 9 2013-12-12 15:42:07 root by boot-config-loader - 10 2013-12-12 15:42:06 root by init - [edit] - vyos@vyos# -Comparing Revisions -""""""""""""""""""" + -You can compare revisions with `compare X Y` command, where X and Y are revision numbers. The output will describe how the configuration X is when compared to Y, indicating with a plus sign (**+**) the additional parts X has when compared to y, and indicating with a minus sign (**-**) the lacking parts x misses when compared to y. +.. _run_opmode_from_config_mode: -.. code-block:: none +Access opmode from config mode +============================== - vyos@vyos-test-2# compare 0 6 - [edit interfaces] - +dummy dum1 { - + address 10.189.0.1/31 - +} - [edit interfaces ethernet eth0] - +vif 99 { - + address 10.199.0.1/31 - +} - -vif 900 { - - address 192.0.2.4/24 - -} +When inside configuration mode you are not directly able to execute +operational commands. + +.. cfgcmd:: run + + Access to these commands are possible through the use of the + ``run [command]`` command. From this command you will have access to + everything accessible from operational mode. + + Command completion and syntax help with ``?`` and ``[tab]`` will also + work. + + .. code-block:: none + + [edit] + vyos@vyos# run show interfaces + Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down + Interface IP Address S/L Description + --------- ---------- --- ----------- + eth0 0.0.0.0/0 u/u + +Managing configurations +======================= + +VyOS comes with an integrated versioning system for the system +configuration. It automatically maintains a backup of every previous +configuration which has been committed to the system. The configurations +are versioned locally for rollback but they can also be stored on a +remote host for archiving/backup reasons. + +Local Archive +------------- + +Revisions are stored on disk. You can view, compare and rollback them to +any previous revisions if something goes wrong. + +.. opcmd:: show system commit + + View all existing revisions on the local system. + + .. code-block:: none + + vyos@vyos:~$ show system commit + 0 2015-03-30 08:53:03 by vyos via cli + 1 2015-03-30 08:52:20 by vyos via cli + 2 2015-03-26 21:26:01 by root via boot-config-loader + 3 2015-03-26 20:43:18 by root via boot-config-loader + 4 2015-03-25 11:06:14 by root via boot-config-loader + 5 2015-03-25 01:04:28 by root via boot-config-loader + 6 2015-03-25 00:16:47 by vyos via cli + 7 2015-03-24 23:43:45 by root via boot-config-loader + + +.. cfgcmd:: set system config-management commit-revisions <N> + + You can specify the number of revisions stored on disk. N can be in + the range of 0 - 65535. When the number of revisions exceeds the + configured value, the oldest revision is removed. The default setting + for this value is to store 100 revisions locally. + + +Compare configurations +---------------------- + +VyOS lets you compare different configurations. + +.. cfgcmd:: compare <saved | N> <M> -Rolling Back Changes -"""""""""""""""""""" + Use this command to spot what the differences are between different + configurations. -You can rollback configuration using the rollback command. This -command will apply the selected revision and trigger a system reboot. + .. code-block:: none + + vyos@vyos# compare [tab] + Possible completions: + <Enter> Compare working & active configurations + saved Compare working & saved configurations + <N> Compare working with revision N + <N> <M> Compare revision N with M + Revisions: + 0 2013-12-17 20:01:37 root by boot-config-loader + 1 2013-12-13 15:59:31 root by boot-config-loader + 2 2013-12-12 21:56:22 vyos by cli + 3 2013-12-12 21:55:11 vyos by cli + 4 2013-12-12 21:27:54 vyos by cli + 5 2013-12-12 21:23:29 vyos by cli + 6 2013-12-12 21:13:59 root by boot-config-loader + 7 2013-12-12 16:25:19 vyos by cli + 8 2013-12-12 15:44:36 vyos by cli + 9 2013-12-12 15:42:07 root by boot-config-loader + 10 2013-12-12 15:42:06 root by init + + The command :cfgcmd:`compare` allows you to compare different type of + configurations. It also lets you compare different revisions through + the :cfgcmd:`compare N M` command, where N and M are revision + numbers. The output will describe how the configuration N is when + compared to M indicating with a plus sign (``+``) the additional + parts N has when compared to M, and indicating with a minus sign + (``-``) the lacking parts N misses when compared to M. + + .. code-block:: none + + vyos@vyos# compare 0 6 + [edit interfaces] + +dummy dum1 { + + address 10.189.0.1/31 + +} + [edit interfaces ethernet eth0] + +vif 99 { + + address 10.199.0.1/31 + +} + -vif 900 { + - address 192.0.2.4/24 + -} + + +.. opcmd:: show system commit diff <number> + + Show commit revision difference. + + +The command above also lets you see the difference between two commits. +By default the difference with the running config is shown. .. code-block:: none - vyos@vyos# compare 1 - [edit system] - >host-name vyos-1 - [edit] - vyos@vyos# rollback 1 - Proceed with reboot? [confirm][y] - Broadcast message from root@vyos-1 (pts/0) (Tue Dec 17 21:07:45 2013): - The system is going down for reboot NOW! - [edit] - vyos@vyos# + vyos@router# run show system commit diff 4 + [edit system] + +ipv6 { + + disable-forwarding + +} + +This means four commits ago we did ``set system ipv6 disable-forwarding``. -Configuring the archive size -"""""""""""""""""""""""""""" -You can specify the number of revisions stored on disk with `set system config-management commit-revisions X`, where X is a number between 0 and 65535. When the number of revisions exceeds that number, the oldest revision is removed. -Remote archive -^^^^^^^^^^^^^^ -VyOS can copy the config to a remote location after each commit. TFTP, FTP, and SFTP servers are supported. +Rollback Changes +---------------- -You can specify the location with: +You can rollback configuration changes using the rollback command. This +willn apply the selected revision and trigger a system reboot. -* `set system config-management commit-archive location URL` +.. cfgcmd:: rollback <N> -For example, `set system config-management commit-archive location tftp://10.0.0.1/vyos`. + Rollback to revision N (currently requires reboot) -You can specify the location with `set system config-management commit-archive location URL` command, e.g. `set system config-management commit-archive location tftp://10.0.0.1/vyos`. + .. code-block:: none -Wipe config and restore default -------------------------------- + vyos@vyos# compare 1 + [edit system] + >host-name vyos-1 + [edit] -In the case you want to completely delete your configuration and restore the default one, you can enter the following command in configuration mode: + vyos@vyos# rollback 1 + Proceed with reboot? [confirm][y] + Broadcast message from root@vyos-1 (pts/0) (Tue Dec 17 21:07:45 2013): + The system is going down for reboot NOW! + +Remote Archive +-------------- + +VyOS can upload the configuration to a remote location after each call +to :cfgcmd:`commit`. You will have to set the commit-archive location. +TFTP, FTP, SCP and SFTP servers are supported. Every time a +:cfgcmd:`commit` is successfull the ``config.boot`` file will be copied +to the defined destination(s). The filename used on the remote host will +be ``config.boot-hostname.YYYYMMDD_HHMMSS``. + +.. cfgcmd:: set system config-management commit-archive location <URI> + + Specify remote location of commit archive as any of the below + :abbr:`URI (Uniform Resource Identifier)` + + * ``scp://<user>:<passwd>@<host>/<dir>`` + * ``sftp://<user>:<passwd>@<host>/<dir>`` + * ``ftp://<user>:<passwd>@<host>/<dir>`` + * ``tftp://<host>/<dir>`` + +.. note:: The number of revisions don't affect the commit-archive. + +.. note:: You may find VyOS not allowing the secure connection because + it cannot verify the legitimacy of the remote server. You can use + the workaround below to quickly add the remote host's SSH + fingerprint to your ``~/.ssh/known_hosts`` file: + + .. code-block:: none + + vyos@vyos# ssh-keyscan <host> >> ~/.ssh/known_hosts + +Restore Default +--------------- + +In the case you want to completely delete your configuration and restore +the default one, you can enter the following command in configuration +mode: .. code-block:: none load /opt/vyatta/etc/config.boot.default +You will be asked if you want to continue. If you accept, you will have +to use :cfgcmd:`commit` if you want to make the changes active. -You will be asked if you want to continue. If you accept, you will have to use `commit` if you want to make the changes active. - -Then you may want to `save` in order to delete the saved configuration too. +Then you may want to :cfgcmd:`save` in order to delete the saved +configuration too. -.. note:: If you are remotely connected, you will lose your connection. You may want to copy first the config, edit it to ensure connectivity, and load the edited config. +.. note:: If you are remotely connected, you will lose your connection. + You may want to copy first the config, edit it to ensure + connectivity, and load the edited config. diff --git a/docs/image-mgmt.rst b/docs/image-mgmt.rst index ecef997d..143d02b2 100644 --- a/docs/image-mgmt.rst +++ b/docs/image-mgmt.rst @@ -1,7 +1,8 @@ .. _image-mgmt: -System Image Management -======================= +################ +Image Management +################ The VyOS image-based installation is implemented by creating a directory for each image on the storage device selected during the install process. @@ -17,112 +18,176 @@ The directory structure of the boot device: The image directory contains the system kernel, a compressed image of the root filesystem for the OS, and a directory for persistent storage, such as -configuration. - -On boot, the system will extract the OS image into memory and mount the -appropriate live-rw sub-directories to provide persistent storage system -configuration. +configuration. On boot, the system will extract the OS image into memory and +mount the appropriate live-rw sub-directories to provide persistent storage +system configuration. This process allows for a system to always boot to a known working state, as the OS image is fixed and non-persistent. It also allows for multiple releases -of VyOS to be installed on the same storage device. +of VyOS to be installed on the same storage device. The image can be selected +manually at boot if needed, but the system will otherwise boot the image +configured to be the default. -The image can be selected manually at boot if needed, but the system will -otherwise boot the image configured to be the default. +.. opcmd:: show system image -The default boot image can be set using the :code:`set system image -default-boot` command in operational mode. + List all available system images which can be bootet on the current system. -A list of available images can be shown using the :code:`show system image` -command in operational mode. + .. code-block:: none -.. code-block:: none + vyos@vyos:~$ show system image + The system currently has the following image(s) installed: - vyos@vyos:~$ show system image - The system currently has the following image(s) installed: + 1: 1.2.0-rolling+201810021347 (default boot) + 2: 1.2.0-rolling+201810021217 + 3: 1.2.0-rolling+201809252218 - 1: 1.2.0-rolling+201810021347 (default boot) - 2: 1.2.0-rolling+201810021217 - 3: 1.2.0-rolling+201809280337 - 4: 1.2.0-rolling+201809252218 - 5: 1.2.0-rolling+201809192034 - 6: 1.2.0-rolling+201809191744 - 7: 1.2.0-rolling+201809150337 - 8: 1.2.0-rolling+201809141130 - 9: 1.2.0-rolling+201809140949 - 10: 1.2.0-rolling+201809131722 - vyos@vyos:~$ +.. opcmd:: delete system image [image-name] + + Delete no longer needed images from the system. You can specify an optional + image name to delete, the image name can be retrieved via a list of available + images can be shown using the :opcmd:`show system image`. + + .. code-block:: none + + vyos@vyos:~$ delete system image + The following image(s) can be deleted: + + 1: 1.3-rolling-201912181733 (default boot) (running image) + 2: 1.3-rolling-201912180242 + 3: 1.2.2 + 4: 1.2.1 + + Select the image to delete: 2 + + Are you sure you want to delete the + "1.3-rolling-201912180242" image? (Yes/No) [No]: y + Deleting the "1.3-rolling-201912180242" image... + Done + +.. opcmd:: show version + + Show current system image version. + + .. code-block:: none + + vyos@vyos:~$ show version + Version: VyOS 1.3-rolling-201912181733 + Built by: autobuild@vyos.net + Built on: Wed 18 Dec 2019 17:33 UTC + Build UUID: bccde2c3-261c-49cc-b421-9b257204e06c + Build Commit ID: f7ce0d8a692f2d + + Architecture: x86_64 + Boot via: installed image + System type: bare metal + + Hardware vendor: VMware, Inc. + Hardware model: VMware Virtual Platform + Hardware S/N: VMware-42 1d 83 b9 fe c1 bd b2-7d 3d 49 db 94 18 f5 c9 + Hardware UUID: b9831d42-c1fe-b2bd-7d3d-49db9418f5c9 + + Copyright: VyOS maintainers and contributors -Images no longer needed can be removed using the :code:`delete system image` -command. .. _update_vyos: Update VyOS ------------ +=========== -Finally, new system images can be added using the :code:`add system image` command. -The add image command will extract the image from the release ISO (either on -the local filesystem or remotely if a URL is provided). The image install -process will prompt you to use the current system configuration and SSH -security keys, allowing for the new image to boot using the current -configuration. +New system images can be added using the :opcmd:`add system image` +command. The command will extract the chosen image and will prompt you +to use the current system configuration and SSH security keys, allowing +for the new image to boot using the current configuration. -.. code-block:: none +.. note:: Only LTS releases are PGP-signed. + +.. opcmd:: add system image <url | path> [vrf name] [username user [password pass]] + + Use this command to install a new system image. You can reach the + image from the web (http://, https://) or from your local system, + e.g. /tmp/vyos-1.2.3-amd64.iso. + + The `add system image` command also supports installing new versions + of VyOS through an optional given VRF. Also if URL in question requires + authentication, you can specify an optional username and password via + the commandline which will be passed as "Basic-Auth" to the server. - vyos@vyos:~$ add system image https://downloads.vyos.io/rolling/current/amd64/vyos-1.2.0-rolling%2B201810030440-amd64.iso - Trying to fetch ISO file from https://downloads.vyos.io/rolling/current/amd64/vyos-1.2.0-rolling%2B201810030440-amd64.iso - % Total % Received % Xferd Average Speed Time Time Time Current - Dload Upload Total Spent Left Speed - 100 338M 100 338M 0 0 3837k 0 0:01:30 0:01:30 --:--:-- 3929k - ISO download succeeded. - Checking for digital signature file... - % Total % Received % Xferd Average Speed Time Time Time Current - Dload Upload Total Spent Left Speed - 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 - curl: (22) The requested URL returned error: 404 Not Found +If there is not enough **free disk space available**, the installation +will be canceled. To delete images use the :opcmd:`delete system image` +command. - Unable to fetch digital signature file. - Do you want to continue without signature check? (yes/no) [yes] - Checking MD5 checksums of files on the ISO image...OK. - Done! +VyOS configuration is associated to each image, and **each image has a +unique copy of its configuration**. This is different than a traditional +network router where the configuration is shared across all images. - What would you like to name this image? [1.2.0-rolling+201810030440]: +.. note:: If you have any personal files, like some scripts you created, + and you don't want them to be lost during the upgrade, make sure + those files are stored in ``/config`` as this directory is always copied + to newer installed images. - OK. This image will be named: 1.2.0-rolling+201810030440 - We do not have enough disk space to install this image! - We need 344880 KB, but we only have 17480 KB. - Exiting... +You can access files from a previous installation and copy them to your +current image if they were located in the ``/config`` directory. This +can be done using the :opcmd:`copy` command. So, for instance, in order +to copy ``/config/config.boot`` from VyOS 1.2.1 image, you would use the +following command: -.. note:: Rolling releases are not GPG signed, only the real release build - will have a proper GPG signature. +.. code:: -.. note:: VyOS configuration is associated to each image, and each image has - a unique copy of its configuration. This is different than a traditional - network router where the configuration is shared across all images. + copy file 1.2.1://config/config.boot to /tmp/config.boot.1.2.1 -If you need some files from a previous images - take a look inside a -:code:`/live` directory. -After reboot you might want to verify the version you are running with :code:`show version` +Example +""""""" .. code-block:: none - vyos@vyos:~$ show version - Version: VyOS 1.2.0-rolling+201810030440 - Built by: autobuild@vyos.net - Built on: Mon 10 Mar 2018 03:37 UTC - Build UUID: 2ed16684-875c-4a19-8a34-1b03099eed35 - Build Commit ID: 3305dca496d814 + vyos@vyos:~$ add system image https://downloads.vyos.io/rolling/current/amd64/vyos-rolling-latest.iso + Trying to fetch ISO file from https://downloads.vyos.io/rolling/current/amd64/vyos-rolling-latest.iso + % Total % Received % Xferd Average Speed Time Time Time Current + Dload Upload Total Spent Left Speed + 100 338M 100 338M 0 0 3837k 0 0:01:30 0:01:30 --:--:-- 3929k + ISO download succeeded. + Checking for digital signature file... + % Total % Received % Xferd Average Speed Time Time Time Current + Dload Upload Total Spent Left Speed + 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 + curl: (22) The requested URL returned error: 404 Not Found + + Unable to fetch digital signature file. + Do you want to continue without signature check? (yes/no) [yes] + Checking MD5 checksums of files on the ISO image...OK. + Done! + + What would you like to name this image? [vyos-1.3-rolling-201912201452]: + + OK. This image will be named: vyos-1.3-rolling-201912201452 + + +.. hint:: | The most up-do-date Rolling Release for AMD64 can be accessed using the following URL: + | https://downloads.vyos.io/rolling/current/amd64/vyos-rolling-latest.iso + +After reboot you might want to verify the version you are running with +the :opcmd:`show version` command. + + +System rollback +=============== + +If you need to rollback to a previous image, you can easily do so. First +check the available images through the :opcmd:`show system image` +command and then select your image with the following command: + +.. opcmd:: set system image default-boot [image-name] + + Select the default boot image which will be started on the next boot + of the system. - Architecture: x86_64 - Boot via: installed image - System type: Microsoft Hyper-V guest +Then reboot the system. - Hardware vendor: Microsoft Corporation - Hardware model: Virtual Machine - Hardware S/N: 9705-6585-6578-0429-1204-0427-62 - Hardware UUID: 5260b1ce-4028-4d9c-bc5d-4f8425e5c056 +.. note:: VyOS automatically associates the configuration to the image, + so you don't need to worry about that. Each image has a unique copy + of its configuration. - Copyright: VyOS maintainers and contributors +If you have access to the console, there is a another way to select +your booting image: reboot and use the GRUB menu at startup. |