Tuesday, June 11, 2013

Configuration annotation in Junos

When a box is managed by multiple people, sometimes this leads to confusion for people working on the box. The confusion can be illustrated as "what is this static route configured for?". A simple method can be by putting annotations or notes to the configuration to help the administrator know why this configuration or this IP was configured .

You can add an annotation using the annotate command, one thing to put in mind while putting it is that you have to be in edit mode the the hierarchy right above the thing you need to annotate.

here's an example of annotating a static route the points to a DNS server. let's first see how the configuration under the routing-options hierarchy looks like before annotating the static route

routing-options {
    static {
        route 4.2.2.2/32 next-hop 10.1.2.2;
        route 1.1.1.0/24 next-hop 20.1.1.2;
    }
}

now let's annotate that the IP 4.2.2.2 belongs to a DNS server

[edit]
root# edit routing-options static
[edit routing-options static]
root# annotate route 4.2.2.2/32 "DNS Server"

now let's see how the configuration looks like when showing the configuration looks like right now.

routing-options {
    static {
        /* DNS Server */
        route 4.2.2.2/32 next-hop 10.1.2.2;
        route 1.1.1.0/24 next-hop 20.1.1.2;
    }
}

As you can see, /*DNS Server*/ has been appended to the configuration to point out that the line right under it is a static route to 4.2.2.2.

one thing to notice here is that annotations can't be seen when showing the configuration with display set option.

root# show routing-options | display set
set routing-options static route 4.2.2.2/32 next-hop 10.1.2.2
set routing-options static route 1.1.1.0/24 next-hop 20.1.1.2

Using annotations can be very useful for multiple administrators working on the same box, annotations "almost" can be used anywhere inside the configuration.