Ubuntu – How to change / spoof the MAC address and easily switch between multiple ones


My router can do port-forwarding based on MAC addresses. That is, a specific MAC will get a specific IP, for which I can configure a set of ports to be forwarded. In order to easily change that set of ports, I'd like to have different connections in the Network manager.

How do I change the MAC address for a network connection?

Best Answer

First, go to the networking indicator and select "Edit connection" to configure a new connection:

enter image description here

Click 'add' and choose a name for the spoofed MAC network connection.

enter image description here

After selecting your interface "eth0" in the top dropdown, you can simply choose any MAC address you like:

enter image description here

And after connecting to it, you'll be using your new MAC address.

enter image description here

Running ip link ls will show you the new interface, including it's spoofed MAC:

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff

And now you can easily switch MAC-addresses by connecting to one of the new connections.

Related Question