Today we’ll go over a very basic JUNOS configuration, we will configure the hostname, user account, IP addresses and a default route. The purpose of this article is to provide a look and feel for JUNOS.
First let’s login and take care of the basics:
root> configure
[edit]
root# set system host-name Olive1
[edit]
root# set system login user colby class super-user authentication plain-text-password
New password:
Retype new password:
[edit]
root# commit and-quit
commit complete
Exiting configuration mode |
This is a simple config, we enter configuration mode, we set the hostname of the router then we configure a user named “colby” in the “super-user” class. “Super-user” is a pre-defined class in JUNOS, this class has full control of the router.
Anyone familiar with IOS can see that this is pretty different. The commands all start with “set” and they can be quite a bit longer. Let’s take a look at the hierarchical view of what we just did:
system {
host-name Olive1;
login {
user colby {
uid 2000;
class super-user;
authentication {
encrypted-password "$1$IKhmMCbo$XNAWMDS"; ## SECRET-DATA
}
}
}
} |
Definitely not what I’m used to, but not so bad. Now we’ll configure the same thing with multiple commands from the hierarchy:
[edit]
colby@Olive1# edit system
[edit system]
colby@Olive1# set host-name Olive1
[edit system]
colby@Olive1# edit login
[edit system login]
colby@Olive1# set user colby class super-user authentication plain-text-password
New password:
Retype new password: |
I prefer to stay at the top of the hierarchy and use as few commands as possible, but it seems that many people like digging into the hierarchy. The rest of the configuration in this article will be from the top using as few commands as possible.
Next we’ll do a “show interfaces terse”, which is like our old pal “sh ip interface brief” in IOS:
colby> show interfaces terse
Interface Admin Link Proto Local Remote
dsc up up
em0 up up
em1 up up
gre up up
ipip up up
lo0 up up
lo0.16384 up up inet 127.0.0.1 --> 0/0
lo0.16385 up up inet
lsi up up
mtun up up
pimd up up
pime up up
tap up up |
This looks a little different than “sh ip int b”, but it’s very easy to read. The interfaces we’ll be working with today are “em0″ and “lo0″, em0 is our ethernet interface (this is how they’re named in Olives running in VMs apparently), and lo0 is our loopback.
Let’s give em0 an IP address:
[edit]
colby@Olive1# set interfaces em0 unit 0 family inet address 192.168.25.100/24
[edit]
colby@Olive1#commit
commit complete
[edit]
colby@Olive1# run show interfaces terse
Interface Admin Link Proto Local Remote
...
em0 up up
em0.0 up up inet 192.168.25.100/24
...
lo0 up up |
We’ve set an interface on em0. The command configures a logical interface with an ipv4 address of 192.168.25.100/24 (255.255.255.0). We use “unit 0″ on this ethernet interface since it is not a tagged/trunk link. We have basically configured the equivalent to a subinterface in IOS, but this is normal practice for assigning IPs to interfaces in JUNOS.
Let’s give our loopback an IP too:
[edit]
colby@Olive1# set interfaces lo0.1 family inet address 192.168.30.1/24
[edit]
colby@Olive1# run show interfaces terse
Interface Admin Link Proto Local Remote
...
em0.0 up up inet 192.168.25.100/24
...
lo0.1 up up inet 192.168.30.1/24 |
The same as configuring a physical interface. Here’s a look at the hierarchy:
interfaces {
em0 {
unit 0 {
family inet {
address 192.168.25.100/24;
}
}
}
lo0 {
unit 1 {
family inet {
address 192.168.30.1/24;
}
}
}
} |
Now we need a default route so we can send and receive traffic:
[edit]
colby@Olive1# set routing-options static route 0.0.0.0/0 next-hop 192.168.25.1
[edit]
colby@Olive1# run show route terse
inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
A Destination P Prf Metric 1 Metric 2 Next hop AS path
* 0.0.0.0/0 S 5 >192.168.25.1
* 192.168.25.0/24 D 0 >em0.0
* 192.168.25.100/32 L 0 Local
* 192.168.30.0/24 D 0 >lo0.1
* 192.168.30.1/32 L 0 Local |
That’s our very basic JUNOS configuration. We’ve configured a user, given the router a hostname, and set up IPs and routing. Here’s our hierarchy at the end:
system {
host-name Olive1;
login {
user colby {
uid 2000;
class super-user;
authentication {
encrypted-password "$1$IKhmMCbo$XNAWMDS"; ## SECRET-DATA
}
}
}
}
interfaces {
em0 {
unit 0 {
family inet {
address 192.168.25.100/24;
}
}
}
lo0 {
unit 1 {
family inet {
address 192.168.30.1/24;
}
}
}
} |
For reference, this is the same config in IOS:
hostname Router
!
username colby privilege 15 secret [password]
!
interface fa0/0
ip address 192.168.25.100 255.255.255.0
!
interface lo1
ip address 192.168.30.1 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 192.168.25.1 |
IOS needs more commands typed out, but the JUNOS commands are much longer. In my next JUNOS post I’ll go over OSPF and maybe NAT, if I ever figure out how to make it work.
Related Posts:

about 2 years ago
I really like the commit and rollback features, and am surprised Cisco hasn’t ripped it off in some way or another yet.
Check out ‘JUNOS as a second language’ which should still be free from Juniper (might have to sign up for something). Does a good job of relating it to IOS.
about 2 years ago
I’ve been wondering what JUNOS as well myself, so I’m quite looking forward to your next bunch of posts on this one Colby!
about 2 years ago
@Rob: I wish Cisco would rip them off, lol. I’d love to have those features in IOS. I went through JSL pretty thoroughly yesterday, it was helpful (I even have a blog post about it
).
@Jared: I’m glad there’s some interest in JUNOS posts. I’ll add that to the top of the list, hopefully I can throw something together in the next few days.
about 2 years ago
Once you get past the Hierarchy of Junos it’s really pretty simple. Working with the J2350 has been a challenge, but has been a learning experience. It is not IOS by any stretch of the imaginations.
The biggest thing that I like and I know you say you hate it, but I like how you can do most of the commands in 1 line.
I’m waiting to see blog posts about this too
about 2 years ago
You say it’s pretty simple, but you didn’t know how to do any of the advanced stuff I asked you.:-P
You can do some of the commands in one line, but a lot of them need multiple lines, like adding user accounts, and route policies, etc. I’m still learning though, maybe it will continue to grow on me.
about 2 years ago
Just checking out your blog from your link on EE
Did you know that GNS3 now supports JUNOS though the QEMU package!! I am very excited about that. I have wanted to jump into the JUNOS world for a while just have not had the hardware. I have read about beans (or VM images of JUNOS) but have not had the time to dig into them.
Look forward to your adventures.
That1guy15
about 2 years ago
Man, once you know JunOS, you’ll wonder where it’s been all your life!
Some show commands give you far more info than IOS will. ‘show route extensive’ for example tells you exactly why a route wasn’t installed into fib.
You have an Olive setup yet? Very handy, especially connecting to Ciscos via dynagen/gns
about 2 years ago
@that1guy: Yea, I’ve read that the new GNS3 supports Olives (is that what you mean by beans?). Definitely jump into JUNOS whenever you get time, it’s fun to see how other vendors do things.
@Jason: Everyone keeps telling me they like it better than IOS, but I can’t imagine why.:-P I have two Olives setup on my ESX box, and a J2300 in transit to my house. My post today is about my experiences playing with the Olives.
about 2 years ago
@Colby: sorry I meant Olives. My mind was somewhere else yesterday
about 2 years ago
Haha, yea, I hear ya.
I thought it was something cool I’d never heard of, you had me all excited.
about 1 year ago
IOS has a rollback feature called archive. You can find documentation on Cisco’s website.
about 1 year ago
True. Cisco has caught up a bit, but it still isn’t supported natively and not too many people out there know of the Archive feature.