I'm current working on a program that scans my network and discoveres computers and devices on the network. I use various operations to find data on the devices I discover, but want to distinguish the network devices from computers. And I'm wondering if anyone knows how I could do this?
I looked a bit at SNMP, and tried connecting to my network printer, router and modem. But I seem to only be able to connect to the printer, neither the router or modem responds.
Is there another way to identify what kind of a device an IP address belongs to?
Using a command line tool such as nmap you can finger print the device which can give you all sorts of information.
Perhaps you can call nmap via c# and read back the response.
Another alternative is to look up the network chip vendor of a given MAC address. But I'm not sure how much detail that will give you.
Here is the example from the nmap site:
In general you cannot find out much about a device from it's IP.Using the MAC address of the host, you could determine the manufacturer of the Network adapter. The first half of MAC addresses are assigned by manufacturer.
You could try using nmap.
Nmap ("Network Mapper") is a free open source utility for network exploration or security auditing. It was designed to rapidly scan large networks, although it works fine against single hosts. Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. Nmap runs on most types of computers and both console and graphical versions are available. Nmap is free software, available with full source code under the terms of the GNU GPL.
My remark may look simple. But most of the device that implement SNMP implement the MIB-II. As you can see in here under it exists in 'System' an entry called 'sysDescr' the you can use most of the time to identify the device.
First, this answer is biased on ethernet networks. The ideas can be tips also for other scenarios.
There is many ways to accomplish this, for example :
scanning
Possible, for example, with nmap.
Pro :
Cons:
targeted discovery
If your goal is to map your network, the official services, you can think about their official discovery capabilites. For example CDP, SSDP, srvloc, snmp get broadcast, etc... You have to know what services you are probing.
Pro:
Cons:
passive traffic monitoring
Once upon a time, you find ethernet hosts linked with copper cables ( CAT3 / CAT5 ) to hubs. You can run on any of these hosts a program to capture all the traffic, putting the ethernet card in promiscous mode, so the NIC pass to the operating system all the packets, also the packets with a MAC destination different than the MAC address of the NIC.
Your program can analyze these raw data, and parse the protocols and packets inside.
Nowadays you use ethernet switches, not hubs. Your pc' NIC in promiscous mode doesn't receive all the traffic on the network, because the switch forwards to you only the packets for your host or for all ( broadcast and - if registered - multicast ).
You have to use managed switches, and configured one port to be a repeater or monitor port, to link the monitoring host.
Pro:
Cons:
This is a simple discovery for dummies intro. Discovery tools can mix both ways to look for devices and services on the network.
For example, HP JetAdmin discovery uses different methods only to look for HP network printers and scanners not for all the devices on your LAN.