是否可以找到用户路由器的MAC地址?

发布于 2024-10-04 18:09:37 字数 128 浏览 8 评论 0原文

我想使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

睫毛上残留的泪 2024-10-11 18:09:37

您无法找到目标用户MAC,因为MAC仅适用于本地网络数据包交换WAN如果您使用IP数据包交换,那么您只能获取她路由器的IP

但此规则有一个例外,如果您的用户位于本地网络(例如服务器位于本地网络中)那么您可以获得客户端的 MAC 地址或路由器,通过查看 ARP,在她的表中,您有本地计算机的 IP 地址和她的 MAC,从该表中您可以可以通过在ARP网关IP关联中找到她的路由器MAC,因为她的网关是您的网关,而网关是您网络中的路由器和她的网络也是如此,因为你与客户端位于同一网络中。

但是在这种情况下这完全是无稽之谈,因为与用户和服务器的通信是本地的,那么数据包将不会到达路由器,但如果你真的想要这个,你可以得到这。

第二个废话是,如果您与用户位于本地网络中(只有一个选项可以解决此问题),那么网关地址可能将始终保持不变。如果有人将路由器设备更改为其他设备,这可以进行更改。;-)

摘要:您可以解决此问题,但前提是服务器和用户位于本地网络中,但我认为您想解决此问题对于WAN网络,那么你不能这样做......抱歉不是我的选择,生活是残酷的。

You can't find the destination user MAC because MAC is only usable in local network packet exchaning, in WAN network you use IP to packet exchanging then you can only get IP 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 at ARP table, in her you have IP addresses of local computers and her MAC's, from this table you can get her router MAC by finding in ARP table Gateway 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.

北渚 2024-10-11 18:09:37

不,您无法找到它,因为服务器看到的唯一 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.

风情万种。 2024-10-11 18:09:37

这是不可能的,因为发送到服务器的标头中不包含 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.

清醇 2024-10-11 18:09:37

您需要与用户或用户的路由器位于同一网络上。这可能只能通过恶意手段来实现,因为这违背了 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.

櫻之舞 2024-10-11 18:09:37

路由器可能会将其 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文