Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am using snmp and trying to get with

snmpwalk -v 2c -c public x.x.x.x ipadd

where x.x.x.x is the ip of the pc with ubuntu 12.04 i get this answer :

IP-MIB::ipAddrTable = No Such Object available on this agent at this OID

so how can I get the ip addres from a ubuntu 12.04 LT pc , there is maybe another comand that I can use?

Thanks for the answer .

share|improve this question
    
If you have the IP address in the command, why would you need to get it again through SNMP? You already know it to run the command. –  hexafraction Nov 28 '12 at 1:09
1  
with snmpwalk -v 2c -c public x.x.x.x ipadd you can get ipaddres from diferent interfaces not only the one you are using in the comand so i need to know this thing but my point is just know how to configure IP-MIB and get this information because it is really diferent from the later ubuntu versions –  usermfg Nov 28 '12 at 1:25

2 Answers 2

First, you will need to edit the file /etc/snmp/snmp.conf and comment out the line containing "mibs:"

Within this file, change the line:

mibs :

to

#mibs : 

Next, assuming you haven't done this already, you will need to obtain the full set of IETF MIBs. These files do not ship, by default, on Debian/Ubuntu systems due to licensing issues.

From the terminal(Ctrl-Alt-t), enter the following commands:

sudo apt-get install snmp-mibs-downloader

sudo download-mibs

Your SNMP query should now respond properly.

e.g.:

snmpwalk -v 2c -c <publicSNMPstring> <MachineName> ipadd

IP-MIB::ipAdEntAddr.127.0.0.1 = IpAddress: 127.0.0.1
IP-MIB::ipAdEntAddr.192.168.1.7 = IpAddress: 192.168.1.7
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.192.168.1.7 = INTEGER: 2
IP-MIB::ipAdEntNetMask.127.0.0.1 = IpAddress: 255.0.0.0
IP-MIB::ipAdEntNetMask.192.168.1.7 = IpAddress: 255.255.255.0
IP-MIB::ipAdEntBcastAddr.127.0.0.1 = INTEGER: 0
IP-MIB::ipAdEntBcastAddr.192.168.1.7 = INTEGER: 1

The same query can be run using a GUI based MIB browser, as well. Personally, I prefer using SNMPb for my graphical queries. Once you have SNMPb installed, open SNMPb and navigate to the desired OID in the MIB tree. In your specific case, it would be 1.3.6.1.2.1.4.20 or iso-> org-> internet-> mgmt-> mib-2 -> ip -> ipAddrTable and perform a Get Bulk to receive the same data.

share|improve this answer

I had the same problem, and I had already done the above, but then I realised that all I needed to do was add the following line to /etc/snmp/snmpd.conf

# For IF-MIB data to show up in snmpwalk
view   systemonly  included   .1.3.6.1.2.1.4.20

and then restart the snmpd:

/etc/init.d/snmpd restart

then I get:

% ~/computer/snmp$ snmpwalk -v 2c -c public -O e mymachinename ipadd
IP-MIB::ipAdEntAddr.10.11.12.3 = IpAddress: 10.11.12.66
IP-MIB::ipAdEntAddr.127.0.0.1 = IpAddress: 127.0.0.1
IP-MIB::ipAdEntIfIndex.10.11.12.66 = INTEGER: 2
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntNetMask.10.11.12.66 = IpAddress: 255.255.255.0
IP-MIB::ipAdEntNetMask.127.0.0.1 = IpAddress: 255.0.0.0
IP-MIB::ipAdEntBcastAddr.10.11.12.66 = INTEGER: 1
IP-MIB::ipAdEntBcastAddr.127.0.0.1 = INTEGER: 0

HTH

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.