JunOS – The basics

Right, it’s really time I get cracking on with my JNCIA. I’m going to do the EX track first, then maybe ER as well.

I’ve set up an Olive quickly and connected it to a 1721 via dynamips. I want to start off with the basics of getting around the cli of JunOS. Yes it’s different to IOS, but it’s really not that difficult.

When the Olive first boots up, it’ll be a blank slate. If you logged in as root, you’ll need to enter cli to actually get to the cli:

[email protected]%cli
[email protected]>

Right, now we are at the CLI. Let’s start configuring!

First go into configure mode:

[email protected]> configure
Entering configuration mode

[email protected]#

Let’s start with a few basics. These few are all intuitive:

#set system host-name Olive
#set system time-zone Europe/London
#set system domain-name test.com
#set system name-server

Note that JunOS won’t make these changes live straight away. All changes go into a ‘candidate configuration’ – Only when you actually commit the changes will they actually happen. You can commit straight away or do a syntax check beforehand:

#commit check
configuration check succeeds

This means all looks good, so let’s commit the changes!

commit complete

[email protected]#

There is something to note here. JunOS’s config mode is hierarchical. This means that if I was going to do a lot of commands in the same sub-section – I could go into that sub-section first.
For example, the above 4 commands were all in the system sub-section. Instead of the above, I could’ve done this:

[email protected]> configure
Entering configuration mode

[email protected]#edit system

[edit system]
[email protected]#set host-name Olive
#set time-zone Europe/London
#set domain-name test.com
#set name-server

This would give me exactly the same configuration as the above. If I need to get out of a sub-section I just type ‘up’


[email protected]#

If I’m in pretty deep, you can type ‘top’ to get right to the top of the tree

Now we need to set up an IP address on an interface. To see what interfaces you have, you can type:

 Olive> show interfaces terse 

This command is similar to show ip int brief on a Cisco

I want to configure the em1 interface and I do so like this:

Olive# set interfaces em1 unit 0 family inet address

So quite a bit longer than on a Cisco, but it’s really not that difficult. There is an important note here. When you assign an IP address to a Cisco, it becomes the ‘first’ IP. You can add secondary addresses on that interface but you need to specify secondary when entering the IP address. The same thing happens on JunOS, but you HAVE to specify a logical unit at all times, even if it is only EVER going to have 1 IP. Therefore Unit 0 is the first IP, unit 1 the second, unit 2 the third and so on. If I wanted to add a second IP to this interface, I’d do it like so:

Olive# set interfaces em1 unit 1 family inet address

To set up a default route, we do it like so:

Olive# set routing-options static route next-hop

There’ll be plenty more JunOS stuff coming very shortly!

© 2009-2020 Darren O'Connor All Rights Reserved -- Copyright notice by Blog Copyright