Tuesday, December 06, 2016

How to set the MAC address when connecting to wireless using /etc/network/interfaces

If you try to set the mac address using hwaddress ether xx:xx:xx:xx:xx:xx in /etc/network/interfaces, that fails. It seems ifup tries to set the address after connecting to WiFi. The address needs to be set before, while the interface is down. If you need the MAC address to connect, you won't connect, and if you don't need it and connect, you'll get RTNETLINK answers: Device or resource busy at the end. The solution is to use a pre-up ifconfig wlan0 hw ether xx:xx:xx:xx:xx:xx line instead of the hwaddress ether line.

No comments: