Quickly detect via MAC if entities are present on a network?

خرید بک لینک

Is there a fast and reliable way to use a device's MAC address to determine if it is currently connected to a network from a Windows PC/Server? If not, then from an Ubuntu server?

  • arp -a doesn't work on its own as the items stay in the cache too long.
  • arp -a combined with clearing the cache every 5 minutes might work, but seems inefficient, and only works if the cache entirely repopulates within 5 minutes. Would it?

Background: I got tired of clocking in at work, and so I wrote a quick app which run as a windows service, checks if my phone is present on the company network periodically, logs that to a database, and then hosts a website which allows you to view when I was in the office by summing the data over a given range (amazing what you can do with the right libraries in a few hours).

It took about a week before the company decided they'd like everyone to use the app in place of our time-clock system where possible.

Originally I was using a DHCP reservation and periodically pinging my Android phone to detect it. When expanding, however, I quickly ran into the issue that iPhones don't respond to pings. Aside from that, pings are slow. It takes about a second per phone to reliably confirm via ping that it's there.

I tried running arp -a and combing through the result for MAC matches, but items stay in the arp cache practically indefinitely. I've considered reading the cache, then flushing it after, but I don't know if it will reliably repopulate in time. That's a potential solution if it does, though I don't like the idea of flushing the arp cache every five minutes.

My current solution is to do an SNMP poll on our access points to gather their connected clients, and then parse that to see if I can find MAC matches. It's fast, and it's reliable, but it's very specific to the access points in question. If we switch out the access points, then the next ones might not list their connected clients via SNMP. Even if they do, I'll need to reconfigure the snmp polls.

I'm thinking that if there's a known port which accepts connections on any given phone, I could open a tcp connection to that and then close it in place of a ping, but I feel that there must be a fast layer 2 solution here somewhere.

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 452 تاريخ: پنجشنبه 21 مرداد 1395 ساعت: 8:39

صفحه بندی