tags:

views:

279

answers:

2

I want to get the mac addresses for all hosts on a given subnet. So far I force an arp table update by pinging all ips involved. After that I query the arp table and everything is fine.

The problem is how to improve the update speed. Pinging 65000 addresses takes about 15 minutes on an iPhone 3GS. Even if I do not wait if a response is happening. Thats way to long. It may be that there is a bug in my ping code that is slowing things down, but I could not find any so far.

My question is:
Is there a faster network operation that triggers an arp table update?

+1  A: 

My guess is that the fastest way might be to query an existing ARP table, e.g. the table on the subnet's DHCP controller, using e.g. SNMP.

ChrisW
That might work. But what if there is no DHCP controller in place? DO you know an snmp stack for the iPhone by the way?
Monobono
If there's no DHCP controller, then how about the subnet's Gateway (i.e. the node which hosts on the subnet use to connect to the rest of the internet): wouldn't the Gateway need/have an up-to-date ARP table?
ChrisW
"DO you know an snmp stack for the iPhone by the way?" - I don't. Also this would only work on subnets where you have privileges (i.e. where the host supports SNMP and you have the credentials to use it). In those circumstances you might also install your own software on that host which your phone can talk to (to give you a non-SNMP way to query the ARP table).
ChrisW
A: 

Can't you do something with multicast on the current subnet, preferably something that generates ACKnowlegements so that if you listen on the interface, you'll discover all the mac addresses.

dlamblin
Pinging the broadcast address does not generate ACKnowlegements, does it? The Problem here is to catch the hosts that do not reply to pings.
Monobono