是否可以找到用户路由器的MAC地址?
我想使用 PHP 脚本来查找用户连接到我的站点的路由器。 PHP 或其他服务器端语言可以实现这一点吗?
我在网上查了一下,似乎无法获取用户计算机的信息,但路由器的信息? 编辑:我只对用户的路由器感兴趣,而不是用户的特定计算机。
I would like to use a PHP script to find the router that a user is connected to my site from. Is this possible with PHP or some other Server-Side language?
I have looked online and it looks like its not possible to get if for the user's computer, but for the router?
EDIT: I am only interested in the user's router, not the user's specific computer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您无法找到目标用户
MAC
,因为MAC
仅适用于本地网络数据包交换、WAN
如果您使用IP
来数据包交换,那么您只能获取她路由器的IP
。但此规则有一个例外,如果您的用户位于本地网络(例如服务器位于本地网络中)那么您可以获得客户端的
MAC
地址或路由器,通过查看ARP
表,在她的表中,您有本地计算机的IP
地址和她的MAC
,从该表中您可以可以通过在ARP
表网关IP
关联中找到她的路由器MAC
,因为她的网关是您的网关,而网关是您网络中的路由器和她的网络也是如此,因为你与客户端位于同一网络中。但是在这种情况下这完全是无稽之谈,因为与用户和服务器的通信是本地的,那么数据包将不会到达路由器,但如果你真的想要这个,你可以得到这。
第二个废话是,如果您与用户位于本地网络中(只有一个选项可以解决此问题),那么网关地址可能将始终保持不变。如果有人将路由器设备更改为其他设备,这可以进行更改。;-)
摘要:您可以解决此问题,但前提是服务器和用户位于本地网络中,但我认为您想解决此问题对于
WAN
网络,那么你不能这样做......抱歉不是我的选择,生活是残酷的。You can't find the destination user
MAC
becauseMAC
is only usable in local network packet exchaning, inWAN
network you useIP
to packet exchanging then you can only getIP
of her router.But is a exception from this rule, if you are with user in local network (eg. server is in local network) then you can get
MAC
address of client or router by look atARP
table, in her you haveIP
addresses of local computers and herMAC's
, from this table you can get her routerMAC
by finding inARP
tableGateway IP
association, because her gateway is a your gateway and gateway is a router in your network and her network too because you is in same network with client..But at all this is nonsense in this case because communication with user and server is a local, then packets will not reach the router, but if you really want this you can get this.
Second nonsense is if you are in local network with user (only one option to solve this problem) then probably gateway address will be constant always. This can make change if someone change a router device to other.;-)
Summary: You can solve this problem but only if server and user is in a local network, but i think you want solve this problem for
WAN
network, then you can't do this ... sorry is not me choice, live is brutal.不,您无法找到它,因为服务器看到的唯一 MAC 地址是它所连接的路由器的 MAC 地址,该路由器通常距离用户的硬件很远。所以你总是会得到相同的 MAC 地址。
No, you cannot find it out as the only MAC address the server sees is that of the router it is connected to which is usually far away from the user's hardware. So you would always get the same MAC address.
这是不可能的,因为发送到服务器的标头中不包含 MAC 地址。 IP 地址或 cookie 跟踪是唯一识别匿名用户的最佳方法。
It's not possible because the MAC address is not included in the headers sent to your server. IP address or cookie tracking is the best you've got available to uniquely identify anonymous users.
您需要与用户或用户的路由器位于同一网络上。这可能只能通过恶意手段来实现,因为这违背了 OSI 层次结构提供的封装的全部目的。
You need to be on the same network as the user, or the user's router. This could likely be accomplished only through malicious means, as this defeats the entire purpose of the encapsulation provided by the OSI hierarchy.
路由器可能会将其 MAC 地址嵌入其 IPv6 地址中,这可以使用 Traceroute 来发现。
您可以找到本地网络上路由器的MAC地址,但不会找到用户计算机所连接的路由器的MAC地址。
The router may embed it's MAC address in it IPv6 address, which could be discovered using traceroute.
You can find out the MAC address of the routers on your local network, you will not find the MAC address of the router the user's computer is connected to.