Persistent static ARP entries on Windows, is it possible?
Solution 1:
netsh interface ipv4 add neighbors "Local Area Connection" 10.1.1.1 12-34-56-78-9a-bc
this will create a static arp entry that survives reboots. be careful adding the entries though, as you may not be able to remove them without a hotfix:
https://support.microsoft.com/en-us/kb/2718830
Solution 2:
netsh
is no longer the preferred method for network interface management on a Windows system. Where possible, you should use Windows Powershell or Powershell Core. First you need to find out the interface index of the interface you wish the ARP cache entry to apply to:
Get-NetAdapter
Which returns:
Name InterfaceDescription ifIndex Status MacAddress LinkSpeed
---- -------------------- ------- ------ ---------- ---------
Wi-Fi Intel(R) Dual Band Wireless-AC 8260 18 Disconnected 12-34-56-AB-CD-EF 6 Mbps
Ethernet Intel(R) Ethernet Connection (2) I219-… 9 Up 78-90-12-GH-IJ-KL 1 Gbps
This is a list of your network adapters. Take note of the ifIndex
property for the network adapter in question. For me, I am using my Ethernet adapter so I will use ifIndex
9 in my example.
To create a static ARP cache entry for that interface:
New-NetNeighbor -InterfaceIndex 9 -IPAddress '192.168.0.10' -LinkLayerAddress '0000120000ff' -State Permanent
Which returns:
ifIndex IPAddress LinkLayerAddress State PolicyStore
------- --------- ---------------- ----- -----------
9 192.168.0.10 00-00-12-00-00-ff Permanent PersistentStore
This will set persistent ARP cache entries that survive a reboot. You can reboot, then double-check by running this:
Get-NetNeighbor -InterfaceIndex 9 -IPAddress 192.168.0.10
Which returns:
ifIndex IPAddress LinkLayerAddress State PolicyStore
------- --------- ---------------- ----- -----------
9 192.168.0.10 00-00-12-00-00-FF Permanent ActiveStore
You can remove the entry we just created by running this:
Remove-NetNeighbor -InterfaceIndex 9 -IPAddress '192.168.0.10'
You will be prompted for confirmation twice, once to remove the entry from the Active store, and once for the Persistent store. Confirm Yes to for both to remove the entry completely. You can omit the -InterfaceIndex
parameter to remove the entry from all interface stores.
Solution 3:
You should be able to use arp -s command in order to add a static entry to the ARP table
arp -s 157.55.85.212 00-aa-00-62-c6-09 .... Adds a static entry.
Solution 4:
There is no built-in mechanism for persistent ARP entries in Windows. Your best bet is to use a Startup Script to specify the necessary static ARP entries on each boot.