【问题标题】:How can I get the IP/MAC of the wifi router my Macbook is connected to using ifconfig?如何使用 ifconfig 获取我的 Macbook 连接的 wifi 路由器的 IP/MAC?
【发布时间】:2011-12-27 21:36:27
【问题描述】:

我正在尝试获取我的手机所连接的 wifi 路由器的 IP/MAC,因此作为实验,我在我的 Macbook 上做了一个实验。网上文档说ifconfig会显示wifi路由器的IP/MAC,所以我绕着楼走到不同的路由器,输入ifconfig,但是得到的IP/MAC都是一样的,不知道是不是我做错了什么?

$ 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 

这些是我在所有路由器上测试的输出。

谢谢, -J

【问题讨论】:

  • 什么在线文档? ifconfig 的手册页没有说明连接的 wifi AP 的 MAC。

标签: wifi ip-address router mac-address ifconfig


【解决方案1】:

根据手册页 OS X 的 ifconfig 不提供连接的 wifi AP 的 MAC 地址。但是airport 实用程序会告诉您此信息

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

BSSID 是 AP 的 MAC 地址。

【讨论】:

  • 哇,非常感谢!我想我看到它说 ipconfig 在 Windows 中显示它,所以我假设 ifconfig 显示相同的东西。无论如何,谢谢,拯救了我的一天!
猜你喜欢
  • 1970-01-01
  • 2020-05-29
  • 1970-01-01
  • 2020-04-16
  • 2012-08-13
  • 2016-12-18
  • 2011-09-25
  • 1970-01-01
相关资源
最近更新 更多