Show Menu
Cheatography

Junos OS CLI Cheat Sheet (DRAFT) by

Introduction to Junos OS

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Interface Naming

FCP [Flexible PIC concen­trator]
| The actual card itself
PIC [Physical Interface Card]
| interface card within a Line Card
Port
| The port number on the card
ge
| 1 gig
xe
| 10 gigs
et
| 40 gigs
ge-0/1/1
| Gig, line card
fxp0
| is the name of the mgmt interface
The text fpc 0 refers to the line card on this device, whilst you might remember that PIC is an interface card within this line card.

CLI Junos OS

Junos is set up in a directory fashion like Linux distri­butions
Results can be viewed in one of two ways
Set View | Line by line as in Linux distri­butions
Hierarchy View | Code writing type display

Unders­tanding Hierarchy [Direc­tory] Structure

Level 1 | version
Level 2 | system
Level 3 | chassis
The chassis hierarchy is where you configure physical device settings for your Junos device. This is also where you can configure device settings for your vMX.
Level 4 | interfaces
Level 5 | protocols
Up - will back up one level in the directory
Top - will move to the root directory

Sub Hierar­chies

host name
root-a­uth­ent­ication
log in
All sub hierar­chi­es—it will be indented once to the right, when compared to the top-level hierar­chies.

Show Command Level of Inform­ation Returned

show interface
descri­ptions
 
terse
IP and interface state
 
brief
 
detail
 
extensive
wildcard search
ex-0/1/*

Extending the Commands with a Pipe

Pipes help narrow search results
| count
 
| find
 
| save
You can use multiple pipes in one search
show interfaces xe-0/1/* | match "­phy­sical | count"
after pipe goes in quotes

Keyboard Shortcuts

ctrl-a
| beginning of the command line
ctrl-e
| end of the command line
ctrl-k
ctrl-w
| deletes the word

Logs

Create syslog file
| set system syslog file CONFIG­_CH­ANG­ES.txt change-log any
Edit the properties of syslog file
| set system syslog file CONFIG­_CH­ANG­ES.txt archive size 1M files 4 no-wor­ld-­rea­dable
Read log file
| show log CONFIG­_CH­ANG­ES.txt
Rerad log files in real time
| monitor start messages
 
| monitor stop messages

Deleting

 
| delete protocols ospf
 

Show Command Basic System Inform­ation

show config­uration | display set
| This displays the full device config
show system uptime
| Displays current time, last system boot
show system inform­ation
| Displays the model, OS family, OS version & hostname
show route
| Displays the routing table
show system users
| Displays currently logged in users
show config­uration system services | display set
| Displays running services
show config­uration system login |display set
| will display any users built on this device
show config­uration interfaces | display set
show config­uration interfaces ge-0/0/2 | display set
show config­uration protocols | display set

Config­uration Mode Levels

employ­ee@­rou­ter_1 > configure
creates a duplicate [candi­date] file multiple people can edit the same candidate record
employ­ee@­rou­ter_1 > configure private
each editor has their own copy of the candidate record however, users can still save on top of each other
employ­ee@­rou­ter_1 > configure exclusive
locks the candidate record; no one else can modify

Config­uration Mode

employ­ee@­ROU­TER_1 >
configure
employ­ee@­ROU­TER_1#
In Config­uration Mode
commit check
| verifies syntax
show | compare
| displays the differ­ences between the 2 configs
rollback
| returns to the previous config­uration
commit confirmed 20
| commits config must confirm in 20 minutes or auto rollback
commit confirmed w/ no time
| Defaults to 10 minutes
commit and-quit
commit comment
| allows user to ad comments to config file
 
show
| must add the word "­run­" to any command at this level
commit at "­18:­00:­00"
| sets time for commit
commit at " 2023-10-06 14:00:­00"
| sets commit day and time
clear system commit
 
Example
Change device name
| set host-name ROUTER_1

LLDP - Link Layer Discovery Protocol

show lldp neighbors |
hostname
 
port name
 
MAC
 
POE ability
 
Vendor
All devices must have LLDP configured for this to work

Troubl­esh­ooting

disable port
| set interfaces ge-0/0/2 disable
enable
| set interfaces ge-0/0/2 enable
commit and-quit

Troubl­esh­ooting

show config­uration system syslog
| messages & intera­cti­ve-­com­mands
 
show log messages
 
show log intera­cti­ve-­com­mands
 
shoe log intera­cti­ve-­com­mands | match "­wor­d"
script logging is indicated by the word "­net­con­f"
Narrow log results
show log intera­cti­ve-­com­mands | match lab | last 15
 
show log intera­cti­ve-­com­mands | match "word 1" "word 2"
 
show log messages | match "­dow­n|e­rro­r"
 
Send a syslog
scp /var/l­og/­CON­FIG­_CH­ANG­ES.txt lab@17­2.2­5.1­1.254:home/­lab­/de­sktop
By default, logs are stored in /var/log