Basic JUNOS CLI commands for Juniper router and switches

Here is a list of basic JUNOS commands. Enjoy !

Basic Interfaces

M Series and T series : fe-2/1/0
fe: Type of Interface
2 : FPC
1: PIC
0 : Port

EX switch series : ge-0/1/2
ge: Type of Interface
0 : FPC or Virtual Chassis Member Number
1: Module
2 : Port

lo0 : The loopback interface : You can configure address here that are not tied to a specific interface.
me0 : The out of Band Ethernet Interface : You can use this interface to manage the device.
vme : The Virtual Management Ethernet Interface : In an EX series switch Virtual Chassis System, this interface is reachable through any of the me0 interfaces on the switches that are part of the Virtual Chassis System.
vlan : The VLAN interface : This interface allows you to configure an EX series switch to have a routed Layer 3 interface for a VLAN by associating the VLAN with a particular unit on the special VLAN interface. 

User account

[edit]

edit system login user [user name]
set uid xxx
set class super-user
edit authentication

set plain-text-password

New password; xxxxx
Retype new password; xxxxx

Shut down interface

[edit]
set interface ge-0/0/1 disable
To complete admin shutdown a port.
delete interface ge-0/0/1 disable 
To bring the interface back.

Aggregated Ethernet

[edit]
edit chassis aggregated-devices
[edit 
chassis aggregated-devices]
set ethernet device-count 3 To define how many aggregated interface needed. 3 in this case.

[edit]
set interfaces ge-0/0/0 ether-options 802.3ad ae0

set interfaces ge-0/0/2 ether-options 802.3ad ae0
set interfaces ae0 aggregated-ether-options minimum-links 1
set interfaces ae0 aggregated-ether-options lacp active
set interfaces ae0 unit 0 family ethernet-switching port-mode access : access mode 
L2 ae port.

set interfaces ge-0/0/0 ether-options 802.3ad ae0
set interfaces ge-0/0/2 ether-options 802.3ad ae0
set interfaces ae0 aggregated-ether-options minimum-links 1
set interfaces ae0 aggregated-ether-options lacp active
set interfaces ae0 unit 0 family ethernet-switching port-mode trunk : trunk L2 ae port. 
set interfaces ae0 unit 0 family ethernet-switching vlan members [ xx xx xx ] 
set interfaces ge-0/0/0 ether-options 802.3ad ae0
set interfaces ge-0/0/2 ether-options 802.3ad ae0
set interfaces ae0 aggregated-ether-options minimum-links 1
set interfaces ae0 aggregated-ether-options lacp active
set interfaces ae0 unit 0 family inet address 10.0.0.2/30 : L3 ae port

Trunk 

[edit interface]
set ge-0/0/1 unit 0 family ethernet-switching port-mode trunk
set ge-0/0/1 unit 0 family ethernet-switching vlan member [ 2 3 4 ]
set ge-0/0/1 unit 0 family ethernet-switching native-vlan-id default
: Without 802.1q tag a packet will be received.

[edit interface]
run show vlans 2 ( ex: default detail )

Routed VLAN 

[edit vlan]
set [vlan name] l3-interface vlan.100
[edit interface vlan]
set unit 100 description Example
set unit 100 family inet address 192.168.x.x/24

Log commands

show log chassid | no-more To check log for chassi events.
show log messages | no-more
To check log messanges.
show log messages | last 100 To check log messanges in last 100 entries.
show log security | match so-2/0/0
To check user “xxxx” commands
show log isis
To check a status of isis with alarms
show log bgp.ibgp
To check a bgp related event
show log user
To check user’s login history 

System commands

show system uptime To check time since system and processes started
show system users
To check users who are currently logged in
show cli authorization
To see authorization and authentication information
show system storage
To see local storage data
show system processes
To check system process table
show chassis hardware
To check installed hardware components
show chassis environment
To check component status and temperature, cooling system speeds
show chassis routing-engine
To check routing engine status
show chassis craft-interface
To see craft interface status
show chassis fpc
To show flexible PCI concentrator status
show chassis scb
To check system control board status
show chassis alarms
To see alarm status

Interface commands

show configuration To check current configuration
show configuration | display set To check current configuration

show interface terse | detail To display terse output
show interface description To display all description of interface 
show interface interface-name To check status of interface

show interface ge-1/0/0 extensive To check details of the interface
show interface ge-1/0/0 brief
show interface so-1/0/0 detail
show ehternet-switching interface ge-1/0/0

show vlans [name of vlan] detail To see details of vlan and tagged interfaces.
show vlans [name of vlan] extensive To see extemsive of vlan and tagged interfaces.

show interface terse | match “ge-0/0/[67]” To show two interfaces of ge-0/0/6 and 7.
clear interfaces statistics so-2/0/0 To clear counters on interface

MAC table and ARP

show ethernet-switching table To show vlans, mac-address and type from which interface.
show ethernet-switching mac-learning-log

Spanning Tree

[edit]
set protocols rstp
 
To enable RSTP protocol
.
set protocols rstp bridge-priority 20k
set protocols rstp interface ge-0/0/1.0 disable
set protocols rstp interface ge-0/0/1.0 cost 1000
set protocols rstp interface ge-0/0/1.0 edge <– Same as Cisco portfast command.
set protocols rstp interface ge-0/0/1.0 mode point-to-point For the backup link.

[edit]
show protocols stp | display set
show spanning-tree bridge
show spanning-tree interface
show ehternet-switching interface

Routing commands

show route x.x.x.x/24 To check route on routing table
show route terse To display terse output of routes
show route detail To display detailed output
show route 216.142.248.0 extensive

BGP commands

show bgp summary To see overview of BGP information
show bgp group To check the BGP group database
show bgp neighbor x.x.x.x To check a status bgp neighbors
show route receive-protocol bgp ‘x.x.x.x’ To check what routes are advertising thru peer
show route protocol bgp x.x.x.x/24 To check a route on bgp routing table
show route protocol bgp receive-protocol bgp neighIP To see what routes are receiving
show policy static-bgp
clear bgp neighbor x.x.x.x
To clear particular BGP neighbor from BGP table
clear bgp neighbor as
To clear AS from BGP table

 

ISIS commands

show isis adjacency To IS-IS adjacency database
show isis interface To IS-IS interface information
show isis database To IS-IS link-state database

MPLS commands

show mpls lsp terse To display terse output
show mpls lsp name DCA-POR detail

Security & Policy commands

show firewall | match “ICMP” To check current status of filter named “ICMP”
show policy static-bgp or ‘policy name’ To check policy statement
clear firewall ICMP To clear counters on firewall named “ICMP”

Ping & Traceroute

ping rapid count 1000 size 1400 x.x.x.x
ping rapid count 1000 size 1400 pattern 0000 198.6.1.1
ping x.x.x.x bypass-routing interface so-1/0/2 count 1000 size 1400 rapid

Rename & Replace

Rename : Useful for renaming single elements.
Replace :  Useful for changing all references from one interface to a new interface.

* If target interface is already configured, those command won’t work.

rename interfaces ge-0/0/5 to ge-0/0/6
[edit interface ge-0/0/1]
rename unit 0 family inet address 10.10.10.1/24 to address 20.20.20.1/24
replace pattern ge-0/0/3 with ge-0/0/6

Copy configuration

copy interfaces ge-3/0/5 to ge-3/0/6

 * If target interface is already configured, those command won’t work.

Commit

commit check
commit at “2012-12-22 00:00” To apply configure in future time.
commit confirmed 1 : commit confirmed will be automatically rolled back in 1 minutes unless commit complete.
commit and-quit

Rollback

[Edit]
rollback or rollback 0 To rollback previous configuration.
show | compare rollback 4 To compare current configuration with rollback 4.
show | compare To compare current with candidate configuration.

   

Leave a Reply