Junos commands you might not aware of

So there is a Junos commands you might not aware of which can make your dealing with configuring a Junos device much easy and simple ! Lets take a look at some of them !

  • ‘rename’ command:

lab@ex-1# rename ge-0/0/6 unit 1 to unit 0

while configuring a switch , accidentally you configure unit 1 to an interface and you cannot commit the configuration because there no such a unit 1 with layer 2 interfaces on EX series switches . So instead of rolling back / deleting wrong configuration , you can simply rename the configuration to the correct one .

  • ‘wildcard’ command:

[edit interfaces]

lab@ex-1# wildcard delete ge-*

matched: ge-0/0/6

matched: ge-0/0/7

matched: ge-0/0/8

delete 3 objects? [yes,no] (no) yes

if you need to delete a lot of line that having something in common , like deleting gig interfaces , you can simply use the ‘wildcard’ command

  • pipe match pipe filter command

user@switch> show interfaces terse | match “interface|0/6|0/7″

Interface Admin Link Proto Local Remote
ge-0/0/6 up down
ge-0/0/6.0 up down eth-switch
ge-0/0/7 up up
ge-0/0/7.0 up up eth-switch

showing multiple matching outputs .

  • ‘copy’ commad

[edit interfaces]

# copy ge-0/0/6 to ge-0/0/7

The copy command duplicates an interface including any child statements such as description.

  • ‘replace’ commad

# replace pattern lopbck with loopback

Make global changes to text patterns in the configuration. For example, if you consistently misspell a word common to the description statement for all of the interfaces on your device, you can fix this mistake with a single command.

  • ‘insert’ command

[edit security policies]
# insert from-zone trust to-zone untrust policy 1 before policy 2

You can use the insert (before/after) to re-order policies instead of deleting and configuring again .

  • ‘refresh’ command

admin@FW> show chassis routing-engine | match Idle | refresh 5                                                         
—(refreshed at 2017-05-03 12:12:24 IDT)—
Idle                      14 percent
Idle                      74 percent
—(refreshed at 2017-05-03 12:12:29 IDT)—
Idle                      14 percent
Idle                      74 percent
—(*more 100%)—[abort]

This command will refresh the output ecery <n> seconds .

SFP port not compatible with Transceiver module

So that just happened to me yesterday! let’s talk about it!

We had to connect one EX4200 switch to another EX4200 switch via the SFP port.

Now as you may know, the EX4200 had a 10gig SFP port , and we only had a 1000BASE-LX SFP Transceiver module (FTRJ1319P1BTL) . pluging that transceiver into the SFP port , but the port does not go up , no light , and when showing the interface we receive the following error: ‘device not found’ .

So, the temporary solution was, is to change the operating mode of the SFP port, using the following command:

# set chassis fpc 0 pic 1 sfpplus pic-mode 1g


The-End 🙂

How to view SFP info and properties in JunOS machine

In order to find out info of SFP installed in the Junos machine without taking out the SFP module, do the following commands:

  • Log in to the shell of the relevant FPC. For this example I’ll use fpc4:

master@SW-QFX5100> start shell pfe network fpc4

  • show sfp list

(vty)# show sfp list
SFP Toolkit summary:
wakeup count: 47223201, debug: 0, periodic enabled: 1, diagnostics enabled: 1
thread: 0x03deaa78, itable: 0x03ddd868, itable iterator: 0, sem: 0x03e36fe8
polling interval delay:  1000 ms, polling max cpu:  100 ms
poll for diags every  3 wakeups , SFPs polled for diags last time:  2
last periodic CPU time:    1 ms, maximum periodic CPU time:     82 ms
SFP Toolkit syslog throttling parameters:
period: 120 samples , disable threshold:  10, enable threshold   0

Index   Name             Presence     ID Eprom  PNO         SNO          calibr
—–   ————–   ———-   ——–  ———-  ———– ——-
1   Uplink SFP+ PIC(2)      Present   Complete  740-021333  AB33333         int
2   Uplink SFP+ PIC(3)      Present   Complete  740-021222  AB22222         int

I2C Acceleration table
Index   Name             Presence     ID Eprom     Reg ID    I2C Master    I2C Group
—–   ————–   ———-   ——–    ——–    ————   ——-

(vty)# show sfp 1   ?
<carriage return>     Completes command
alarms                SFP diagnostics alarms
diagnostics           display diagnostic measurements and thresholds
info                  SFP information

  • You can use only “show sfp <index of installed sfp>” and you’ll get those kind of information for example:



EX mib2 errors

The following MIB2D error is viewed in the log messages:

VC10 mib2d[1282]: MIB2D_KVM_FAILURE: tu_kread: kvm_read returns error: short read

Here is a description of the problem:

The error is generated because SNMP is trying to collect data on the TCP connections of the switch and this data might be incorrect.
What actually is happening is that mib2d is working on 32 bits whereas the kernel is using 64 bits.
When mib2d is requesting data from the kernel, it’s receiving an 8byte pointer, which is truncated by mib2d to 4 byte pointer.
Then the mib2d is requesting that data by providing the 4 byte pointer. If that pointer doesn’t exist, then this message is returned.

The work-around for this is the following steps:

restart mib-process

restart snmp

These two commands will restart both the snmp and mib2d process. There will be no traffic impact doing this. Should this not work, you will want to reboot the switch.

This is not a permanent fix however and the messages may reappear in some time.
This bug has been reported and deal in this PR 1007305 [Confidential, Mistaken] – “DAEMON-3-MIB2D_KVM_FAILURE: tu_kread: kvm_read returns error: short read” messages seen in the logs
A more robust approach for mib2d to gather kernel information was implemented in Junos version R15.1
The fix for this situation is in Junos 15.1 version.
Please do an upgarde.

Contemporary temperature measurement in Junos

In order to contemporary measure temprature on junos device , you’ll need to send specific SNMP traps to the SNMP clients configured on the junos device . In this article I’ll take EX switch 12.3R9 as an example.

First, configure the SNMP client/s and other configurations related to our situation:

set snmp client-list SNMP-RO
set snmp community TEST-ro authorization read-only
set snmp community TEST-ro client-list-name SNMP-RO
set snmp trap-options source-address
set snmp trap-group TEST-ro version v2

While is the server which is pulling out this traps, e.g : PRTG

You need to know which temprature you need to pull. So run the command: show chassis environment on the EX switch:


Now, you need to find the related OID for this temprature, follow KB17526 to find this out. You’ll see it is : jnxOperatingTemp . and it is

So run this command on switch to find the full OID of the specific FPC / sensor :

sh sn mib walk


So you’ll need to run on the SNMP server (for example PRTG server) the following OID: in order to get contemporary temprature on FPC 0 Sensor CPU Die Temp

Note: There is no specific values as timeout. The moment when the command is issued the temperature output are collected from the device when the help of sensors.

Changing temperature thresholds on EX switch

Since we wanted to receive alarms from Junos Space / Network Director about tempretures on EX switches , its possible . But if you want to receive temp. alarms once switch reaches specific temp. , then it need to be confgured on the EX .


Note: Change of Temperature thresholds on EX switch is not recommended by JTAC.


Tested by me on EX switch 3300 , JunOS: 12.3R9


This is hidden command , so type “set chassis temperature-threshold ?” at once


master@SW-EX3300# set chassis temp
syntax error.
master@SW-EX3300# set chassis temperature-threshold ?
Possible completions:
+ apply-groups Groups from which to inherit configuration data
+ apply-groups-except Don’t inherit configuration data from these groups
fire-shutdown Threshold at which router will be shutdown within 10 seconds (degrees C)
red-alarm Threshold at which red alarm is set (degrees C)
red-alarm-if-failed-fan Threshold at which red alarm is set when bad fan present (degrees C)
yellow-alarm Threshold at which yellow alarm is set (degrees C)
yellow-alarm-if-failed-fan Threshold at which yellow alarm is set when bad fan present (degrees C)
master@SW-EX3300# set chassis temperature-threshold red-alarm ?
Possible completions:
<red-alarm> Threshold at which red alarm is set (degrees C)