一、可以使用像MAC地址扫描器,LanHelper(局域网助手)之类的工具; Novell迷,迷Novell
二、Windows自带的Nbtstat 命令: http://Novell.Me
使用办法:nbtstat -a IP地址
比如要获取IP地址为 192.168.1.100的网卡地址,在命令行提示符下输入 nbtstat -a 192.168.1.100
http://Novell.Me
就可以得到对方的网卡MAC地址啦。
三、如果你有一点点编程基础,你也可以用如下的代码来实现获取MAC地址:
[DllImport("Iphlpapi.dll")]
static extern int SendARP(Int32 DestIP, Int32 SrcIP, ref Int64 MacAddr, ref Int32 PhyAddrLen);
[DllImport("Ws2_32.dll")]
static extern Int32 inet_addr(string ipaddr);
//SendArp获取MAC地址
public static string GetMacAddress(string macip)
{
StringBuilder strReturn = new StringBuilder();
try
{
Int32 remote = inet_addr(macip);
http://novell.me
Int64 macinfo = new Int64();
Int32 length = 6;
SendARP(remote, 0, ref macinfo, ref length);
string temp = System.Convert.ToString(macinfo, 16).PadLeft(12, '0').ToUpper();
int x = 12;
for (int i = 0; i < 6; i++)
{
if (i == 5) { strReturn.Append(temp.Substring(x - 2, 2)); }
else { strReturn.Append(temp.Substring(x - 2, 2) + ":"); }
x -= 2;
}
return strReturn.ToString();
}
catch
{
return strReturn.ToString();
}
} Novell迷网站內容,版权所有 转载请注明出处!
本文地址 http://novell.me/master-diary/2009-10-26/get-computer-MAC-Address.html
(责任编辑:Novell迷)