将 ARP 表复制到数组

发布于 2024-11-14 04:35:06 字数 150 浏览 7 评论 0原文

我一直在试图找出将 Linux ARP 表复制到数组中的最佳方法,我只需要 IP 和 MAC 地址。我尝试过复制 /proc/net/arp 文件,但我没有找到最好的方法,我读到除了 ARP(IPv6 或其他)之外可能还会出现其他条目。我不知道!还有其他方法可以获取本地 ARP 表吗?

I've been trying to figure out the best way to copy Linux ARP table into an array, I just need IP and MAC address. I have tried copying the /proc/net/arp file, but I do not find it the best way to do it, I read there might appear other entries beside ARP (IPv6 or sth). I am not sure! Is there any other option to get local ARP table?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

揪着可爱 2024-11-21 04:35:06

iproute2 中的 ip neighbor list 命令使用 < a href="http://swoolley.org/man.cgi/7/netlink" rel="nofollow">netlink 套接字来查询内核有关邻居信息。

建议使用同一 iproute2 包中的 libnetlink 来访问此信息。

The ip neighbor list command from iproute2 uses a netlink socket to query the kernel about the neighbour information.

It is recommended to use the libnetlink from the same iproute2 package to access this information.

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