Juniper JNCIA-Junos JN0-104 – Section 3: User Interfaces Part 2
April 18, 2023

26. CLI Help

Let’s talk about the help commands available on a Junos device primarily. There are three help commands. The first one is help topic. This shows you usage guidelines for a specific statement. Then we have help reference. This will show you summarized information about a specific statement. And third, we have helped apropos. This is used to list all commands and help text that contain a particular string.

Let’s try these commands on the Junos terminal. All right, I’m here at a terminal window and I’m already locked into the Junos device. The help commands can be executed from the operational mode. I’m right now in the operational mode and this can be identified with the greater than symbol.

Let’s start with a question mark. And we can see that the help command is available here. So we’ll start with help. And let’s do a question mark to see the possible completions. So here’s the three commands that we spoke about – help topic, help reference, and help apropos.

Let’s start with help topic. I’ll begin with a question mark. This will show you the possible completions. Remember, if you do not see enter as the first possible completion, that means the command is incomplete. You need to provide a completion. So I need to provide a completion here. Help topic. And let’s try this one interfaces. So I pressed ctrl c to exit the output help topic interfaces. And let’s do a question mark again. And now we can see all possible completions after this. If you want to scroll down the output, you can press spacebar and that will go line by line. If you want to go to the next page, you can press the spacebar key and that will take you to the next page.

Let’s try this one. So ctrl c to exit the output and we’ll do family. So, help topic interfaces family. Let’s do a question mark. And now the command is ready to be executed because enter is a possible completion. So I’ll press enter here. And this shows me USE-IT guidelines for the specific topic. So, this topic is about configuring the protocol family. And these are the options available. We have used information for each of these options over here. And as we scroll down, we can also see some configuration commands for that specific topic.

Let’s try one more help topic. Let’s start with a question mark. And this time, let’s try system help topic system question mark. These are the possible completions. I’m going to scroll down and let’s try root authentication. So, ctrl c to exit. Help topic system root authentication. Question mark. And this command can now be executed. I’ll press enter. So here we can see. This topic is about configuring the root password. This information is the same that we discussed earlier.

So, when you have a brand new Junos device, you only have to use a name root with no password. But when you make any configuration changes, you will need to set a password. And here’s the configuration statement to set the password. And you also have an example here. So when you need USE-IT guidelines for a specific topic, the health topic command is very useful.

Let’s try the next one. Help reference. This will show you summarized information about a specific statement. So, let’s do help reference question mark. And this time, let’s try a different option. Maybe, we can try security. Help reference security. Let’s do a question mark. So we can see we have all these options that we can use. Let’s pick any one of them. Maybe, we can pick dns. So ctrl c to exit. Help reference security dns. And now I can see summarized information about this topic. So, here’s the syntax for dns-related commands. Here’s the hierarchy at which this information is configured. The command was released in Junos Release 8.5. Here’s a description. And here I have some other options that can be configured. So, when you need a summarized information about a specific statement, you would use help reference.

The next one is help apropos. And this is used to view any command that matches the string that you provide. So, help apropos. Let’s do a question mark. And you’ll notice here it does not provide you a list of possible completions. You need to provide a topic. Maybe, we can try snmp. Help apropos snmp. And that will show us all possible commands with snmp in it. So, you’ve got monitor commands, clear commands, request commands, show commands, etc. I’ll do a ctrl c. Maybe, we can try one more. Help apropos. And let’s do ntp, for example, network time protocol. And now I can see all possible commands for this. I’ve got monitor commands, show commands, set commands, help commands, etc.

So if you’re in a situation where you know a keyword that you want to use, but you can’t recall the command to, help apropos can be very useful. You can simply type in help apropos and the keyword. And it will show you all possible commands with that keyword.

Back over here, there are two more help commands that we need to know. The first one is help sis log. This will show you information about system log messages. And the next one is help tip cli. This will show you a tip about using the command line interface back to the Junos terminal. Let’s try these two commands.

So we’ll start with help syslog. Remember, this is used to view information about system log messages. Let’s begin with a question mark. So, these are all the possible system log messages. So, when you look at your system log file, these are the different messages that you could see in your log file. The list is really long. So, if we keep going down the list, you can see there are so many system log messages that are possible. One good thing about Junos is that you can actually type in few letters and then press question mark. It only shows you possible completions after the letters that you’ve typed. For example, help syslog RT underscore and if I do question mark here, it only shows me possible completions that begin with RT underscore.

All right, let’s try this one here. RT_FLOW_SESSION_CREATE. This is a very common syslog message that you will see in your log files. So, ctrl c to exit. Help syslog RT_FLOW_SESSION_CREATE. Press enter. And now we can see the meaning of that syslog message. So, this is the name of syslog message. This is the message format that you will see in your log file. See, we’ll see session created by, the source IP address, source port, destination address, destination port, service name, nat address information. And then you will see the protocol ID, the policy that’s permitting that connection, the source on the destination zone, etc. Here you can see a description for that syslog message. what type of message is that, what’s the severity of that message and which facility is responsible for this syslog message.

So, if you’re looking at your system log file and you see all these different syslog codes and you’re not sure what the meaning is, you can simply type in help syslog and that syslog message code and it will show you the information about that syslog message.

Let’s look at the last help command, which is help tip cli. And this will show you a tip about using the cli. So here’s the first tip. Let’s try that one more time. Help tip cli. And now we can see a different tip.

It’s also possible to associate that tip with a number. So, if we did help tip cli question mark, you’ll notice we can enter a number. Let’s type. Maybe, number four. Okay. So this tip is tied to the number four.

Now, let’s try help tip cli again. We can see a different tip. But if we wanted to see this tip again, we can type the same command again. Help tip cli 4. And we should see that same tip again.

So, those are the help commands that we should be knowing about. From the examination perspective, these help commands are very important. Keep in mind what the command is and what kind of output you get from that command. And also keep in mind the help commands are available from the operational mode.

27. Output Levels

Let’s talk about the different Junos output levels. When you are viewing output on the Junos device, there are four different levels of output that can be viewed. Each output shows a certain amount of information.

The first one is terse. This displays the least amount of information and the output is shown as a list.

The second output level is brief. This displays additional information about each element. And this output is longer than the output that you would get with the terse command.

Then we have the detailed output level. This will display most of the information about each element.

And finally, we have extensive. This displays all information about each element.

Let’s get to the Junos terminal and give this a try. All right. I’m logged into the Junos terminal. I’ll first navigate to the operational mode and the command that we’re going to use today is show interfaces.

Let’s start with a question mark. So, we can execute this command as it is, if we want to view all the output or if we want to filter down on a specific interface, we can type the interface name. And that way we’ll only see information about that interface or we can use any of these output levels that we spoke about. So you’ve got terse, you’ve got brief, detail and extensive.

Let’s start with the first one. Show interfaces terse. I’ll press enter. And here we can see that there is minimal information about every interface and the output is shown in a list format. Also, notice that this command show interfaces terse is a very-very useful command, and you’ll find yourself using this command very often, especially when you’re configuring interfaces and routing information.

To exit the output, I’ll press ctrl c. Before I show you the brief output level, let me show you a nice tip. Instead of doing show interfaces terse, which shows me all of these interfaces and these are interfaces that you will normally not be looking at, like the loopback interface and some of these are internal interfaces. Most of the time you will be looking at the FE interfaces or the GE interfaces. So what we can do here is we can say show interfaces fe. And then 0/0/*, because all my interfaces have the same naming convention – 0/0/1, 0/0/2, 0/0/3 – so, I’m saying show interfaces fe 0/0/* star, which means this field doesn’t matter as long as these two match.

Remember, the Junos operating system is based on FreeBSD Unix. So a lot of the Unix commands and utilities can be used over here. So, show interfaces fe 0/0/*. And now let’s do terse. Press enter. And now we are only looking at output for those interfaces that start with fe 0/0. That’s quite handy, isn’t it?

Now, let’s look at the next output level, which is brief. So we’ll use the up arrow and we’ll say show interfaces fe 0/0/* brief. Press enter. So here’s the output. We can see that we have some additional information about every element, like we can see the link status here. We can see some more information, like the MTU, the speed, the loopback information, source filtering information. And it also shows more information about the logical interface like the security zone, the service name, the dynamic profile and things like that.

So, compared to terse, this output level has more information. I’ll do ctrl c to exit and let’s try the next one. Show interfaces fe 0/0/* detail. Press enter. And now we can see the output displays most of the information about each element. So, here we have all that information that we saw earlier. But now we are also looking at statistics. We are also looking at counters. And this information goes into several pages. So if I press spacebar here, you can see I have so many statistics to look at. And the output is pretty long.

Let’s try the last one, which is show interfaces fe 0/0/* extensive. Press enter. This will show all information about each element. So, we have all the information that we looked at earlier. We also have statistics and now we’re also looking at errors. Right. So there’s a lot of information or, I should say, there’s all information that you would need in the extensive output level.

Normally, when you’re configuring the device, you will not use that detail and the extensive output level; most of the times you would be using terse and brief; detail and extensive are used for troubleshooting purposes.

From the examination perspective, it is important to keep in mind the names of the four different output levels.

28. Filtering Output

Let’s understand how to filter the output on a Junos device.

So, here are the commands that we’re going to look at. We’ll start by looking at the compare command. We’ll talk about count, display, except, find, last, match, no-more and the save command. Let’s dive straight into the Junos terminal and take a look at these commands.

All right, I’m here at a Junos terminal. I’m first going to enter the configuration mode with the edit command and let’s start with the show command. The show command can be used to view the configuration. To take a look at the filtering options, I’ll start by using a pipe (|) and then do a question mark. So, here we can see the different options that we talked about – compare, count, display and so on.

Let’s start with the count command. So I’ll perform show pipe count. So, what will happen is it will take the output of this command and tell us how many lines are in that output. Let’s give this a try. Show pipe count. And we can see that we have 248 lines of output in the show command.

Now let’s do this. Let’s go back to the operational mode and let’s try show interfaces terse pipe count. So, show interfaces terse has 45 lines of output.

Now let’s do this. Let’s do show interfaces extensive pipe count. And this one has 1618 lines of output. All right. So, when you want to know the number of lines contained in the output, we can use the count command back to the configuration mode.

Let’s do show pipe question mark. And let’s try the display command now. Before I show you the use case for this, let me run the show command. So, it is going to show us the configuration. I’ll press enter. So, here we can see the configuration on this device. But do you notice one thing? The configuration is shown like a programming language. So, for example, we can see here we have the nat configuration. Under the nat hierarchy, we have the source nat configuration and we have a ruleset called source-nat, which is matching the trust zone as the from zone and the untrust zone as the to zone. So, we are able to read it well when it is shown like a programming language.

But what if I wanted to see the set commands used to configure this? That’s where we would use the display option. So, I’ll press ctrl c to abort the output. And let’s do show pipe display and let’s do a question mark. Now, here we have quite a few options. We’re not going to worry about each one of them will only look at set. So, show pipe display set. And now we can see the entire configuration in the form of set commands. So, let’s say we wanted to move the configuration of this device to another Junos device. In that case, I would need the set commands. Right. So I can do show pipe display set, copy all of this configuration and paste it on the new device. This command is very important from the examination perspective.

Let’s try the next one. So, show pipe question mark. And here we have the compare command. The compare command allows you to compare this output with another configuration that you’ve already saved to a file. So, before we look at this command, let’s understand how to save the configuration to a file using the save command.

So, if I wanted to save the output of this command to a file I can use the save command. So, I can do save question mark. And here I can provide a file name.

Now, what I’ve already done is that I’ve already saved the configuration into a file called old_config. So, now we can use to compare command to compare the output of the show command with this file that I’ve already saved in the past. By the way, if you’d like to see the files that are saved on your Junos device, you can go back to the operational mode and use the file command and save file list. That will show you the files saved on your Junos device.

So, this file is my old configuration. We can even view the contents of that file if we wanted to. The command is file show and then the file name. And that would show me the configuration stored on that file.

Now, let’s go back to the configuration mode and let’s do show pipe. And this time we’re going to use the compare command. Show pipe compare question mark. And let’s compare that to old_config. Press enter. And now we can see, compared to the old configuration, the new configuration does not have this item. So, under edit system name-server, one of the DNS servers has been removed. The way I know that is because there is a minus over here. Anything that has a plus is something that has been added. Also, under the edit system login hierarchy, you can see that a new user has been added by the user name admin. Here’s the user ID. and I can see that he’s a read-only user. So, anything that you see with a plus has been added.

I can also see that under added interfaces, FE 0/0/0, the description has been removed and under edit interfaces FE 0/0/1, again, the description has been removed. So, this is a nice way to compare the output to an old configuration file. The command is compare.

Let’s try the next one. So let’s do show pipe question mark. And this time let’s try except. The except command can be used to view output. That does not match a pattern. So let’s actually do this. Let’s start this way first. Show display set. So, I can see all the set commands in here. Now, let’s say I want to see the output. But I don’t want to see this portion that contains the keyword screen. So, I want to remove any configuration line that contains the word screen. So, let’s try that. So I’ll hit the up arrow. Remember, we can do multiple pipes so I can further pipe over here. So, show displace set pipe again and this time I’m going to use except. And then we need to provide a pattern to match. So I’m gonna say screen. Show display set except screen. Press enter. And now we can see that. We can see the whole configuration. But anything that has the word screen has been removed from the output.

So, if you want to view the output that does not match a specific string or a pattern, you would use the except command. I’ll hit the up arrow. Let’s try the next one. Show display set question mark. And let’s try this one find. That will show you the first occurrence of a specific pattern. So, show display set find and let’s do policies. Let’s take a look at the first occurrence of policies. Policies. Press enter. And now notice we can see the entire configuration starting from the first occurrence of that pattern. It does not show you only configuration that matches that pattern. It shows you the entire configuration. But it starts from the first occurrence of that pattern.

But what if we wanted to see an exact match? What if we only wanted to see the configuration that matches the string that we provided? That would be the match command. Let’s give that a try. So, show display set. I’m just gonna change find to match. So, show display set match policies. Press enter. And now we can see that we are only looking at configuration that exactly matches the string. So, every line has that string that we provided.

So, the difference between the find and the match comment is subtle. The difference is that the find command will show you the output starting from the first occurrence of that string. The match command will show you exact output, only the one that matches the string that you provide.

Let’s try the next one. Show display set, let’s do a question mark and let’s try this one here last. This keyword is used to see only the last portion of the output. So, if I press enter here, notice this is the last page of the output. We can see that we’ve reached 100 percent of the output. So, if I press spacebar here, I’ll return to my prompt. So, when you want to view the last portion of the output, you would use the last comment.

And finally, let’s take a look at the last command which is no-more. Now, before we try this command, let’s just try this command here. Show display set. Press enter. And do you notice here that the output is paginated, meaning this is the first page of the output. And then we have more. So, we can press spacebar and we can see the second page, third page and so on. If we did show display set no-more, that would not pagination the output. We will see the entire output at once. So, press enter here. And you can see that it shows the entire output. At once.

Another thing to keep in mind is that when you want to use these options here, you do not need to combine them with display set. Display set just shows the output with the set commands.

So, I could do something like this as well. Show pipe no-more. And that would show me the output without paginated. But this time we’re looking at the output like a programming language

Back over here. So, let’s quickly summarize the commands that we looked at.

The compare command is used to compare the output against a file or a configuration that has been previously saved.

The count command will tell you the number of lines in the output of your command.

The display command can be used with the keywords set to take a look at the output in the form of the set commands. That has been used to configure the device.

The except command can be used to look at the output. That does not match a specific pattern.

The find command can be used to take a look at the output starting from the first occurrence of a specific pattern.

The last command is used to view only the last portion of the output.

The match command is used to perform an exact match. It only shows the output that matches a specific string.

The no-more command can be used to stop the output from being paginated, and the save command can be used to save the output to a file.

Leave a Reply

How It Works

img
Step 1. Choose Exam
on ExamLabs
Download IT Exams Questions & Answers
img
Step 2. Open Exam with
Avanset Exam Simulator
Press here to download VCE Exam Simulator that simulates real exam environment
img
Step 3. Study
& Pass
IT Exams Anywhere, Anytime!