Hello,
Regarding the Keil documentation, for changing the MAC address we can use the netIF_SetOption function. I configured my STM MCU network like this:
uint8_t mac_addr[NET_ADDR_ETH_LEN]; netInitialize (); //Set New mac_addr value netIF_SetOption (NET_IF_CLASS_ETH | 0, netIF_OptionMAC_Address, mac_addr, sizeof (mac_addr));
It successfully changed my Mac address but in Wireshark, I saw that it created a duplicate IP address device ( one with the old Mac address "1E-30-6C-A2-45-5F" and the new one with the new Mac address "6a:ad:d5:59:52:19")
I need to know how I can change the MAC address while the old value is being removed(prevent from a duplicate IP)
I appreciate your help.
When a device has already communicated with another evaluation board, the MAC addresses are cached on both ends. If you change the MAC address but not the IP address, the second evaluation board still caches the old MAC address. The default ARP cache timeout is 150 seconds. This means you need to clear the ARP cache (netARP_ClearCache) on the evaluation board or wait for the entry to time out.
Changing the default MAC address is usually at device startup, but not while the device is running, as it may cause communication issues.
Dear Franc,
I really appreciate it. Excellent Point.