Welcome to Video two of our Introduction to Juniper Series.
We're going to take a look at the basics of the juniper CLI,
as well as the configuration hierarchy.
Juniper devices run the Junos operating system.
Junos can be configured through the CLI or the web interface
and also supports automation through NETCONF or REST.
One of the major benefits to Junos
is that it's use across all juniper routers, switches and firewalls
This means that we have the same basic commands on any device.
The slight exception to this is on some of their older
switches, which use different commands to the newer ones.
This was before Juniper created ELS or enhanced Layer two services,
which unified these commands across all platforms.
We can connect to Juniper devices the same way we would to any other device,
which includes a console, Port Telnet SSH, or through a web browser
Juniper CLI has two modes.
First, we have operational mode, which is where we run show commands.
Ping and anything else that operates the device
we know we're in operational mode
because of the greater than symbol in the prompt
The second mode is configuration mode.
This is where all the configuration of the device is done.
We switch from operational mode to configuration mode with the configure
command.
We can now see that we have the hash
or pound symbol in the prompt.
We can leave configuration mode
with the exit command
If at any time you get stuck.
There are some in-built help commands you can use help reference
to learn about other commands
notice here that we can use the question mark to see available options.
If you are used to Linux,
you'll probably notice that this looks like the man command
This is because Junos is built on top of free BSD
or Linux, depending on the version
If you have no idea which commands you need to use,
then you can type help apropos to search for the commands you need.
And I sincerely hope that I pronounce that correctly.
Help topic
can give us more information on the features and configuration tasks.
And finally, you get simple tips with help tip cli.
not something I use very often, to be honest.
Of course you can tab complete
your commands and variables as in most CLI's.
When I say variable, I mean things like the name of a policy that we have chosen
a bonus feature in Junos
is being able to space complete commands as well.
It's not like IOS.
There's no shortened commands every time you press space
the CLI will try to fill in the rest of the command for you.
If you really want to, you can disable space complete.
But personally, I love it.
I said a moment ago that Junos was built on free BSD or Linux.
Well, we can even connect to the underlying shell if we want
With the start Shell Command. Notice that the prompt changes to a % to sign.
From here we can run the regular Linux
commands like pwd, cd for changing directory
and ls for a directory listing.
When you're running the shell type exit to return to the junos CLI
and of course, the
junos CLI supports the regular Emacs keyboard shortcuts as shown here.
I recommend getting comfortable with them if you're not already
If nothing else, just get started by using control-A
and control-E
The Junos configuration
hierarchy is where it really starts to get interesting.
It's a lot more structured than some other vendors,
which makes it a lot easier to work with in the long run.
It looks like a file system full of directories and files.
Each piece of config is grouped into an area.
For example, one of the top level areas is called system,
and under that is an area called Log In, and under
that is an area for each user
Here we can see some sample configuration.
It is easy to get intimidated by this at first
because it looks a bit like a programing language of some kind.
But don't worry It's really not that hard.
The curly
braces are used to group configuration into areas.
Often there are child groups nested within parent groups
Anything that ends with a semicolon is a configuration item.
This is just a setting of some sort.
If we compare this to the corresponding Cisco IOS config,
we see that the junos config looks longer but is far more organized.
The IOS config is partially hierarchical
which we can see when some sections are indented,
but a lot of the settings are just floating around.
As you start getting used to the junos hierarchy,
you'll start to see how useful this structure is
Any time you want to see the configuration
from operational mode, just use show configuration.
This is paginated by default.
If we pipe through no more, it will show us all the output at once
when we're in configuration mode.
We can see the configuration with just show command.
We can also pipe through match
and except to filter output.
Match shows any line that matches our phrase
except we'll show lines that don't match our phrase.
There are a few other cool options too.
You can see a few of those listed on the screen.
If you need to run an operational mode command like ping from configuration mode,
just put the command run at the start of the line.
This is likely do command in IOS
Remember how I said that the hierarchy is like a file system?
Well, we can navigate around it like a file system too.
We can use the edit command to move into a configuration group
just like we would use cd
on Windows, or Linux to change a directory.
As soon as we do
this, the label above the prompt will update to show our current location
Moving deeper into the config continues to update its label.
When we run the show command from here, it is relative
to our position in the config so we don't see the full configuration.
Just the parts within system login.
We can use up to go up one level
or top to go straight to the root of the hierarchy.
When we want to configure something, we use the set command.
For example, we can set the hostname.
Sorry, that's the host hyphen name.
These commands are relative to our position in the hierarchy.
We have to include system as we're at the top of the hierarchy.
The opposite to set is delete.
This is like using the no command on a cisco router.
Here we're using delete to remove one of our user accounts
sorry. It looks like that user doesn't exist.
We can use the question mark to find out our valid options.
Okay. We can remove the user admin-2
nearly all set commands run from configuration mode.
The only exception that I know of is the set cli command
which run from operational mode.
And control how we interact with the CLI
You may have noticed that
the hostname hasn't changed yet, even though we just set it.
This is because Junos uses a commit model.
This means that configuration changes
aren't applied immediately when we're ready to apply our changes.
We need to run the commit command.
This process does a few checks
to make sure our config is fine and then applies the changes.
These also write the changes to disk so
there's no need for commands like write memory or copy run start.
If you'd like to try this out for yourself,
there's a guided lab on the website that you can use.
This one's pretty simple, but I warn you that they will get trickier
as we move through the series
He's the first quiz in the series when you see these.
Pause the video and see if you can think your way through each of these questions.
You're welcome to try to work these out yourselves or discuss them
in the comments section if you want to, or you can always head over
to the members section on the website to get detailed answers and explanations.
Check the video description for a link.
Hopefully the CLI will no longer seem as foreign to you as it once did.
One of the best parts of the Juniper CLI
is the commit model, which we're going to look at further in part five
will also look at configuration management further.
In Part six,
please click the video shown here to move on to part three,
where we'll take our CLI skills further
by configuring some interfaces and a VLAN or two