Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Getting MAC Adress from wireless device and access point

by zengargoyle (Deacon)
on Nov 11, 2003 at 11:12 UTC ( [id://306149]=note: print w/replies, xml ) Need Help??


in reply to Getting MAC Adress from wireless device and access point

ping the IP of the network device, then check your ARP cache. if the IP<->MAC mapping is present then you are in the same broadcast domain as the network device and the MAC address is relevant. if the IP<->MAC mapping is not present in your ARP cache then you are in a different broadcast domain than the network device and the MAC is unavailable (through any direct means).

if the network device is wireless then you will not be able to determine the MAC nor the IP of the access point through any direct means.

you may have access to indirect means like SNMP. then anything is possible but you need the right passwords for the access points.

if you have the IP of a network device and the passwords to the access points (and a list of the access points) then you can query the access point for the IP<->MAC mapping of all current connections (by IP or MAC). query each access point untill you find the IP/MAC you are interested in.

depending on the access point and it's SNMP funcionality you may find the information in different places and have to find the right little bit.

# on an Enterasys R2 AP it goes a bit like this. sub mac2oid { join '.', map {hex} split ':', $_[0] } my $macoid = mac2oid( '0:de:ad:be:ee:ef' ); my ($ifoid) = qw( .1.3.6.1.2.1.17.7.1.2.2.1.2.1 ); my ($howoid)= qw( .1.3.6.1.2.1.17.7.1.2.2.1.3.1 ); my $gets = [ [ $ifoid, $macoid ], [ $howoid, $macoid ], ]; use SNMP; ... # $session->get( $gets ); # i have an async module that # scatters the gets across a # list of access points that # won't fit in this margin. my $interface = $gets->[0]->[2]; my $how = $gets->[1]->[2]; if ( $interface & 0x6 and $how = 3 ) { # on this switch the MAC has been seen # on the wireless interface (over the radio) # and was learned automatically (vs learned from mgmt # or learned from a filer) # found which AP the MAC was on! # do something }

in my case i always can find the MAC of the network device in question, then i query all of the access points looking for the one (or more) that have seen that MAC address on their radio interface (vs seeing the MAC on their wired interface). this gets me which access points the network device is using.

my next step is usually to add them to the filter on the access point to deny them wireless access. (MuAhahah)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://306149]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-03-29 08:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found