5

I am currently running coLinux configured in "ndis-bridged" networking mode, on a machine whose wireless networking card or driver seems incapable or unwilling to accept non-broadcast layer 2 traffic, or traffic not destined for the wireless card's primary MAC address.

After figuring out this was the problem, I tried configuring the coLinux interface to have the same MAC address as the host machine. Magically, networking started to function. Unfortunately only a single problem remains: the host machine cannot talk to the coLinux instance, even though the rest of the LAN can.

I figured out that by adding a static ARP entry to the host for the coLinux instance's IP address(es), I could accomplish full connectivity in bridged mode, even though the wireless card/driver didn't want to play along.

Despite the hackishness of this setup, I would like to keep it for a few reasons, primarily of which is IO performance for the coLinux instance. This brings me to a problem: persisting the ARP entries on the host machine.

I have searched the web, but have been unable to find the WinNT equivalent of /etc/arp from UNIX. Does such a file exist? I suspected somewhere in the registry, but alas, my searches thus far have been fruitless.

My only alternative is to run a batch file at startup to recreate the ARP entries using the arp command line tool, but this, ironically, seems hackish. :)

Thanks.

dmw
  • 153
  • 1
  • 1
  • 5

6 Answers6

11
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

goofology
  • 382
  • 2
  • 14
  • Is it possible to disable arp feature completely after setting a static arp entry on Windows? You can do this in Linux. `ip link set dev eth0 arp off` or `ifconfig eth0 -arp`. I don't want my windows device to reply to other device's ARP requests because of some reasons. I will just add the gateway's MAC entry manually. So that my internet connection will work. – Sourav Ghosh Oct 29 '18 at 09:32
8

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.

Dusty Vargas
  • 266
  • 3
  • 12
2

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.

Conor
  • 101
  • 1
  • 2
    Hi Conor, this command only creates an entry for the lifetime of the running machine. It does not persist across reboots, at least as far as I can tell. :) – dmw Jan 14 '10 at 17:03
2

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.

Evan Anderson
  • 141,071
  • 19
  • 191
  • 328
0

The problem with NDIS drivers is they add an additional layer between the OS and the network card making things like working at the layer2 level difficult (particularly with wireless cards). In looking at the coLinux website(http://colinux.wikia.com/wiki/Network#Recommended_Setup) they recommend using 2 virtual interfaces: One for coLinux to communicate with the LAN and one for coLinux to communicate with the host. Have you considered this configuration?

einstiien
  • 2,538
  • 18
  • 18
0

There exists the command arp -s in Windows for doing this, but be careful I think from Vista on it does not work anymore (just tested it under Win10 with an administrative command prompt). arp shows no error but after arp -a the entry is not shown.
Only way is as @goofology has written is via netsh. This issue did cost me some time some years ago, I had tried it on multiple PCs. [cannot comment Conors answer with the arp -s suggestion so I do this as an answer for all others who try to do it via arp -s]

Thomas
  • 4,155
  • 5
  • 21
  • 28
Hannes
  • 157
  • 8