I've found GNU macchanger to be the easiest way to do that kind of stuff. It's as simple as:<p>macchanger -r <interface><p>Interesting article about macchanger on the Arch Wiki: <a href="https://wiki.archlinux.org/index.php/MAC_address_spoofing" rel="nofollow">https://wiki.archlinux.org/index.php/MAC_address_spoofing</a>
It’s worth noting that iOS has randomized MAC addresses in WiFi probes since iOS 8.[1] As far as I know your real MAC address is exposed upon connection. I’m curious to what extent other vendors have implemented this strategy.<p>[1] <a href="https://arstechnica.com/gadgets/2014/06/ios8-to-stymie-trackers-and-marketers-with-mac-address-randomization/" rel="nofollow">https://arstechnica.com/gadgets/2014/06/ios8-to-stymie-track...</a>
I've used <a href="https://github.com/feross/SpoofMAC" rel="nofollow">https://github.com/feross/SpoofMAC</a> in the past, which is a simple python tool for doing just this, cross-platform. Used it a lot in airports and can warmly recommend using it if you're usually dealing with multiple different OSes and don't want to remember how to do it for each.
Note that your MAC address is only one part of the identifying information your computer gives to the DHCP server. For another approach check out DHCPcAnon:<p><a href="https://github.com/juga0/dhcpcanon" rel="nofollow">https://github.com/juga0/dhcpcanon</a><p>You can contribute to the development of this project by helping to integrate it with your favorite WiFi manager.
MAC address randomization is in fact built in to NetworkManager (edit: 1.4), so none of this work is really necessary (edit: if you are on 1.4 or later).<p>NetworkManager also includes more advanced modes which make the MAC address stable for a given hotspot, but random between them.<p><a href="https://blogs.gnome.org/thaller/2016/08/26/mac-address-spoofing-in-networkmanager-1-4-0/" rel="nofollow">https://blogs.gnome.org/thaller/2016/08/26/mac-address-spoof...</a>
Here is the code I use for my mac to randomize my mac address:<p><pre><code> interface="en0"
new_mac=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/:$//; s/./0/2') # from stackoverflow
sudo ifconfig $interface ether $new_mac
</code></pre>
Edit: What's the advantage of the solution in the post? If I just change my mac address every time I join a network (even the same one), they can't track me with my randomized mac addresses. So why would I prefer to keep a stable but randomized mac address for each network I connect to for a day?
On systemd-networkd, you can add<p><pre><code> [Link]
MACAddressPolicy=random
</code></pre>
and (for RFC 7844[13] DHCP Anonymity Profiles)<p><pre><code> [DHCP]
Anonymize=true
</code></pre>
to your network unit or link.
Here <a href="https://blogs.gnome.org/thaller/2016/08/26/mac-address-spoofing-in-networkmanager-1-4-0/" rel="nofollow">https://blogs.gnome.org/thaller/2016/08/26/mac-address-spoof...</a> is how you can do it with newer NetworkManager.
Btw. if you want to use a random mac address just for one specific network you can simply add the following to the [wifi] section of the config file for that network (/etc/NetworkManager/system-connections/):<p><pre><code> cloned-mac-address=random
</code></pre>
That way every time you connect to that network you will have a new, valid mac address.
This seems like a good idea until you realize that you are the only one using a random mac address. (There is a vendor prefix at the beginning of every mac) Better would be to take a bit more care in choosing a more realistic address.
Be aware that this technique could be illegal or appear suspicious in some jurisdictions. MAC address randomization was mentioned in Aaron Swartz's indictment for wire fraud.<p>See page 7: <a href="https://www.wired.com/images_blogs/threatlevel/2012/09/swartzsuperseding.pdf" rel="nofollow">https://www.wired.com/images_blogs/threatlevel/2012/09/swart...</a>
Will these new randomized MACs also be lookupable [1] to find the model? If I'm the feds running honeypot wifi and I see a different Dell Chromebook doing things interesting to me every day, this isn't a good cover.<p>[1] <a href="https://www.macvendorlookup.com/" rel="nofollow">https://www.macvendorlookup.com/</a>
Where would MAC address capture occur on the network? MACs are local to L2 traffic, so once a frame turns into a packet and is routed, the sMAC of your PC is no longer present in the data. If you're on your home network, this has no impact what so ever.
Are there any lawyers here that can speak about the legal side of this? I could imagine a wifi provider that offers 30 minutes free wifi e.g. airports, has this covered in their terms and conditions or a country that could consider this as fraudulent?
This seems like it should be a default indeed. It does make it harder to assign fixed addresses to your devices in your home network. At least openwrt only seems to have static DHCP leases based on MAC and not on the advertised DHCP name. For most devices this doesn't matter as it does add a DNS entry with whatever IP it assigned. But when you then want to add a firewall rule to port forward something to a device a fixed IP is much nicer.