Modifying physical NIC card MAC address

I have written a load balancing driver using the NDIS intermediate driver. I am using two NIC cards to provide failover and a virtual miniport is created. Transmission and reception is happening properly. The concern now is both the physical network adapters should be set with the same MAC address.

Can anyone suggest me the right way of doing this from the intermediate driver. MSDN documentation says that “The network management software cannot set the current station address using the NDIS interface library. It must set this address as a configuration parameter.” for setting the “OID_802_3_CURRENT_ADDRESS”. I am bit confused about setting this parameter as configuration parameter. Can anybody help me in this?

Setting duplicate MAC adresses would not be recommended, it violates the data link layer requirements, see
https://en.wikipedia.org/wiki/MAC_address

Usually the lowest level netcard drivers can override the physical MAC address. This can be done with a common registry parameter. After initialization there’s no documented way to ask a miniport to change the MAC address. That’s a miniport will fail attempt to set OID_802_3_CURRENT_ADDRESS.

– pa

@Phil_Sikora said:
Setting duplicate MAC adresses would not be recommended, it violates the data link layer requirements, see
https://en.wikipedia.org/wiki/MAC_address

I will assign the same mac address to both the network cards present in my system. But these two network cards are connected to two different networks. Two networks are entirely separated out from each other and there is no way for a node in one network to communicate to a node in other network. This is to provide redundancy and PRP(Parallel redundancy protocol) is designed in this way.

@Pavel_A said:
Usually the lowest level netcard drivers can override the physical MAC address. This can be done with a common registry parameter. After initialization there’s no documented way to ask a miniport to change the MAC address. That’s a miniport will fail attempt to set OID_802_3_CURRENT_ADDRESS.

– pa

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4d36e972-e325-11ce-bfc1-08002be10318}*****
I found there is an entry “NetworkAddress” under the adapter key in the above mentioned hierarchy which miniport uses to allow upper layer to set a custom MAC address and the modified mac address can be restored by reading the “OriginalMACAddress” entry present in the adapter’s registry key.
Set the mac address in the registry and restarting the network adapter resolves the problem.

I found there is an entry “NetworkAddress”

Yes, this. You can assign locally administered (fake) addresses to avoid breaking rules.
How will Windows handle two miniport instances with same MAC address - I don’t know, just try to do this.
It looks that you don’t own the miniport, so you cannot play tricks with the MAC address, such as set same addresses in the hardware but report different addresses to the system.

– pa