Eu preciso consultar o endereço MAC dos terminais do Ubuntu. Eu me lembro que há alguns anos usei o OID .1.3.6.1.2.1.2.2.1.6.2 (IF-MIB :: ifPhysAddress.2) para consultar os terminais do OpenSUSE.
Este OID não funciona com o Ubuntu:
$ snmpget -v 2c -c public localhost .1.3.6.1.2.1.2.2.1.6.2
IF-MIB::ifPhysAddress.2 = No Such Object available on this agent at this OID
nem:
$ snmpget -v 2c -c public localhost .1.3.6.1.2.1.2.2.1.6
IF-MIB::ifPhysAddress = No Such Object available on this agent at this OID
Parece que nem todas as interfaces de rede estão disponíveis:
$ snmpwalk -v 2c -c public localhost .1.3.6.1.2.1.2
IF-MIB::interfaces = No more variables left in this MIB View (It is past the end of the MIB tree)
enquanto faço um snmpwalk começando em .1.3.6.1.2.1 (SNMPv2-SMI :: mib-2), obtenho alguns resultados.
Por quê? Existe algo que eu preciso ativar para obter o endereço MAC?
Eu verifiquei e ifPhysAddress está definido em / usr / share / mibs / ietf / IF-MIB e o MIBS parece configurado corretamente:
$ net-snmp-config --default-mibs | grep IF-MIB
:HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES:UCD-DLMOD-MIB:UCD-DISKIO-MIB:LM-SENSORS-MIB:IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:UCD-SNMP-MIB:UCD-DEMO-MIB:SNMP-TARGET-MIB:NET-SNMP-AGENT-MIB:SNMP-FRAMEWORK-MIB:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB:SNMP-VIEW-BASED-ACM-MIB:SNMP-COMMUNITY-MIB:IPV6-ICMP-MIB:IPV6-MIB:IPV6-TCP-MIB:IPV6-UDP-MIB:IP-FORWARD-MIB:NET-SNMP-EXTEND-MIB:SNMP-NOTIFICATION-MIB:SNMPv2-TM:NET-SNMP-VACM-MIB
Os pacotes que eu instalei são:
ii libsnmp-base 4.4.1~dfsg-12ubuntu7 SNMP (Simple Network Management Protocol) MIBs and documen
ii libsnmp15 5.4.1~dfsg-12ubuntu7 SNMP (Simple Network Management Protocol) library
ii snmp 5.4.1~dfsg-12ubuntu7 SNMP (Simple Network Management Protocol) applications
ii snmpd 5.4.1~dfsg-12ubuntu7 SNMP (Simple Network Management Protocol) agents
Atualização:
Abaixo está o snmpd.conf das máquinas alvo:
com2sec paranoid default public
group MyROSystem v1 paranoid
group MyROSystem v2c paranoid
group MyROSystem usm paranoid
group MyROGroup v1 readonly
group MyROGroup v2c readonly
group MyROGroup usm readonly
group MyRWGroup v1 readwrite
group MyRWGroup v2c readwrite
group MyRWGroup usm readwrite
view all included .1 80
view system included .iso.org.dod.internet.mgmt.mib-2.system
access MyROSystem "" any noauth exact system none none
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
syslocation Unknown (configure /etc/snmp/snmpd.local.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmpd.local.conf)