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. :)

Colby

Colby Glass has been in IT since 2002. He is currently a Systems Engineer (presales) with a Cisco Gold partner and holds the CCNP R/S, CCNP DC, CCDP, CCIP, JNCIA-ER.

More Posts