禁止MAC地址访问特定端口 - C++
我想阻止具有特定 MAC 地址的人访问我的服务器上的特定端口,我将其用作我的朋友运行的私人服务器的一种硬件禁令。
我希望在 C++ 中做到这一点,并且想知道我需要研究什么才能做到这一点。服务器运行Windows。
另外,我如何找到访问者的MAC地址?谢谢。
I want to stop someone with a certain MAC address from accessing a certain port on my server, I'm using this as a sort of hardware ban for a private server a friend of mine runs.
I am looking to do this in C++, and would like to know what I would need to research in order to do it. The server runs Windows.
Also, how would I find out the MAC address of the person accessing? Thankyou.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
仅当服务器和客户端位于同一 LAN 上时,MAC 地址过滤才有用。
服务器将看到最近的上游路由器的 MAC 地址,而不是客户端的 MAC 地址
MAC 地址。
Filtering on MAC addresses is only useful if the server and client are on the same LAN.
The server will see the MAC address of the nearest upstream router, not the client's
MAC address.
应用程序级套接字不允许进行 MAC 过滤。获取 MAC 的唯一方法是直接访问 TCP/IP 标头本身,而套接字不提供对此的访问。除非您使用低级拦截驱动程序(例如 WinPCap),否则您最好将服务器放在真正的硬件防火墙/路由器后面,并让它为您执行 MAC 过滤。
Application-level sockets do not allow for MAC filtering. The only way to get the MAC is to have direct access to the TCP/IP headers themselves, which sockets do not provide access to. Unless you use a low-level intercept driver, like WinPCap, then you are just better off putting the server behind a real hardware firewall/router and let it do the MAC filtering for you.
虽然我无法回答你的问题,但 MAC 地址现在往往是在软件中设置的,因此可以很容易地更改。
While I can't answer your question, MAC addresses now tend to be set in software, so can be changed pretty easily.