What's new

Get MAC Adresses connected to Access Point

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

eureka

New Around Here
Hi,

I'm currently writing a script to check the MAC presence on the network. However, I'm running into issues because I have an access point and the devices connected to the access point do not directly show up in the main router.

Is there a way to retreive the MAC addresses that are currently connected to the access point?

currently using the following code to retreive and check the MAC addresses:

Code:
#!/bin/sh

User1="Away"

macaddress=`wl -i eth2 assoclist && wl -i eth1 assoclist && wl -i eth3 assoclist`

if echo $macaddress | grep -q "AA:AA:AA:AA:AA:AA"
then
    User1="Home"
fi
 
There was a long thread about this issue a couple of weeks ago. I’m assuming your access point is in fact a repeater?

If so, you have a few options depending on how it works.

Some repeaters present a virtual MAC for each client, and usually its based on some algorithm so RealMac-A will always have the same VirtualMac-A - if so, simply work out what the virtual MAC is for each device you care about and add an OR to your script to check for either real or virtual being present.

If that’s not gonna work you need to ditch the repeater and replace it either with a AiMesh node (assumes you aren’t/do not need to run Merlin), or you could put a proper AP in which is cabled (or PowerLine’d) to the router.

As a variation on the cabled AP (if it’s not possible to run the cable or PowerLine won’t work in your home for some reason), you could (although it’s hardware heavy) have a media bridge connecting to the router wirelessly then a 30cm cable to an AP (so back-to-back the bridge and AP). I’d only suggest this if you had some spare router laying around capable of acting as a bridge (and assuming your repeater is also capable of true AP mode).


Sent from my iPhone using Tapatalk
 
Actually looking at how you’re doing it, the AP solution I think isn’t going to work either.

I think I’d assign fixed IP assignments in the DHCP Server for the devices in question and ping them occasionally.

Note that if your AP is a repeater doing virtual MAC assignment you’ll end up having 2 IP’s per device to do an OR ping check on. So you may still run into the troubles I describe with attempting the IP assignment.


Sent from my iPhone using Tapatalk
 
There was a long thread about this issue a couple of weeks ago. I’m assuming your access point is in fact a repeater?

If so, you have a few options depending on how it works.

Some repeaters present a virtual MAC for each client, and usually its based on some algorithm so RealMac-A will always have the same VirtualMac-A - if so, simply work out what the virtual MAC is for each device you care about and add an OR to your script to check for either real or virtual being present.

If that’s not gonna work you need to ditch the repeater and replace it either with a AiMesh node (assumes you aren’t/do not need to run Merlin), or you could put a proper AP in which is cabled (or PowerLine’d) to the router.

As a variation on the cabled AP (if it’s not possible to run the cable or PowerLine won’t work in your home for some reason), you could (although it’s hardware heavy) have a media bridge connecting to the router wirelessly then a 30cm cable to an AP (so back-to-back the bridge and AP). I’d only suggest this if you had some spare router laying around capable of acting as a bridge (and assuming your repeater is also capable of true AP mode).


Sent from my iPhone using Tapatalk


My Access Point is actually does have a direct ethernet cable connection to my main router (access point is an old router which I put into AP mode).

Shouldn't I be able to give directions to the IP to show me which mac addresses are connected to it?
 
If the AP is an ASUS then yes, you could SSH to it from the router and execute the command in your script remotely.


Sent from my iPhone using Tapatalk
 
https://www.snbforums.com/threads/to-trace-mobile-mac-adress.20022/#post-144831
some homework reading

Use the mac addresses in dhcp
Login to each device separately the different mac address combination for the device would be irrelevant, you would always get the right one form the device it is connected to if all you are looking to do is establish presence.

as a previous poster mentioned however using mac addresses aren't always a safe bet. Layer 2 devices such as switch/bridge/repeater will arp its own interface mac address for devices that are connected directly to it.

You may be better off assigning static ip addresses to the devices and checking for those instead....

the wireless log on each device does do a good job of showing the mac addresses of the devices connected, but the ip addresses isn't always right. The ip address lookup i think is a merlin feature as stock does not have it.

I hate having to correct myself

Looks like the arp table on the remote repeater does not necessarily have all of the mac addresses for devices that are directly connected to it as it is acting as a layer 2 device. Best bet is to look at the wireless log. I don't know if the asus switch actually has a layer 2 mac table that can be pulled up by command line.
 
Last edited:
you mean by pinging the IP Address?
You could ping the ip on whatever interval you were going to check for the mac address. Or you can pull the dhcp lease info, every time a host come up or changes wireless it should issue a dhcp request and register its actual mac and ip in the dhcp server. Or pull the arp table and look for the static ip you assigned to the device. Not sure what the timer is on the arp entries. The mac address of the arp entry may be different for devices behind the repeater, but the ip address is always issued to the device mac.

It can be tricky though, looking at my phone it connects and disconnects from wifi thoughout the day...every time it goes into powersave mode it disconnects from wifi.

Smartthings uses a device app and location services to report in the location of the device. That may be another idea.
 
Last edited:
You could ping the ip on whatever interval you were going to check for the mac address. Or you can pull the dhcp lease info, every time a host come up or changes wireless it should issue a dhcp request and register its actual mac and ip in the dhcp server. Or pull the arp table and look for the static ip you assigned to the device. Not sure what the timer is on the arp entries. The mac address of the arp entry may be different for devices behind the repeater, but the ip address is always issued to the device mac.

It can be tricky though, looking at my phone it connects and disconnects from wifi thoughout the day...every time it goes into powersave mode it disconnects from wifi.

Smartthings uses a device app and location services to report in the location of the device. That may be another idea.

this may be what you are looking for

https://ifttt.com/asusrouter
 

Similar threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top