简体   繁体   English

为特定接口添加 Arp 条目 [Windows]

[英]Add Arp entry for specific interface [Windows]

I know that we can add arp entry in windows using arp -s IP MAC I need a command to add such entry for a specific interface if I have many我知道我们可以使用 arp -s IP MAC 在 windows 添加 arp 条目 如果我有很多,我需要一个命令来为特定接口添加这样的条目

While I have those two interfaces Interface: 10.243.16.11 --- 0xe Interface: 192.168.1.179 --- 0x17虽然我有这两个接口接口:10.243.16.11 --- 0xe 接口:192.168.1.179 --- 0x17

The arp command under Linux has a -i flag for specifying the interface but the Windows one is slightly different. Linux 下的arp命令有一个用于指定接口的-i标志,但 Windows 稍有不同。

If you run arp on its own, you'll see how to do it:如果您自己运行arp ,您将看到如何执行此操作:

ARP -s inet_addr eth_addr [if_addr]
ARP -d inet_addr [if_addr]
ARP -a [inet_addr] [-N if_addr] [-v]

You need to provide the IP address if_addr for the specific interface you want to affect.您需要为您想要影响的特定接口提供 IP 地址if_addr For example:例如:

C:\Users\Pax>arp -a

Interface: 192.168.0.72 --- 0x1c
  Internet Address      Physical Address      Type
  192.168.0.1           80-20-da-a0-f9-3d     dynamic

Interface: 172.23.128.1 --- 0x33
  Internet Address      Physical Address      Type
  172.23.143.255        ff-ff-ff-ff-ff-ff     static

C:\Users\Pax>arp -s 192.90.90.90 80-20-da-a0-f9-33 172.23.128.1

C:\Users\Pax>arp -a

Interface: 192.168.0.72 --- 0x1c
  Internet Address      Physical Address      Type
  255.255.255.255       ff-ff-ff-ff-ff-ff     static

Interface: 172.23.128.1 --- 0x33
  Internet Address      Physical Address      Type
  172.23.143.255        ff-ff-ff-ff-ff-ff     static
  192.90.90.90          80-20-da-a0-f9-33     static

You can see there that the arp entry has been added to the cache for the specific interface.您可以在那里看到arp条目已添加到特定接口的缓存中。

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

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