Permanently change MAC address?

eg flag

I have to change the MAC address of my WiFi card. What's the best approach?

The reason for this is, that I have to use port forwarding on my router, but it has such kind of software which is undesirable, that it only allows port forwarding for connected devices. And it is incapable of recognizing my raspberry PI. So I used a different PC, set up port forwarding rules, and now want to give the Pi the MAC address of said PC.

I have tried this, but it doesn't survive a reboot:

ifconfig wlan0 down hw ether ab:ea:5a:a3:bc:01
Marco avatar
br flag
Depends on your network manager (netplan, NetworkManager, systemd-networkd, ifupdown, ...)
user10489 avatar
in flag
It can't be "permanently" changed, but you can configure the OS to change it on each boot. This is an OS and version dependent issue, and (as mentioned above) there are still multiple ways to configure it.
Tasmotanizer avatar
eg flag
It's on Ubuntu 18.04.
mq flag

To permanently change the MAC address of your WiFi card, you need to modify the system's network configuration files. The specific method varies depending on the operating system you are using, but here are some general steps:

Determine the interface name: Run ifconfig to see a list of all network interfaces on your system. Identify the name of the interface you want to modify (e.g. wlan0).

Modify network configuration files: The location and name of the network configuration files can vary depending on your operating system and distribution. In most cases, you can find the network configuration files in the /etc/network directory. Open the configuration file for the interface you want to modify (e.g. /etc/network/interfaces), and add a line to set the MAC address:

auto wlan0
iface wlan0 inet dhcp
hwaddress ether ab:ea:5a:a3:bc:01

Replace wlan0 and ab:ea:5a:a3:bc:01 with the appropriate values for your system.

Restart the network interface: Run ifdown wlan0 followed by ifup wlan0 to restart the interface and apply the new MAC address.

Test the new MAC address: Run ifconfig and look for the interface you modified. The MAC address should be the one you set in the configuration file.

Note that changing the MAC address of your network interface may be a violation of your network provider's terms of service or local laws. Use this information responsibly and only for legal purposes.

Tasmotanizer avatar
eg flag
This does work just fine.
I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.