Juniper commands | Most basic CLI Commands list for JunOS Router

Most Useful and important JunOS router Commands for Begginer:

This article contain some of most frequent used commands of Juniper devices those are very helpful, especially for beginner those are new to juniper networks.

Before going into Commands details you should know that there are different commands mode on juniper same like Cisco. So you must know about every command where to type it. You can simply differentiate into these modes into 
·         command-line interface (CLI)
·         Configuration mode

How to login into Juniper router:

Simply type user name and password, default username and password for JunOS Olive 12.1 is root with no password.
Login: root
password:


How to enter into Command-line interface mode:

After logging into JunOS by your user name and password, you can enter into Command-line interface by typing CLI
root@% cli
root>

How to access configuration mode on Juniper:

You can enter into configuration mode by typing configure in configuration mode.
root> configure
[edit]
root#

How to check current configurations on Juniper:

In cli mode:
root> show configurations

Show configurations with include specific group of commands:

This command will show all the command from configuration starting with "Set"
root> show configurations | display set

How to check all interfaces on Juniper:

You can show all the interface on Juniper with following command:
root# show interfaces

How to see status of specific interface on Juniper:

root# show interfaces <interface name>
Command example:
root# show interfaces em0

How to set the IPv4 address of juniper router:

In Configuration mode you can use the following command:
set interfaces  <interface-name> unit <unit number> family inet <IP address>/mask
Suppose you want to set IP address 22.2.2.2 to interface ge-0/0/2 you can do it like this:
set interfaces ge-0/0/2 unit 0 family inet 22.2.2.2/24

How to set host name on Juniper Router:

root# set system host-name <type-name>

How to set root's password on JunOS:

In configuration mode type the following command for setting password for juniper router.
set system root-authentication plain-text-password

How to save your current configuration on Juniper:

You can use the Commit command for saving configuration on Juniper, if you having any issue in save configuration you see error in saving configuration onjuniper for troubleshooting.
root# commit

How to see the all routes on JunOS:

root> show route

How to setup gateway or static route for Juniper:

Following command will set a static route for network 222.0.0.0/32.
root# set routing-options static route 222.0.0.0/32 next-hop 172.16.1.1

Configure different routing protocols with Juniper:

You can use the set protocols command in configuration mode for configuring different routing protocols on JunOS, some of commands examples are as listed below. But you can see more details regarding each routing protocols with given links or explore more with google.

root # set protocols rip group rip-routes neighbor em0           RIP on JunOS
root # set protocols ospf area 0.0.0.0 interface em0               OSPF on JunOS
root # set protocols isis interface em0

note: All above commands are tested on JunOS 12.1.x

If you want to Learn Basic Cisco commands, click here.

Single area OSPF Configuration in JunOS on GNS3 | Lab Example

How to configure Open Shortest Path First on juniper:

OSPF is an IGP which mean it will route packets within a single autonomous system. OSPF is a link-state routing protocol, OSPF make routing decisions using the SPF algorithm (also known as the Dijkstra algorithm). You can configure OSPF version 2 and version 3 with JunOS. For OSPF configuration on JunOS you need to identify the interfaces that will participate in OSPF. You must enable OSPF on all interfaces within the network on which OSPF traffic is to travel. OSPF uses a router identifier for originating packets from device.  

Lab Details:

Gns3 version= Gns3 1.1
Junos version=  JunOS Olive 12.1 VM image
VM VirtualBox version=  4.2.4 
System OS= Windows 8.1

Lab Tasks:

We have three JunOS routers in our topology, our task is to configure all the routers in same OSPF area 0.
Few commands are required for the configuration of OSPF on juniper but  if you want to explore how to configure IP addresses to JunOS interfaces you can visit IP & static routing on JunOS.

Configuration of OSPF on JunOS2:

login: root
root@% Cli
root > configure
[edit]
root # set interfaces em0 unit 0 family inet address 172.16.1.1/24
root # set protocols ospf area 0.0.0.0 interface em0
root #Commit
Having issue with commit command visit missing mandatory statement'root-authentication'
learn more about the configuration of junos in gns3 you can see how to configure junos on gns3 and Juniper commands.

Configuration of OSPF on JunOS3:



login: root
root@% Cli
root > configure
[edit]
root # set interfaces em0 unit 0 family inet address 172.16.1.2/24
root # set interfaces em1 unit 0 family inet address 192.168.1.1/24
OSPF Configurations commands
root # set protocols ospf area 0.0.0.0 interface em0
root # set protocols ospf area 0.0.0.0 interface em1
root #Commit

Configuration of OSPF on JunOS4:



login: root
root@% Cli
root > configure
[edit]
root # set interfaces em0 unit 0 family inet address 192.168.1.2/24

root # set protocols ospf area 0.0.0.0 interface em0

How to test lab configuration:

You can ping 192.168.1.2 from JunOS2 and it will be successful in case of correct configurations, also find the show route command output on JunOS2 which is showing some OSPF routes in routing table.

Other Lab Example : Configuration of RIP on Juniper
End  

RIP Configuration between Cisco and Juniper Routers on Gns3 1.1

How to Configure RIP among different vendor routers:

This article is about configuration of RIP routing protocol between Cisco and juniper. RIP is an open standard protocol that's mean you can configure it among different vendors router. RIP have two versions i.e. version 1 & version 2 (which the most advance & standard version of routing information protocol). On Cisco when you enable RIP, by default its run the version 1 and you manually have to configure the version 2. On the other hand junOS enables the version 2 by default.

Lab details:

Gns3: Gns3 version 1.1.X
VitualBox: 4.2.4 
Cisco IOS: Cisco 7200 series
Junos version=  JunOS Olive 12.1 VM image

Beginner and want to learn about JunOS then you can see how to configure junos on gns3 and Juniper commands.

In our topology we have three router j2, j4 & R1, junos2 & junos4 are juniper routers and R1 is Cisco router.
Lab objective:
Configure RIP on all the routers so that they can communicate with each other.
Lab configurations:
You need to perform the following configurations for achieving the above objective.
JUNOS 2 Configuration:
On JUNOS 2 device, both interfaces em0 and lo0 will be configured for RIP. They will be in the same RIP group called rip-routes.
set interface em0 unit 0 family inet 172.16.1.1/24
set interface lo0 unit 0 family inet 111.0.0.1/32
set protocols rip group rip-routes neighbor em0
set policy-option policy-statement advertise-RIProutes from protocol direct
set policy-option policy-statement advertise-RIProutes from protocol rip
set policy-option policy-statement advertise-RIProutes then accept  

set protocols rip group rip-routes export advertise-RIProutes
 "advertise-RIProutes" is the name of policy for RIP, you can learn more about the configuration of RIP on juniper.

Output of run show configuration | display set on JunOS 2:



JUNOS 4 Configuration:
Similarly you will be configure both interfaces em0 & lo0 for RIP with similar RIP group i.e. rip-routes.
set interface em0 unit 0 family inet 192.168.1.2/24
set interface lo0 unit 0 family inet 222.0.0.1/32
set protocols rip group rip-routes neighbor em0
set policy-option policy-statement advertise-RIProutes from protocol direct
set policy-option policy-statement advertise-RIProutes from protocol rip
set policy-option policy-statement advertise-RIProutes then accept  

set protocols rip group rip-routes export advertise-RIProutes

Output of run show configuration | display set on JunOS 4:

R1 Configuration:
On cisco router you need to advertise both network 192.168.1.0 & 172.16.1.0 In RIP routing

interface FastEthernet0/0
 ip address 172.16.1.2 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!
router rip
 version 2
 network 172.16.0.0
 network 192.168.1.0
 no auto-summary

How to test your configurations:
After the correct configuration ping from JunOS2 to 222.0.0.1 should be successful.

Output of Cisco Routing Table:



Output of Routing Table on JunOS 2:



UA-23728446-1