Description

The SNMP ifIndex information stored in a text format file,   dcd.snmp_ix . This article explains why different devices will show different ifIndex information.

Symptoms

You can get the detail from the output of the  command file show /var/db/dcd.snmp_ix.  However, the index of the interface is different even for the same module device.
Example

We use two SRX220 devices as an example. These two SRX220 devices have the same hardware as seen below:

root@SRX-220-1> show chassis hardware
Hardware inventory:
Item             Version  Part number  Serial number     Description
Chassis                                AR0613AA0023      SRX220H-POE
Routing Engine   REV 20   750-031177   AAFP8053          RE-SRX220H-POE
FPC 0                                                    FPC
  PIC 0                                                  8x GE Base PIC
Power Supply 0 
 
root@SRX-220-2> show chassis hardware
Hardware inventory:
Item             Version  Part number  Serial number     Description
Chassis                                AR0613AA0014      SRX220H-POE
Routing Engine   REV 20   750-031177   AAFP7980          RE-SRX220H-POE
FPC 0                                                    FPC
  PIC 0                                                  8x GE Base PIC
Power Supply 0 

However, the ge-0/0/1 of SNMP  ifIndex  is different:

root@SRX-220-1> file show /var/db/dcd.snmp_ix |match ge-0/0/1  
    510 "ge-0/0/1" 0 0 1;
    511 "ge-0/0/1" 0 1 1;
 
root@SRX-220-2> file show /var/db/dcd.snmp_ix |match ge-0/0/1
    509 "ge-0/0/1" 0 0 1;
    525 "ge-0/0/1" 308 1 1;
    527 "ge-0/0/1" 32767 1 1;
    529 "ge-0/0/1" 0 1 1;

Solution

The index is not predefined, it is monitored and created by mib2d dynamically. When a new interface is created in the system, mib2d checks for an entry of the interface in the file /var/db/dcd.snmp_ix . If the entry for this index is present, the system then picks the SNMP interface index value from this file, or else it assigns a new interface index value and writes it to this file.

Since the file is maintained across reboots, the next time the same interface is deleted and re-created, the SNMP ifIndex does not change. The assignment of the interface index primarily depends on the order in which it is created. Thus, the value is different in a different machine.

This behavior is by design. The index is not predefined, it is monitored and created by mib2d dynamically. Thus, there is no guarantee that the SNMP index values will be the same on two different machines.