The problem
Lately, I noticed that my el-cheapo-Chinese-Ebay-phone (Star B943) got a different IP address every time I re-enabled the Wifi connection. It never did this before (it always reused the same address, as I set the lease duration to 1 week on my server). I don’t know how or why this behaviour started, but I certainly didn’t like it. After examining the dhcp.leases file on my DHCP server, I was in for a big surprise: it appeared that my phone simply changed its own MAC address every single time, which immediately explains why the DCHP server handed out a new lease every time !
Googling the Interwebz learned me that a lot of Android users were(are) facing the same problem. Luckily, I also found a solution to the problem (muchas gracias to Damian Parsons at http://gizbeat.com/ ). This solution only works on a rooted phone.
How to fix it:
- If you don’t have it already, install a root file explorer (like Total Commander) on your phone
- Make sure to allow root privileges every time your root file explorer requests it.
- Navigate to
/data/nvram/APCFG/APRDEB
- Copy the file named WIFI to your SD card
- Somehow copy this file to your computer (USB transfer, email, . . .)
- Install a hex editor (Hxd is a good one)
- Open the previously copied WIFI file in HxD. It should look similar to the following image:
- The MAC address starts at row 1, column 4 and it ends at row 1, column 9.
- In my case, the colums 4 till 9 were all zeroes, which explains the problem. When the mac address handed to the kernel at boot is empty, the kernel will start generating random mac addresses.
- Now, input your desired WLAN MAC Address in the colums 4 till 9 (see next image):
- You did not use the same MAC address I used in this example, right ? 😉
- Save the file, but preferably under a different name, or otherwise backup the original WIFI file before editing.
- Copy this new file back to the SD card of your phone.
- Navigate back to
/data/nvram/APCFG/APRDEB
- Overwrite the previously existing WIFI file with your modified WIFI (renaming it back to WIFI if necessary).
- Possibly check the file permissions and change them to the same as the original WIFI file if required.
- Reboot your phone.
- Now check the mac address of the wifi card: it should the same as the one you entered in the WIFI file.
- Enable/disable the wifi connection several times to verify the mac address does not change any more.
The above fix worked for me, on a Star B94m (B943), running stock Android 4.2.1 JB (rooted). Let me know if it also works for you.
Leave a Reply