Difference between revisions of "Comment (command)"

From VyOS Wiki
Jump to: navigation, search
(Page creation)
(No difference)

Revision as of 01:46, 28 March 2017

The `comment` commands allow you to insert a comment above the current configuration section. The `comment` command cannot be used at the top of the configuration hierarchy, only on subsections. Comments needs to be commited, just like other config changes.


To add a comment to a section, while being already at the proper section level:

[edit <section>]
vyos@vyos# comment "Type Comment Here"

To add a comment directly to a section, from the top or a higher section:

vyos@vyos# comment <section> "Type Comment Here"


To add a comment to the "interfaces" section:

vyos@vyos# edit interfaces
[edit interfaces]
vyos@vyos# comment "Here is a comment"
[edit interfaces]
vyos@vyos# commit

The comment would then appear like this:

vyos@vyos# show
 /* Here is a comment */
 interfaces {
     ethernet eth0 {

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 interfaces` command would return starting after the "interfaces {" line, hiding the comment:

vyos@vyos# show interfaces
 ethernet eth0 {

To add a comment to the interfaces section from the top:

vyos@vyos# comment interfaces "test"

The comment can be added to any node that already exists, even if it's multiple levels lower:

vyos@vyos# comment interfaces ethernet eth0 vif 222 address "Far down comment"

Command tree