-1

I am trying to get the IP/MAC of the wifi router my phone is connected to, so as an experiment I did an experiment on my Macbook. Online documents says that ifconfig will show the IP/MAC of the wifi router, so I walked around the building to different routers and type ifconfig, but got the same IP/MAC, I wonder if there is anything I have done wrong?

$ ifconfig | grep "\ [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\ "
inet 127.0.0.1 netmask 0xff000000 
inet 128.31.33.53 netmask 0xfffffc00 broadcast 128.31.35.255
inet 10.211.55.2 netmask 0xffffff00 broadcast 10.211.55.255
inet 10.37.129.2 netmask 0xffffff00 broadcast 10.37.129.255
inet 172.16.236.1 netmask 0xffffff00 broadcast 172.16.236.255
inet 172.16.162.1 netmask 0xffffff00 broadcast 172.16.162.255

$ ifconfig | grep "[0-9a-f]\{2\}:[0-9a-f]\{2\}\:"
lladdr 00:23:12:ff:fe:f0:6c:50 
ether 00:1f:5b:bf:48:c5 
ether 00:22:41:3b:65:a3 
ether 00:1c:42:00:00:08 
ether 00:1c:42:00:00:09 
ether 00:50:56:c0:00:01 
ether 00:50:56:c0:00:08 

These are the output for my test on all routers.

Thanks, -J

  • What online document? The manpage of ifconfig doesn't say anything about MAC of a connected wifi AP. – kbyrd Nov 13 '11 at 03:10

1 Answers1

1

According to the manpage OS X's ifconfig doesn't provide the MAC address of the connected wifi AP. However the airport utility will tell you this info

 /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep BSSID

BSSID is the MAC address of the AP.

kbyrd
  • 3,321
  • 27
  • 41
  • Wow, thanks so much! I think I saw it says ipconfig shows it in Windows, so I assumed that ifconfig shows the same thing. Thanks anyway, saved my day! – Zhunping Zhang Nov 13 '11 at 05:16