본문 바로가기
놀기/Linux

SIOCSIFHWADDR: Cannot assign requested address

by Hi~ 2022. 12. 26.

ifconfig로 MAC Address를 설정하는 테스트를 하다보니 에러가 발생했다.

참고로 ifconfig로 MAC Address를 설정하는 방법은 아래와 같이...

 

# ifconfig eth0 hw ether 12:22:33:44:55:66
SIOCSIFHWADDR: Cannot assign requested address

 

이건 뭘까?

계속 사용할 것도 아니고 테스트용으로 그냥 넣어 본 것인데.

일단 검색해 보니 MAC Address의 값이 잘못 되었다는 것을 알았다.

일단, MAC Address는 아래와 같이 되어 있다. 이건 기본적인 것이니 개발자라면 다들 알고 있는 것이니 PASS...

 

중요한 것은 Vendor code에 짝수(even)가 들어가야 한다는 것이다.

 

WHY!!!!!

 

그래서 다시 검색을 해봤다.

검색으로 아래의 내용을 찾았다.

 

There are three types of MAC addresses:

Unicast, Multicast, and Broadcast.

The way to identify which address type you are viewing is simply look at the first byte.

A unicast address’s first byte will be even, like 02, 04, 06, etc.

The first byte of a multicast address is odd, such as 01, 03, 05, etc.

The broadcast address uses all 1s binary or all FF hex.

That way, any receiving interface can tell what kind of destination address it is reading after just reading one byte.

 

이런 이유로 에러가 발생했던 것이다.

그럼 내 환경이 unicast 인 것은 어떻게 알 수 있는 것일까?

 

 

 

참조

https://www.globalknowledge.com/us-en/resources/resource-library/articles/does-a-mac-address-mean-apple-invented-it/#gref

 

Does a MAC Address Mean Apple Invented It?

MAC addresses are 48 bits or 6 bytes long, so they are also known as MAC-48 or EUI-48. EUI stands for Extended Unique Identifier. It is written in hexadecimal characters. READ MORE:

www.globalknowledge.com

 

댓글