The MAC address is hardwired onto the NIC card when a device is manufactured. How is it that, we get to set a 48 bit MAC address of our choice while programming the arduino ?
-
It may be factory set to a default value, but that doesn't mean you can't override it.– Simon BDec 8, 2016 at 16:23
-
3Arduino's have neither NICs nor MACs. Can you elaborate on where/how you're setting a MAC while programming your Arduino?– marcelmDec 8, 2016 at 16:24
-
Arduinos don't have an Ethernet interface by default, so you have to add one; often this includes an EPROM e.g. microchip.com/design-centers/memory/serial-eeprom/…– pjc50Dec 8, 2016 at 16:24
2 Answers
MAC address is not hardwired in the modern network interface cards; it is set during programming of the configuration of the card, which is loaded on the card's start/configuration.
Modern NICs usually have option for user to set custom MAC address.
If you talk about shield device based on network chip like W5100 - there's no initial configuration within this network card for Arduino; thus by "programming the arduino" you set this initial configuration of the "card". You act like a manufacturer of the NIC.
Your initial premise is incorrect. The MAC address is NOT "hardwired". In many cases it is held in a very small non-volatile memory chip. But when the Ethernet driver is initialized you can feed it whatever MAC address you want. For most people they just accept "defaulting" it to the address programmed into the tiny memory.
Remember that the MAC address must be unique. At least within your LAN. If you start diddling the MAC addresses and you end up with a duplicate, at best you will kill connectivity for your node plus the other node with the same MAC address. Not a good thing to do. That is why people generally just accept the manufacturer's MAC address which is designed to be unique.