Ethernet MAC Address specification

Source: Internet
Author: User

Original address: http://blog.csdn.net/skyflying2012/article/details/40322563


Some time ago in the work of network card driver, now product mass production, the use of ifconfig eth hw ether When configuring the MAC address to find a problem,

Random configuration of a MAC address, found that some will be reported cannot assign requested address.

The error code is eaddrnotavail.

Driver implemented a special SET_MAC_ADDR function, look at the function, found that the original will verify the validity of the MAC address.

[CPP]View PlainCopy  
  1. <span style=< Span class= "string" style= "Border:none; Color: #0000ff ">" FONT-SIZE:14PX; " > Static  inline  int  is_valid_ether_addr (const u8 *addr" &NBSP;&NBSP;
  2. {
  3. / * FF:FF:FF:FF:FF:FF is a multicast address so we don ' t need to
  4. * Explicitly check for it here. */  
  5. return !is_multicast_ether_addr (addr) &&!is_zero_ether_addr (addr);
  6. }
  7. </span>
The check is not a multicast address or a full 0 address.

The multicast address is the first byte with the lowest bit 1, the problem is here.

A eaddrnotavail error code is returned when the function returns the SET_MAC_ADDR in the first byte with the lowest bit of 1 o'clock.


Strictly speaking MAC address for each NIC is fixed, each NIC is produced, there will be a global unique number to identify themselves, will not repeat,

This number is the MAC address, which is the physical address of the NIC. The MAC address consists of a 48-bit binary number, which is 6 bytes. In the communication is expressed in 16 binary.

The first 24 bits are the factory code that is applied by the manufacturer to the IEEE Standards organization, which is fixed, but the lowest bit of a byte must be 0, because the physical address of the NIC must be a unicast address

In the IPV4 environment, the distinction between unicast and multicast addresses is the binary number of the lowest digit of the school check, 0 for the unicast address and 1 for the multicast address.

In other words, the second number must be 0, 2, 4, 6, 8, A, C, e one of them.

So MAC address Although can be modified, but do not change, to follow the manufacturer's regulations to modify, so as not to repeat.

Ethernet MAC Address specification

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.