2

I need to implement a network discovery mechanism with Snmp4j. I tried to find examples about this mechanism but couldnt find a valid one. Is there any java example/tutorial to manage ip address ranges and do the discovery?

3 Answers 3

3

What about Nmap?

nmap x.x.x.x/x -sU -p U:161 

The command above will return all computers in your network with an SNMP service listening. Nmap also features an XML output (-oX filename.xml) which can be easily parsed with Java or any other language.

0
1

You need to be a little more specific in your question.

  • Do you want to know about snmp4j? If so, what are you missing on the website?
  • Do you mean to ask about managing IP addresses in Java? Then go to the source.
  • Is it the portscanning part you're worried about? Then it's the All About Sockets you're after.

My guess is that you should write code that

  1. figures out what kind of network it is on (eg. 192.168.1.0/24)
  2. portscans that network, looking for IPs that listen on 161/UDP.
  3. use snmp4j to query those IP's.

Simple enough, eh :-)

Cheers,

1
  • Actually, im trying to find the devices that supports snmp within the network. I dont have any ip address, so i have to poke every ip in range to find out the devices. I heard that there are methods about doing the snmp discovery but couldnt manage to find one.
    – MartK
    Nov 16, 2012 at 12:46
1

Have a look on netTransformer for sure it does what you are looking for. In general you should always have a starting IP address and a way to describe your SNMP connection details that to match the potential devices in your network. Then through SNMP you can query various SNMP tables and thus have various discovery methods. The simplest one are to query ARP tables, ip routing table (next-hops are definite neighbors) also there are many others ranging to pretty much any routing or even session oriented protocol that has been exposed through SNMP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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