I'm trying to use a raspberry pi as an HTTP server from my home network. I have to do this via a USB wireless adapter instead of CAT5 for a number of reasons that I won't get into.

Problem is, I can't port-forward this device from my router consistently, because the DHCP reservation I have set up for it doesn't hold. I found out that my MAC address is different every time my pi reconnects.

Is there some way I can hardcode a specific MAC address into wpa_supplicant, or into some other script I can set to run at boot?


My solution was to replace the systemd init script for wpa_supplicant with one that uses ifconfig to set the MAC prior to starting wpa_supplicant. Not exactly the cleanest solution, but it works well enough that I don't need a different fix.

  • Either you hardcode it in a configuration file (cannot remember the specifics I am afraid), or you use a wifi pen. – Rui F Ribeiro Jan 17 '18 at 20:56
  • Alternative: configure a static IP address instead of using DHCP. – derobert Jan 17 '18 at 21:00
  • 4
    do not edit the question, had your own answer. – Rui F Ribeiro Jan 17 '18 at 21:02
  • @RuiFRibeiro I don't think it technically counts as a solution because it wasn't quite what I was asking for. – Ethan McTague Jan 17 '18 at 21:03
  • it is not up for wpa_supplicant to do that anyway. – Rui F Ribeiro Jan 17 '18 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.