SNMP OID ipNetToPhysicalPhysAddress / PhysAddress Definition for use with WinSNMP API?

250 views Asked by At

I'm trying to understand the format of the OID in SNMP so I completely understand the format of the OID I want to use the new (ipNetToPhysicalPhysAddress) rather than the older (ipNetToMediaPhysAddress).

Using the Net-SNMP pacakge I found from an answer given to this question I see this output:

snmpwalk -v2c -c public 192.168.1.1
IP-MIB::ipNetToPhysicalPhysAddress.12.ipv4."192.168.1.114" = STRING: 0:5:3b:b3:4c:4a

Using wsnmputil I built from the Windows classic examples I see this output:

wsnmputil.exe -v2 get 192.168.1.1 public 1.3.6.1.2.1.4.35.1.4
OID :1.3.6.1.2.1.4.35.1.4.12.1.4.192.168.1.114
ip.35.1.4.12.1.4.192.168.1.114
OCTET STRING - <0x00><0x05><0x3b><0xb3><0x4c><0x4a>

This shows the actual full OID for a given IP as 1.3.6.1.2.1.4.35.1.4.12.1.4.192.168.1.114

I found that the 1.3.6.1.2.1.4.35.1.4 prefix is the ipNetToPhysicalPhysAddress node at https://oidref.com/1.3.6.1.2.1.4.35.1.4

I found that ipNetToPhysicalPhysAddress syntax / type is PhysAddress (SIZE(0..65535)) at https://datatracker.ietf.org/doc/html/rfc4293.html

I found that PhysAddress Represents media- or physical-level addresses as an OCTET STRING at https://www.rfc-editor.org/rfc/rfc2579

That explains the MAC Address provided as an OCTET STRING.

What I'm trying to figure out here is how is the rest of the OID is defined, the 12.1.4.192.168.1.114 part of the OID?

From the snmpwalk output it appears the 12 is a number that is not standardized but 1.4 represents the next part is an IPv4 format (I also see what looks like 2.16 represents the IPv6 address). Perhaps the 4 and 16 is the length of the IP address that follows. Maybe the 1 and 2 are the family?

Does anyone know where the part of the OID that follows ipNetToPhysicalPhysAddress is defined?

TIA!!

1

There are 1 answers

1
user3161924 On

When looking at RFC4293 you see:

--
-- the Internet Address Translation table
--

ipNetToPhysicalTable OBJECT-TYPE
    SYNTAX     SEQUENCE OF IpNetToPhysicalEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
           "The IP Address Translation table used for mapping from IP
            addresses to physical addresses.

            The Address Translation tables contain the IP address to
            'physical' address equivalences.  Some interfaces do not use
            translation tables for determining address equivalences
            (e.g., DDN-X.25 has an algorithmic method); if all
            interfaces are of this type, then the Address Translation
            table is empty, i.e., has zero entries.

            While many protocols may be used to populate this table, ARP
            and Neighbor Discovery are the most likely
            options."
    REFERENCE "RFC 826 and RFC 2461"
    ::= { ip 35 }

ipNetToPhysicalEntry OBJECT-TYPE
    SYNTAX     IpNetToPhysicalEntry
    MAX-ACCESS not-accessible
    STATUS     current
    DESCRIPTION
           "Each entry contains one IP address to `physical' address
            equivalence."
    INDEX       { ipNetToPhysicalIfIndex,
                  ipNetToPhysicalNetAddressType,
                  ipNetToPhysicalNetAddress }
    ::= { ipNetToPhysicalTable 1 }

IpNetToPhysicalEntry ::= SEQUENCE {
        ipNetToPhysicalIfIndex         InterfaceIndex,
        ipNetToPhysicalNetAddressType  InetAddressType,
        ipNetToPhysicalNetAddress      InetAddress,
        ipNetToPhysicalPhysAddress     PhysAddress,
        ipNetToPhysicalLastUpdated     TimeStamp,
        ipNetToPhysicalType            INTEGER,
        ipNetToPhysicalState           INTEGER,
        ipNetToPhysicalRowStatus       RowStatus
    }

ipNetToPhysicalPhysAddress OBJECT-TYPE
    SYNTAX     PhysAddress (SIZE(0..65535))
    MAX-ACCESS read-create
    STATUS     current
    DESCRIPTION
           "The media-dependent `physical' address.

            As the entries in this table are typically not persistent
            when this object is written the entity SHOULD NOT save the
            change to non-volatile storage."
    ::= { ipNetToPhysicalEntry 4 }

ipNetToPhysicalTable is OID 1.3.6.1.2.1.4.35 and ipNetToPhysicalEntry is OID 1.3.6.1.2.1.4.35.1

ipNetToPhysicalPhysAddressis part of the ipNetToPhysicalEntry as 4 so that's where you get 1.3.6.1.2.1.4.35.1.4

This is where the rest of the OID is defined:

    INDEX       { ipNetToPhysicalIfIndex,
                  ipNetToPhysicalNetAddressType,
                  ipNetToPhysicalNetAddress }

The types of these entries can be found in RFC4001

The ipNetToPhysicalIfIndex is defined as a InterfaceIndex which is defined as:

-- InterfaceIndex contains the semantics of ifIndex and should be used
-- for any objects defined in other MIB modules that need these semantics.

InterfaceIndex ::= TEXTUAL-CONVENTION
    DISPLAY-HINT "d"
    STATUS       current
    DESCRIPTION
            "A unique value, greater than zero, for each interface or
            interface sub-layer in the managed system.  It is
            recommended that values are assigned contiguously starting
            from 1.  The value for each interface sub-layer must remain
            constant at least from one re-initialization of the entity's
            network management system to the next re-initialization."
    SYNTAX       Integer32 (1..2147483647)

The ipNetToPhysicalNetAddressType is defined as a InetAddressType which is defined as:

InetAddressType ::= TEXTUAL-CONVENTION
    STATUS      current
    DESCRIPTION
        "A value that represents a type of Internet address.

         unknown(0)  An unknown address type.  This value MUST
                     be used if the value of the corresponding
                     InetAddress object is a zero-length string.
                     It may also be used to indicate an IP address
                     that is not in one of the formats defined
                     below.

         ipv4(1)     An IPv4 address as defined by the
                     InetAddressIPv4 textual convention.

         ipv6(2)     An IPv6 address as defined by the
                     InetAddressIPv6 textual convention.

         ipv4z(3)    A non-global IPv4 address including a zone
                     index as defined by the InetAddressIPv4z
                     textual convention.

         ipv6z(4)    A non-global IPv6 address including a zone
                     index as defined by the InetAddressIPv6z
                     textual convention.

         dns(16)     A DNS domain name as defined by the
                     InetAddressDNS textual convention.

The ipNetToPhysicalNetAddress is defined as InetAddress which is defined as:

InetAddress ::= TEXTUAL-CONVENTION
    STATUS      current
    DESCRIPTION
        "Denotes a generic Internet address.

         An InetAddress value is always interpreted within the context
         of an InetAddressType value.  Every usage of the InetAddress
         textual convention is required to specify the InetAddressType
         object that provides the context.  It is suggested that the
         InetAddressType object be logically registered before the
         object(s) that use the InetAddress textual convention, if
         they appear in the same logical row.

         The value of an InetAddress object must always be
         consistent with the value of the associated InetAddressType
         object.  Attempts to set an InetAddress object to a value
         inconsistent with the associated InetAddressType
         must fail with an inconsistentValue error.

         When this textual convention is used as the syntax of an
         index object, there may be issues with the limit of 128
         sub-identifiers specified in SMIv2, STD 58.  In this case,
         the object definition MUST include a 'SIZE' clause to
         limit the number of potential instance sub-identifiers;
         otherwise the applicable constraints MUST be stated in
         the appropriate conceptual row DESCRIPTION clauses, or
         in the surrounding documentation if there is no single
         DESCRIPTION clause that is appropriate."
    SYNTAX       OCTET STRING (SIZE (0..255))

Note that (SIZE (0..255)) means there is a SIZE followed by the data which can be 0 to 255 bytes in length. Therefore SIZE max value is 255.