Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Unc3nZureD
#59313 Connecting to the WiFi in my college is very limited, it's actually bound to MAC address.
That's why I want to change the ESP8266 MAC address to eg. my phone address. ( I know, it can conflict if I want to connect both esp8266 & phone, but just forget about this case, I won't use both of them ;) )

So, I've seen this API:
Code: Select allwifi_set_macaddr( ... )


So I just made my quick code:

Code: Select allvoid setup()
{
   Serial.begin(115200);
   Serial.print("Connecting to ");
   Serial.println(ssid);

   uint8_t mac[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
   bool a = wifi_set_macaddr(SOFTAP_IF, &mac[0]);

   WiFi.mode(WIFI_AP_STA);
   WiFi.hostname("ESP8266  Test Device");
   WiFi.begin(ssid, password);

   while (WiFi.status() != WL_CONNECTED) {
      delay(500);
      Serial.print(".");
   }

   Serial.println("");
   Serial.println("WiFi connected");
   Serial.println("IP address: ");
   Serial.println(WiFi.localIP());
}


But even after this the device seems to have the same MAC address as before:
http://i.imgur.com/xekXjBF.png

Could anyone tell me where did I fail, or what should I do to make it work?
User avatar
By Unc3nZureD
#59314 Oops, sorry for quick posting & self-answering, but I just found the problem :)

So if someone needs, he can use my code above by correcting this small mistake:
You have to use "STATION_IF" for WiFi connections.

eg. this:
Code: Select alluint8_t mac[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
bool a = wifi_set_macaddr(STATION_IF, &mac[0]);