SNMP::...Layer3(3pm)

πŸ’– SNMP::Info::Layer3 πŸ’–

okay bestie, welcome to SNMP::Info::Layer3, like the third layer of a cake but make it network devices πŸŽ‚βœ¨ it's shipped as part of the User Contributed Perl Documentation and it lives at SNMP::...Layer3(3pm) in your man pages, no cap.


✨ NAME ✨

SNMP::Info::Layer3 β€” the SNMP Interface to network devices serving Layer3 or Layers 2 & 3 🫢


πŸ‘‘ AUTHOR πŸ‘‘

Max Baker


🌸 SYNOPSIS 🌸

okay so here's the whole vibe, copy it, don't improvise:

 # Let SNMP::Info determine the correct subclass for you.
 my $l3 = new SNMP::Info(
                          AutoSpecify => 1,
                          Debug       => 1,
                          DestHost    => 'myswitch',
                          Community   => 'public',
                          Version     => 2
                        )
    or die "Can't connect to DestHost.\n";

 my $class = $l3->class();
 print "SNMP::Info determined this device to fall under subclass : $class\n";

 # Let's get some basic Port information
 my $interfaces = $l3->interfaces();
 my $i_up       = $l3->i_up();
 my $i_speed    = $l3->i_speed();
 foreach my $iid (keys %$interfaces) {
    my $port  = $interfaces->{$iid};
    my $up    = $i_up->{$iid};
    my $speed = $i_speed->{$iid}
    print "Port $port is $up. Port runs at $speed.\n";
 }

look at her go πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

ngl this class is almost always the superclass situation β€” more specific device classes under SNMP::Info::Layer3::* inherit from it πŸ’œ so pls pls pls read all the docs under SNMP::Info first, i'm begging.

It gives you generic methods for pulling SNMP data out of Layer 3 network devices, and yes it also handles Layer2+3 devices, we love an overachiever πŸ”₯

If you're doing it for speed or for debugging, you can call the subclass directly β€” but not after you've already used the method up there to figure out a more specific class, that's the rule bestie 🚫

 my $l3 = new SNMP::Info::Layer3(...);

🧬 Inherited Classes

  • SNMP::Info
  • SNMP::Info::Bridge (For L2/L3 devices)
  • SNMP::Info::EtherLike
  • SNMP::Info::Entity
  • SNMP::Info::PowerEthernet
  • SNMP::Info::IPv6
  • SNMP::Info::LLDP
  • SNMP::Info::DocsisHE
  • SNMP::Info::AdslLine

family tree is giving ✨royalty✨


πŸ“š Required MIBs

  • IP-MIB
  • ISIS-MIB
  • OSPF-MIB
  • BGP4-MIB

🌈 Inherited MIBs

these ones aren't ours, they come from the ancestors, go read their requirements:

  • See "REQUIREMENTS" in SNMP::Info for its MIB requirements.
  • See "Required MIBs" in SNMP::Info::Bridge for its MIB requirements.
  • See "Required MIBs" in SNMP::Info::EtherLike for its MIB requirements.
  • See "Required MIBs" in SNMP::Info::Entity for its MIB requirements.
  • See "Required MIBs" in SNMP::Info::PowerEthernet for its MIB requirements.
  • See "Required MIBs" in SNMP::Info::IPv6 for its MIB requirements.
  • See "Required MIBs" in SNMP::Info::LLDP for its MIB requirements.
  • See "Required MIBs" in SNMP::Info::DocsisHE for its MIB requirements.
  • See "Required MIBs" in SNMP::Info::AdslLine for its MIB requirements.

⭐ GLOBALS ⭐

these are the methods that return a scalar value straight out of SNMP, simple as, periodt.

  • $l3->mac() β€” returns the root port mac address πŸŽ€
    • ("ifPhysAddress.1")
  • $l3->router_ip() β€” grabs it from here:
    • ("ospfRouterId.0")
  • $l3->bgp_id() β€” comes from ("bgpIdentifier.0")
    • Returns the BGP identifier of the local system
  • $l3->bgp_local_as() β€” Returns the local autonomous system number 🫢
    • ("bgpLocalAs.0")

πŸ’… Overrides

these are the ones Layer3 rewrites to do its own thing, main character energy only.

  • $l3->model() β€” tries to reference $l3->id() to one of the product MIBs listed above 🧚
    • Removes 'cisco' from cisco devices for readability. (so it doesn't read like a brand ad, we get it)
  • $l3->serial() β€” Returns a serial number if found from ENTITY-MIB and OLD-CISCO-... MIB.
  • $l3->vendor() β€” Tries to cull a Vendor name from "sysDescr"
  • $l3->root_ip() β€” Returns the primary IP used to communicate with the device. Returns the first found: OSPF Router ID ("ospfRouterId") or any OSPF Host IP Address ("ospfHostIpAddress"). first come first served bestie 😌

πŸ“ Globals imported from SNMP::Info

See "USAGE" in SNMP::Info for details.


🌸 Global Methods imported from SNMP::Info::Bridge

See "GLOBALS" in SNMP::Info::Bridge for details.


πŸ’œ Global Methods imported from SNMP::Info::EtherLike

See "GLOBALS" in SNMP::Info::EtherLike for details.


✨ Global Methods imported from SNMP::Info::Entity

See "GLOBALS" in SNMP::Info::Entity for details.


πŸŽ€ Global Methods imported from SNMP::Info:PowerEthernet

See "GLOBALS" in SNMP::Info::PowerEthernet for details.


πŸ¦‹ Global Methods imported from SNMP::Info::IPv6

See "GLOBALS" in SNMP::Info::IPv6 for details.


πŸ”₯ Global Methods imported from SNMP::Info::LLDP

See "GLOBALS" in SNMP::Info::LLDP for details.


🌈 Global Methods imported from SNMP::Info::DocsisHE

See "GLOBALS" in SNMP::Info::DocsisHE for details.


πŸ’– Global Methods imported from SNMP::Info::AdslLine

See "GLOBALS" in SNMP::Info::AdslLine for details.

πŸ“Š TABLE METHODS πŸ“Š

okay bestie, these are the methods that hand you back tables of info, and the format is always the same: a reference to a hash. slay. πŸ’…


πŸŽ€ Overrides πŸŽ€

  • $l3->interfaces() β€” gives you the map between the SNMP Interface Identifier (iid) and the physical port name. πŸ’–

But heads up, queen: it only returns those iids that have a description listed in $l3->i_description(). no description, no entry. that's the vibe check. ✨

  • $l3->i_subinterfaces() β€” hands you a reference to a hash of arrays, where key = "ifIndex" and value = array of "ifIndex". these are the VLAN subinterfaces ("l2vlan" type) hanging off their parent ("ethernetCsmacd" type) interface. it's giving family tree. 🌳

Example:

my $interfaces = $l3->interfaces();
my $i_subs     = $l3->i_subinterfaces();

foreach my $iid (sort keys %$interfaces) {
  my $port = $interfaces->{$iid};
  my $subs = join(',', sort(map {$interfaces->{$_}} @{$i_subs->{$iid}}));
  print "Port: $port has subinterfaces: $subs\n";
}
  • $l3->i_name() β€” reference to hash of iid ➑️ human set name. 🫢

Defaults to "ifName", but it checks for an "ifAlias" first. lowkey picky, highkey correct.

  • $l3->i_duplex() β€” reference to hash of iid ➑️ current link duplex setting.

What it does: maps $l3->el_index() to $l3->el_duplex, then culls out full, half, or auto and sets the map to that value. culling era. βœ‚οΈ

Peep SNMP::Info::EtherLike for the el_index() and el_duplex() methods. iykyk.


🌐 IP-MIB Arp Cache Table ("ipNetToMediaTable") 🌐

  • $l3->at_index() β€” reference to hash. maps ARP table entries to Interface IIDs ("ipNetToMediaIfIndex").

If the device doesn't support "ipNetToMediaIfIndex", it'll try the deprecated "atIfIndex" instead. backup plan energy. πŸ™ˆ

  • $l3->at_paddr() β€” reference to hash. maps ARP table entries to MAC addresses ("ipNetToMediaPhysAddress").

If the device doesn't support "ipNetToMediaPhysAddress", it'll try the deprecated "atPhysAddress".

  • $l3->at_netaddr() β€” reference to hash. maps ARP table entries to IP addresses ("ipNetToMediaNetAddress").

If the device doesn't support "ipNetToMediaNetAddress", it'll try the deprecated "atNetAddress".


πŸ‘΅ ARP Cache Entries πŸ‘΅

bestie. listen. the "atTable" has been deprecated since 1991. you should never need to use these methods. like, that's older than most of us. see "ipNetToMediaTable" above instead, fr fr. πŸ’€
  • $l3->old_at_index() β€” reference to map of IID to Arp Cache Entry ("atIfIndex").
  • $l3->old_at_paddr() β€” reference to hash of Arp Cache Entries to MAC address ("atPhysAddress").
  • $l3->old_at_netaddr() β€” reference to hash of Arp Cache Entries to IP Address ("atNetAddress").

πŸ›°οΈ BGP Peer Table ("bgpPeerTable") πŸ›°οΈ

  • $l3->bgp_peers() β€” reference to hash of BGP peer ➑️ local IP address ("bgpPeerLocalAddr").
  • $l3->bgp_peer_id() β€” reference to hash of BGP peer ➑️ BGP peer identifier ("bgpPeerIdentifier").
  • $l3->bgp_peer_state() β€” reference to hash of BGP peer ➑️ BGP peer state ("bgpPeerState").
  • $l3->bgp_peer_as() β€” reference to hash of BGP peer ➑️ BGP peer autonomous system number ("bgpPeerRemoteAs").
  • $l3->bgp_peer_addr() β€” reference to hash of BGP peer ➑️ BGP peer IP address ("bgpPeerRemoteAddr").
  • $l3->bgp_peer_fsm_est_trans() β€” reference to hash of BGP peer ➑️ the total number of times the BGP FSM transitioned into the established state ("bgpPeerFsmEstablishedTransitions").
  • $l3->bgp_peer_in_tot_msgs() β€” reference to hash of BGP peer ➑️ the total number of messages received from the remote peer on this connection ("bgpPeerInTotalMessages").
  • $l3->bgp_peer_in_upd_el_time() β€” reference to hash of BGP peer ➑️ the elapsed time in seconds since the last BGP UPDATE message was received from the peer ("bgpPeerInUpdateElapsedTime").
  • $l3->bgp_peer_in_upd() β€” reference to hash of BGP peer ➑️ the number of BGP UPDATE messages received on this connection ("bgpPeerInUpdates").
  • $l3->bgp_peer_out_tot_msgs() β€” reference to hash of BGP peer ➑️ the total number of messages transmitted to the remote peer on this connection ("bgpPeerOutTotalMessages").
  • $l3->bgp_peer_out_upd() β€” reference to hash of BGP peer ➑️ the number of BGP UPDATE messages transmitted on this connection ("bgpPeerOutUpdates").

πŸ—ΊοΈ OSPF Interface Table ("ospfIfTable") πŸ—ΊοΈ

  • $l3->ospf_if_ip() β€” reference to hash of OSPF interface IP addresses ("ospfIfIpAddress").
  • $l3->ospf_if_area() β€” reference to hash of the OSPF area to which the interfaces connect ("ospfIfAreaId").
  • $l3->ospf_if_type() β€” reference to hash of the OSPF interfaces' type ("ospfIfType").
  • $l3->ospf_if_hello() β€” reference to hash of the OSPF interfaces' hello interval ("ospfIfHelloInterval").
  • $l3->ospf_if_dead() β€” reference to hash of the OSPF interfaces' dead interval ("ospfIfRtrDeadInterval").
  • $l3->ospf_if_admin() β€” reference to hash of the OSPF interfaces' administrative status ("ospfIfAdminStat").
  • $l3->ospf_if_state() β€” reference to hash of the OSPF interfaces' state ("ospfIfState").

🀝 OSPF Neighbor Table ("ospfNbrTable") 🀝

  • $l3->ospf_peers() β€” reference to hash of IP addresses the neighbor is using in its IP Source Addresses ("ospfNbrIpAddr").
  • $l3->ospf_peer_id() β€” reference to hash of neighbor Router IDs ("ospfNbrRtrId").
  • $l3->ospf_peer_state() β€” reference to hash of state of the relationship with the neighbor routers ("ospfNbrState").

🧡 IS-IS Circuit Table 🧡

  • $l3->isis_circ_if_idx() β€” reference to hash of the interface index associated with the IS-IS circuit ("isisCircIfIndex").
  • $l3->isis_circ_admin() β€” reference to hash of the IS-IS circuit's admin status ("isisCircAdminState").
  • $l3->isis_circ_type() β€” reference to hash of the IS-IS circuit's type ("isisCircType").
  • $l3->isis_circ_level_type() β€” reference to hash of the IS-IS circuit's level ("isisCircLevelType").

πŸ”— IS-IS Adjacency Table πŸ”—

  • $l3->isis_adj_id() β€” reference to hash of the peer id of adjacencies ("isisISAdjNeighSysID").
  • $l3->isis_adj_type() β€” reference to hash of the type of adjacencies (Level 1 Intermediate System, Level 2 Intermediate System, Level 1+2 Intermediate System, unknown) ("isisISAdjNeighSysType").
  • $l3->isis_adj_usage() β€” reference to hash of the type of adjacencies in use (undefined, Level 1, Level 2, Level1+2) ("isisISAdjNeighUsage").
  • $l3->isis_adj_ip_type() β€” reference to hash of type of address (IPv4, IPv6, etc) on adjacencies ("isisISAdjIPAddrType").
  • $l3->isis_adj() β€” reference to hash of addresses (IPv4, IPv6, etc) on adjacencies. ⚠️ note: this returns hash-strings, so for IPs, use $l3->isis_peers() instead.
  • $l3->isis_peers() β€” reference to hash of addresses (IPv4, IPv6) on adjacencies. converts hash strings from isis_adj to proper IP (v4 and v6) formatting. glow-up complete. ✨

πŸ“¦ Table Methods imported from SNMP::Info πŸ“¦

See "USAGE" in SNMP::Info for details.

πŸŒ‰ Table Methods imported from SNMP::Info::Bridge πŸŒ‰

See "TABLE METHODS" in SNMP::Info::Bridge for details.

πŸ”Œ Table Methods imported from SNMP::Info::EtherLike πŸ”Œ

See "TABLE METHODS" in SNMP::Info::EtherLike for details.

🧩 Table Methods imported from SNMP::Info::Entity 🧩

See "TABLE METHODS" in SNMP::Info::Entity for details.

⚑ Table Methods imported from SNMP::Info::PowerEthernet ⚑

See "TABLE METHODS" in SNMP::Info::PowerEthernet for details.

🌈 Table Methods imported from SNMP::Info::IPv6 🌈

See "TABLE METHODS" in SNMP::Info::IPv6 for details.

πŸ“£ Table Methods imported from SNMP::Info::LLDP πŸ“£

See "TABLE METHODS" in SNMP::Info::LLDP for details.

πŸ“Ί Table Methods imported from SNMP::Info::DocsisHE πŸ“Ί

See "TABLE METHODS" in SNMP::Info::DocsisHE for details.

☎️ Table Methods imported from SNMP::Info::AdslLine ☎️

See "TABLE METHODS" in SNMP::Info::AdslLine for details.


and that's the whole page bestie!! πŸŽ€ this doc is perl v5.40.1, dated 2026-02-28, and it's straight from the User Contributed Perl Documentation for SNMP::...Layer3(3pm). you absolutely ate that. go forth and poll responsibly. periodt. πŸ’–βœ¨πŸ¦‹πŸ‘‘

πŸ“¦ where this page comes from