Getting the MAC address of the remote host

核能气质少年 提交于 2019-11-27 06:18:48

问题


I just a moment ago saw a request for finding the MAC adress of a remote host. An answer was that the MAC address is always sent as part of the TCP/IP protocol.

How would I go about retrieving this information from an ASP.NET C# application?

See: Reference to sister-post


回答1:


Any such answer is false. The MAC address of an adapter is only available on the same network segment. Not on the other side of a router.




回答2:


If your remote device is SNMP-enabled you can query it for its ARP cache. That will have the MAC address in it. See this FAQ entry for more info.




回答3:


Simple Answer: You can't.

Complex answer: You can, but you need to read the output from "arp -a" command. That might get difficult, depending on how many connections you currently have through your NIC (wireless or wired).




回答4:


The only way that I can think of to get this from the network itself depends on interfacing with network management software with SNMP or RMON. Currently, I'm using a Java Applet on the client (see my answer to the other question), but it has some limitations. I'm hoping to meet with our network engineers to see if there is a way to get the same information server-side by interrogating the network switches. If such a solution exists, it will likely be specific to whatever network management software you are running.




回答5:


You can build it into the application itself and have the application send the mac address in any messages that it may already be sending. Other than that, John nailed it.

Edit: Oh, if this is a "web app" and the "client app" is a browser, yeah, no go.



来源:https://stackoverflow.com/questions/1092463/getting-the-mac-address-of-the-remote-host

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!