Support Support Downloads Knowledge Base Juniper Support Portal Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

[Junos] How to add comments to Junos configuration



Article ID: KB36051 KB Last Updated: 19 Aug 2020Version: 1.0

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:

  1. 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 "#This is our primary NTP server"

Result After Commit

system {
    host-name TEST_DEVICE;
    ntp {
        #This is our primary NTP server >>>Notice that the comment is before the configuration statement; it is defined by the # sign.
  1. 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;
  1. 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 "#This area contains SITE_B routers"

Result After Commit

protocols {
    ospf {
        #This area contains SITE_B routers       
        area {
            interface ge-0/0/3.0 {


Related Links

Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search