Devices that run Junos OS support comments in their configuration.
This article explains how to add comments and lists the ways to do it. This is helpful when you have extensive configuration and need to include details related to the usage of the configuration.
This can be achieved by using the annotate
command under the respective configuration hierarchy. Note that the comment will precede the command.
-
If a comment is needed between " /* */ ", then " " can be used.
-
If a comment needs to start with #, then "# " can be used.
Below are some examples:
-
To set a comment to an NTP server to indicate that it is the primary NTP server:
user@device#edit system ntp
{master:0}[edit system ntp]
user@device# annotate server 10.99.99.50 "#This is our primary NTP server"
Result After Commit
system {
host-name TEST_DEVICE;
ntp {
boot-server 10.99.99.51;
#This is our primary NTP server >>>Notice that the comment is before the configuration statement; it is defined by the # sign.
server 10.99.99.50;
source-address 10.7.93.20;
}
}
-
To set a comment to indicate the purpose of a specific forwarding-class:
user@device# edit class-of-service forwarding-classes
{master:0}[edit class-of-service forwarding-classes]
user@device# annotate class PREMIUM_DATA "HR_Traffic"
Result After Commit
class-of-service {
forwarding-classes {
class VOICE queue-num 4;
/* HR_Traffic */ >>> Notice that the comment is before the config statement and it is between /* */.
class PREMIUM_DATA queue-num 5;
class DC_SERVERS queue-num 6;
class VIDEO_CONFERENCING queue-num 7;
class best-effort queue-num 0;
}
}
-
To set a comment in an OSPF area and to indicate that it contains all routers of SITE_B:
user@device#edit protocols ospf
{master:0}[edit protocols ospf]
user@device# annotate area 0.0.0.1 "#This area contains SITE_B routers"
Result After Commit
protocols {
ospf {
#This area contains SITE_B routers
area 0.0.0.1 {
interface ge-0/0/3.0 {
}
}
}