Changing the IP Address and MAC address during Runtime

Am using the 5 RA6M5 microcontrollers and all of them are connected to switch… And for all of them i will be dumping the same code…Now i know / i make sure none of the microcontrollers have the same IP addresses… But my question is Can all these microcontrollers can have the same MAC addresses ?

Also MAC address has to be unique. Otherwise the ARP protocol can’t work.

Thanks for the update…

Can you please let me know the process for changing the MAC address during the run time…

Thanks & regards,
Vikram.

MAC addresses must be unique AND fix for PHYSICAL interfaces, not MCUs. You must allocate a MAC address pool from the IEEE and ensure that each device you ship has an unalterable address from the pool for each ethernet interface (roughly, each RJ45 jack your devIce has) IF the device is being used anywhere in a public network. There is no meaningful use case for alternating MAC addresses for the same physical interface, in particular not at run time. If you are in doubt about this, you may want to refer to any beginner’s tutorial at networking. To get a slightly deeper understanding about low-level addressing, the “bible” is a good recommendation: The All-New Switch Book: The Complete Guide to LAN Switching Technology - Seifert, Rich: 9780470287156 - AbeBooks

1 Like

As explained by @hs2 and @RAc, a MAC address is used to identify physical network interfaces. The ARP (Address Resolution Protocol) is a mechanism that allows devices to broadcast a message to discover the IP address associated with a particular MAC address. It is important to note that if MAC addresses are shared across different network interfaces, it could lead to confusion for the ARP protocol, potentially causing connectivity issues within your subnet. To ensure proper network functionality, it is recommended to have unique MAC addresses assigned to each network interface.

Thank you.

1 Like

Hi All…

I understand what is supposed to be done…Many thanks…

Thanks & regards,
Vikram.

I believe that the intended use case of the TO is to implement something like a “virtual hub,” ie funnel his 8 cores transparently through a single network interface such that each core “sees” only its own local virtual interface.

@Vikram: That is not going to work, but the reason why is not related to ARP but these two details:

  1. The MAC address is normally programmed into the PHY such that the PHY pre filters incoming packets, passing only directed unicast or multi/broadcast packets up to higher network layers. The interface can be configured “promicuous,” meaning no filtering, but then it would be up to the network software to sort the incoming packets which is nothing a “normal” network stack is made for (you would in effect need to implement a switch/router in your device); also, in many network segments the sheer amount of packets to be looked at will utilize a normal MCU so heavily that normal operation would suffer. Not utilizing promiscuous mode, on the other hand, would mean that asynchronous packets directed to a “wrong” MAC address (ie one your interface is not currently configured for) would be lost, resulting in severe communication problems.

  2. The peer your unit is plugged in against normally is a router or a switch which in 99% of all cases relies on a single MAC address on that port (read up on “learning” MAC addresses). Many routers can for security reasons even be configured such that they shut down a port on which more than one MAC address is detected. The TOs device would in such scenarios simply stop communicating at all.

I am currently developing firmware for industrial switches/routers, dealing exactly with these kinds of issues. I can easily enumerate a dozen reasons why it is not a good idea to switch MAC addresses dynamically. There is something like a multiplexing concept called vLans which, however, acts on level 3 addressing, not level 2.and requires software support in the affected devices. Again, read Seifert’s book.

2 Likes