简体   繁体   English

检索给定IP地址的Mac地址

[英]Retrieving Mac Address for the given IP-Address

Is there any way to retrieve the mac-address for the given ip-address from the ARP table without providing the Interface name ?? 有什么方法可以在不提供接口名称的情况下从ARP表中检索给定ip地址的mac地址。

I do know the procedure of retrieving the mac address using ioctl call but in that case I should provide the interface name .. :( 我确实知道使用ioctl调用检索mac地址的过程,但是在那种情况下,我应该提供接口名称.. :(

One Crude Solution : Read /proc/net/arp file ... :( .. other than that .. any system call or anything else where i can retrieve the mac-address without the need of interface name ?? 一个粗略的解决方案 :读取/ proc / net / arp文件... :( ..除此之外。.任何系统调用或其他我可以检索mac地址而不需要接口名称的东西??

NOTE: Simple C based solution not interested in scripting libraries. 注意:基于C的简单解决方案对脚本库不感兴趣。

NOTE: I am expecting a *NUX based solution rather than WINDOWS based one. 注意:我期望基于* NUX的解决方案,而不是基于WINDOWS的解决方案。

I do know the procedure of retrieving the mac address using ioctl call but in that case I should provide the interface name 我确实知道使用ioctl调用检索mac地址的过程,但是在那种情况下,我应该提供接口名称

So all you need is a way to find the interface name associated with a given IP. 因此,您所需要的就是找到与给定IP关联的接口名称的方法。 The ioctl SIOCGIFCONF will give you that. ioctl SIOCGIFCONF将为您提供。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM