This article explains how to configure a J/SRX device to allow SNMP polling of an interface that is part of a non-default routing instance or a logical system.
For SNMPv3, the configuration and polling method is different and is covered in [Junos] How to pull SNMPv3 information from non-default routing-instance
What is the configuration required to perform an SNMPv1 or v2c poll on an interface that is part of a routing instance or logical system?
To poll an interface that is part of a routing instance, refer to the following example configuration:
[edit] root@host# show interfaces ge-0/0/2 { unit 0 { family inet { address 172.19.46.70/24; } } } [edit] root@host# show routing-instances INTERNET { instance-type virtual-router; interface ge-0/0/2.0; routing-options { static { route 172.19.47.0/24 next-hop 172.19.46.1; } } } [edit snmp] root@host# show community public { authorization read-only; routing-instances INTERNET { clients { 172.19.47.2/32; } } } routing-instance-access;
routing-instances INTERNET {
routing-instance-access;
To poll an interface that is part of a logical system, refer to the following example configuration:
community public { logical-system test { routing-instance default; << This will depend on whether you configure the interface within a routing-instance in the logical system. } } routing-instance-access
If the device is running in flow mode, then the SNMP protocol must be added under the [host-inbound-filter system-services] stanza in the appropriate security zone:
[host-inbound-filter system-services]
[edit security zones] root@host# show security-zone INTERNET { interfaces { ge-0/0/2.0 { host-inbound-traffic { system-services { ping; snmp; } } } } }
In the example, the ge-0/0/2 interface is part of the INTERNET routing instance. The SNMP server should be reachable from the interface that is being polled. To access MIB objects and perform SNMP operations for the routing instances, the SNMPv1 and v2c clients must encode the routing-instance name in the community string in their SNMP requests.
INTERNET
In the above example, the community string for SNMPv1 and v2c requests should look like the following:
INTERNET@public
To access MIB objects and perform SNMP operations on a default routing instance via an interface that is part of a routing instance, the community string for SNMPv1 and v2c requests should be defined as default@public in the SNMP server.
default@public
The same applies for an interface that is configured within a logical system, wherein the community will be similar to the following:
Logical-systemname/routing-instance name@community
For example: To poll the MIB system from routing-instance default in logical-system test-snmp with community juniper.
#snmpwalk -v 2c -c test-snmp/default@juniper 1.1.1.1 system SNMPv2-MIB::sysDescr.0 = STRING: Juniper Networks, Inc. mx480 internet router, kernel JUNOS 21.1R1.2, Build date: 2021-02-12 21:38:31 UTC Copyright (c) 1996-2021 Juniper Networks, Inc. SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::zeroDotZero.0 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (70112895) 8 days, 2:45:28.95 SNMPv2-MIB::sysContact.0 = STRING: SNMPv2-MIB::sysName.0 = STRING: test-snmp/[email protected] SNMPv2-MIB::sysLocation.0 = STRING: SNMPv2-MIB::sysServices.0 = INTEGER: 4
Note: If the device is running in high availability (HA) mode and configured to send SNMP packets from an interface belonging to a custom routing instance, snmp routing-instance-access and snmp community <community-name> routing-instance <routing-instance-name> must be configured. If SNMP packets are from an interface belonging to a custom routing instance under logical-system, snmp community <community-name> logical-system <logical-system name> routing-instance <routing-instance-name> should be configured.
snmp routing-instance-access
snmp community <community-name> routing-instance <routing-instance-name>
<routing-instance-name> should be configured.
For SNMPv3, the configuration and polling method is different and is covered in [Junos] How to pull SNMPv3 information from non-default routing-instance.
2022-08-23: Added unix commands for polling logical system data
2020-06-10: Added information about polling interfaces in a logical system
2018-12-10: Added a sentence in the solution to clarify accessing MIB objects and performing SNMP operations on default routing instance via an interface on routing instance
SNMP Support for Routing Instances
How to troubleshoot the SNMP polling issue
How to pull SNMP v3 information from non-default routing-instance