title: Juniper Junos General breadcrumbs:
TODO Clean up, reorganize and add remaining stuff.
{:.no_toc}
TODO Cleanup.
?
<cmd> | <filter>
<cmd> | match <regex>
<cmd> | count
<cmd> | refresh <seconds>
(e.g. show x | match y | refresh 5
)Ctrl+A
(start) and Ctrl+E
(end)Ctrl+U
(cut) and Ctrl+Y
(paste)Ctrl+R
+ searchMeta+.
(typically Alt+.
)h
for help).<cmd> | no-more
g
(start) or G
(end)/
(forwards) or ?
(backwards)m
c
help topic <topic>
help reference <reference>
help syslog <symbol>
show system uptime
show version [and haiku]
show system processes brief
show chassis routing-engine
cli
start shell user root
request session member <vc-member-id>
show cli
set cli timestamp
configure {<omit>|exclusive|private}
exclusive
to avoid having other users make changes in config mode at the same time.private
to start a separate/private config mode session, independent of other users. This is weird and rarely used.exit
system login
section to check.show configuration [statement]
show [statement]
show | compare
show configuration | display set
show configuration | except SECRET-DATA
show system commit
show system rollback <n>
(1 is the last etc.)show configuration | compare rollback <n>
show system rollback <n> compare <m>
show configuration | display detail
(add | except "##$"
to omit empty comment lines)show | display inheritance
/config/
, the rest (up to some count) are stored in /var/db/config/
./config/juniper.conf.gz
.run <command>
edit <path>
up
or top
show
wildcard range set int ge-0/0/[0-47] unit 0 family ethernet-switching
(example)rename <a> to <b>
insert <b> before <b>
copy <a> to <b>
delete <element>
replace pattern <a> with <b>
annotate <element> "<comment>"
deactivate <element>
activate <...>
to undo.protect <element>
unprotect
to undo.show configuration
: Set apply-flags omit
inside the section
show configuration | display omit
to override and show omitted sections too.commit [comment <comment>] [confirmed <minutes>] [synchronize]
confirmed
automatically rolls back the commit if it is not confirmed within a time limit. Run commit check
(or commit
to also create a new commit) to confirm changes and prevent rollback.and-quit
will quit configuration mode after a successful commit.synchronize
will apply the change to all REs. It can be configured as the default.commit check
at <time>
to commit at a later time. Use commit check
first to avoid config errors when it happens.rollback <n>
(use ?
to show log), then commitrollback 0
groups <name>
.<ge-*>
instead of ge-0/0/0
etc.apply-groups <name>
apply-groups-except <name>
show | display inheritance
set policy-options prefix-list RADIUS_SERVERS apply-path "system radius-server <*>"
load merge terminal [relative]
, paste, Ctrl+D
(relative
for relative path)set
's and delete
's etc.): load set terminal
, etc.+
'es and -
'es etc.): load patch terminal
, etc.load override terminal
, then Ctrl+D
without typing anything.terse
(very brief)brief
detail
extensive
(very verbose)<cmd> | save <destination>
/var/log/messages
/var/log/chassisd
.show log <log>
(for file /var/log/<log>
)show log interactive-commands
show system commit
monitor start
(stop with monitor stop
)ping <target> [options]
... source <address>
... rapid
... count <n>
... size <n>
(might fragment, max ICMPv4 size is MTU minus 28)... do-not-fragnent
... pattern <something>
traceroute [monitor] <target>
minitor interface <...>
(use keyboard shortcuts for bits/bytes, rate/delta, etc.)minitor interface traffic
minitor interface <interface>
monitor traffic interface <interface> [...]
- Example: monitor traffic interface ge-0/0/4 no-resolve size 1500 count 20 matching "ip proto ospf"
- Only shows "local" traffic (to/from the system, not forwarded).
- Supports standard tcpdump-like PCAP filtering as the (quoted) matching
argument.
- Write to PCAP file: <...> write-file <file>
file <...>
/var/home/
./var/tmp/
(not /tmp/
, it's tiny).The devices have two partitions; the primary and the backup. One of them will be designated as active and that choice will be remembered across reboots. When the active partition is damaged, the device will boot into the other partition. When the backup partition is the active partition, an alarm will be set and a banner shown.
Change active partition and reboot: request system reboot slice alternate media internal
The devices should be shut down gracefully instead of just pulling the power. This will prevent corrupting the file system.
shutdown -h now
or halt
request system <halt|power-off> [local|all-members|member <member-id>]
Wait for the "The operating system has halted." text before pulling the power, so that system processess are stopped and disks are synchronized. The system LED turning off and the LCD saying "HALTING..." does not mean that the halting process is finished yet.
request system <halt|reboot> [local|all-members]
halt
, it will print "please press any key to reboot" when halted.request system zeroize
show chassis alarms
show chassis environment
show chassis routing-engine
show <configuration> | display inheritance
scp <config> <device>:/config/juniper.conf.new
load override /config/juniper.conf.new
file delete /config/juniper.conf.new
show interfaces terse
show interfaces routing
show interfaces brief
show interfaces statistics
show interfaces detail
show interfaces media
show lldp neighbors
help syslog SNMP_TRAP_LINK_DOWN
(op mode) (example)run show log escript.log | last
20.4R3-S1.3
<year>.<quarter>[R1-3][-S...]
R1
to R3
(no suffix for the initial release).system auto-snapshot
on single-flash devices to make them automatically rebuild the alternate partition in case of corruption.loader>
prompt.boot -s
to boot into single-user mode.recovery
.request system zeroize
(this will delete all configuration).Note: USB3 drives may not work properly. Use USB2 drives.
ls -l /dev/da*
mkdir /var/tmp/usb0 && mount_msdosfs <device> /var/tmp/usb0
(arbitrary path)ls -l /var/tmp/usb0
umount /var/tmp/usb0 && rmdir /var/tmp/usb0
request system storage cleanup [dry-run]
(dry-run
to show only)request system snapshot
(maybe with slice alternate
, depending on the box)show system snapshot [media internal]
file copy <remote-url> /var/tmp/
- If it says it ran out of space, add staging-directory /var/tmp
. By defaults it's buffered on the root partition, which may be tiny.
- Alternatively, copy the file into the device from the remote device.request system software add <file>
no-copy unlink
to remove the file afterwards, typically for systems with little free space.reboot
to automatically reboot and begin upgrade.request system reboot
mkdir /var/tmp/usb0 && mount_msdosfs <device> /var/tmp/usb0
ls -l /var/tmp/usb0
cp /var/tmp/usb0/jinstall* /var/tmp/
umount /var/tmp/usb0 && rmdir /var/tmp/usb0
cli
request system software add <file> no-copy reboot
no-validate
.show system storage partitions
show system snapshot media internal
request system snapshot slice alternate
show system snapshot media internal
If the method above did not work, try this instead to completely format and flash the device.
install --format file:///jinstall-whatever.tgz
This procedure clones the active partition to the alternate partition.
This is also how you would clone to and boot from a USB device, but with media external
instead of both media internal
and slice alternate
.
request system snapshot slice alternate
show system storage partitions
show system snapshot media internal
To boot to the alternate partition, use request system reboot slice alternate media internal
.
If one of the root partitions get corrupted (e.g. due to sudden power loss), the device will boot to the alternate root partition. This can be fixed by cloning the new active partition to the alternate, corrupt partition.
See Copy the Active Root Partition or [EX] Switch boots from backup root partition after file system corruption occurred on the primary root partition (Juniper).
lo
: Loopback.ge
: Gigabit Ethernet.xe
: 10G Ethernet.et
: 40G Ethernet.em
and fxp
: Management, possibly OOB.TODO
{% include footer.md %}