Take the 2-minute tour ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

I am new on Arduino, and I am trying to use the Ethernet shield...

but it need:

  • IP adress

  • MAC adress

IP adress is easy to get... but not MAC..

how can I get my arduino MAC adress?

share|improve this question

3 Answers 3

Current Ethernet shields come with a sticker indicating the MAC address you should use with them.

(source)

share|improve this answer
    
my Ethernet shield doesnt :( it is not the official –  Thiago Jul 25 at 15:49
    
Ultimately, all but a few bits of the MAC address are irrelevant - they only need to be globally unique. There is a range of MAC addresses reserved for "locally administered values" (ie, a range in which you are allowed to make up your own). Pragmatically speaking, you can also take the address off an obsolete device you physically possess (old ISA bus NIC?) and know is not in use. –  Chris Stratton Jul 25 at 16:15

Arduino doesn't have a MAC address, your Ethernet adapter shield however will. The MAC address is likely printed on the interface and is constructed from 12 hexadecimal numbers, usually grouped 2 hex digits at a time.

If it isn't printed on the box or the shield, then the only way to find out is to connect it to your network, configure a valid IP address on the shield and try to connect to it (eg. ping to the address) from your PC) Then you can list MAC addresses from your PC with arp -a.

Or when using dynamic addresses and DHCP, you can find the mac address in you DHCP server (probably your home router).

Either way, you need a sketch on your Arduino to configure an IP address.

share|improve this answer
    
thanks man! i will try –  Thiago Jul 25 at 15:28
    
i cant vote for you... i dont have reputation =( –  Thiago Jul 25 at 15:29
1  
This answer seems somewhat at odds with the documentation cited in the other - if the shield has to be told its MAC address by the sketch, then you can't meaningfully query it until you have done that. –  Chris Stratton Jul 25 at 15:43
    
No MAC address is hard wired, IP address is configured in software @ChrisStratton Arduino doesn't have a MAC address, the Ethernet NIC does. Arduino can probably overrule the hard wired address, but that is advanced use of the shield. –  jippie Jul 25 at 15:44
1  
@jippie - normally except in a "promiscuous mode" the MAC chip handles filtering of incoming packets by MAC address (so the processor doesn't have to), but by using an address set in a volatile register - which has to be externally loaded from some other source of information at power on / reset. If you have something like an ethernet<>serial bridge where the whole network stack is running on a dedicated embedded processor, then that probably does have the MAC address persistently stored, though again, not typically actually within its ethernet functional block but rather elsewhere inside. –  Chris Stratton Jul 25 at 16:11

A MAC address must be unique throughout the environment in which it operates, but apart from that is largely arbitrary. Typically the problem is solved by selling 3-octet prefixes (called OUI's) to manufacturers, who then uniquely assign the remaining 3 octets to individual device units they manufacturer.

However, if you are unable to discovery a globally unique address assigned to your device by its manufacturer, and know that its traffic will be confined to a local network, you can use a privately assigned (ie, "made up") address with the Locally Administered bit set. An address of the form

02-xx-xx-xx-xx-xx-xx

or any other with the 2's bit of the first octet set will satisfy this criteria as long as you guarantee that it is unique in your system.

Be especially careful not to set the 1's bit of the first octet - if you do so, traffic will be marked as broadcast and so given wider distribution/attention than needed, wasting network capacity and processor time of connected devices.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.