Juniper’s Wonderful Command Line Interface (CLI)

Regardless of your vendor preference or your experience on the Juniper JUNOS CLI, assuming you have a point of reference to another vendor, your first thought when experiencing JUNOS is, “I have been here before.” The CLI is familiar, convenient, and polished. The similarities between JUNOS CLI and another CLI such as Cisco’s IOS are not what I want to focus on here however; it is their differences I want to focus on. But first, when you connect to a JUNOS powered device and access Operational Mode (see Brad Wilson’s blog post Introduction to Juniper Junos), it looks very much like the User EXEC Mode in IOS. In fact, there are a lot of JUNOS commands that are very much like the IOS User EXEC Mode commands.

Cisco User EXEC Mode:


Juniper Operational Mode:


As you can tell from the simple image above, even if you have never seen either before their similarities are obvious. In fact, typical trouble shooting commands such as Packet Internet Groper (PING) and TRACEROUTE can both be issued on either platform from here. From either of these prompts you could easily connect remotely to some other router or switch with a remote connection protocol such as Telecommunications Networking Protocol (TELNET) or Secure Shell (SSH). If you were to issue show commands to inspect interface issues and/or connections you could do so from these prompts. However, that is the beginning of where these two operating systems start to become significantly different.

Comparing the viewable similarities to these two vendors at their User EXEC Mode and Operational Mode for Cisco and Juniper respectively, we also see the same visual characteristics as we dive deeper into each by exploring the Cisco Privileged EXEC Mode and Configuration Mode for JUNOS. In the picture below is a simple visual comparison of these modes:

Cisco Privileged EXEC Mode:



Juniper Configuration Mode:



Once again, they are very much alike with a quick visual inspection. However, if you issued an interface show command in IOS in Privileged EXEC Mode such as show interface GigabitEthernet 0/0/0, you are presented with statistical information about that interface. JUNOS is completely different with a nearly identical command. In JUNOS, in Configuration Mode, issuing the show interfaces ge-0/0/0 command shows you exactly how that interface is configured in JUNOS; not the same statistical information you get with IOS.

Now, depending on your background, well, this is just wrong! But, if you think about it, on the Juniper router you are in configuration mode. If you issue the show command above, why would you expect to get anything other than configuration information about that interface or whatever command you issue in configuration mode? You shouldn’t, at least not if you are thinking clearly. In IOS, to get the same level of configuration information for this interface you would have to look at either the running configuration or the startup configuration. With either of those commands you could either look at all of the other configuration and just use the space bar to move down to where the interfaces are configured. Or, you could use any number of shortcuts including the “Pipe” command (|) to filter the configuration output to get to where you wanted to be.

As you can already see, the differences between these two nearly identical, at least visually, prompts are pretty significant. In fact, the configuration that you are actually looking at on a Juniper router is referred to as the “candidate” configuration, but for now just understand that the candidate configuration and the active configuration are identical until you start modifying the configuration (more on this topic later). Understand as well, there are many “Operational Mode” commands in JUNOS that it would just be silly to have to navigate all the way back to Operational Mode just to use.

With that understanding, it is now time to learn how to use Operational Commands while remaining in Configuration Mode, while at the same time adding another potential “well that’s not the way we used to do it” moment to your thought process. The PING and the TRACEROUTE utilities mentioned earlier in this blog post are wonderful first line tools for validating configurations, reachability, and for trouble shooting when the need arises. Just imagine, you just finished adding an interface IP address and associated information and applied that configuration to the active configuration the router is currently running on. Prior to adding more configurations, you want to do a quick validation to make certain that the current router you are working on and its directly connected neighbor router are “talking”. You attempt to type the command ping ip address, and you are immediately met with an error after typing “ping” stating that this is an unknown command. Oh my, what to do? How am I going to “run” this command while maintaining my position in configuration mode? Well obviously there is a fix to this, or otherwise I wouldn’t have made up this goofy example. The key to “running” operational commands in configuration mode is the run command!

Any operational command that needs to be accessed while in configuration made can easily be executed by prepending it with the run keyword. So, ping ip address becomes run ping ip address. A traceroute command to an ip address becomes run traceroute ip address and so on and so forth. Now here is when the “well that’s not the way we used to do it” bit comes up. Remember, in JUNOS configuration mode, issuing the show interfaces ge-0/0/0 command shows you how that interface is configured. However, that same command in operational mode gives you statistical information about that interface. So the exact same command either gives you operational information on the interface or configuration information about that interface assuming that the first time you issue it you are in operational mode and the next time you are in configuration mode. What if you wanted to see operational or statistical information about an interface but you were currently in configuration mode? It is simple, just add “run” to the show interfaces ge-0/0/0 while you are in configuration mode, and you have changed the entire meaning of the command to operational and statistical output; make sense?

Now, here is the funny/confusing part; In JUNOS, we issued the run show interfaces ge-0/0/0 command to see statistical/operational information about that interface. In IOS, we issue the show run (abbreviated for running-config) interface GigabitEthernet 0/0/0 to see configuration information. Is your head on fire yet? It really isn’t that difficult of a concept, but it just proves yet again that as similar as the two operating systems seem to be that there are enough differences to force you to “think” your way through what actual command you need. Especially for those of us that are fortunate (unfortunate?) enough to have to bounce back and forth between the two systems on a regular basis.

Will the candidate please step forward… remember the reference early on to the configuration actually being a candidate configuration and not “the” configuration? When you first move from the operational prompt to the configuration prompt you aren’t actually looking at the configuration that the router is running on. You are looking at a snapshot of that configuration taken at the point in time when you logged in. Therefore, you can make changes all day long but they will do nothing until we are ready for them to be applied. When that time comes, all we have to do is commit our changes. That’s it!

As you read this, think about some of the things that could be of potential concern and let me know what those concerns are. As I prepare for my next post I will use those questions as fodder to hopefully help alleviate some of those concerns. Until then…

Related Post
Introduction to Juniper Junos

Related Course
Junos Foundations: JNCIA-Junos Boot Camp (IJOS, JRE)

In this article

Join the Conversation