Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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?

share|improve this question

4 Answers 4

up vote 25 down vote accepted

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.

share|improve this answer
Is it possible to automate and randomize the Mac address for every new connection or login? I would post this as a new question, but I assume it would get marked as a duplicate of your question. –  king_julien Aug 6 '13 at 8:25
Yes, there is a thing called macchanger - but I've never tried it. –  Stefano Palazzo Aug 6 '13 at 11:51
In gnome shell, I don't get the option to set up another interface on eth0. Could you describe what's going on behind the scenes, and how to achieve it via a terminal? thx –  drevicko May 7 '14 at 3:09

You can also change mac address on ubuntu or linux mint via the terminal

Go to your ubuntu or linux mint terminal, edit /etc/network/interfaces file

$ sudo nano /etc/network/interfaces

You should see something like this with dhcp enabled for your network interface. Usually its eth0 for ubuntu or linux mint wired network and wlan0 for ubuntu or linux mint wireless network.

auto eth0
iface eth0 inet dhcp

At the end of /etc/network/interfaces file, add this line to give your system’s network interface new MAC address.

hwaddress ether A4-19-E2-94-DD-BB

Save /etc/network/interfaces file with the new config, then restart your system network.

$ sudo /etc/init.d/networking restart


$ sudo service networking restart


share|improve this answer

You could try macchanger available in the repositories. Install with sudo apt-get install macchanger or through Ubuntu Software center.

$ macchanger
GNU MAC Changer
Usage: macchanger [options] device

Try `macchanger --help' for more options.
tvbox@tvbox-G31M-ES2L:~$ macchanger --help
GNU MAC Changer
Usage: macchanger [options] device

  -h,  --help                   Print this help
  -V,  --version                Print version and exit
  -s,  --show                   Print the MAC address and exit
  -e,  --ending                 Don't change the vendor bytes
  -a,  --another                Set random vendor MAC of the same kind
  -A                            Set random vendor MAC of any kind
  -p,  --permanent              Reset to original, permanent hardware MAC
  -r,  --random                 Set fully random MAC
  -l,  --list[=keyword]         Print known vendors
  -b,  --bia                    Pretend to be a burned-in-address
  -m,  --mac=XX:XX:XX:XX:XX:XX
       --mac XX:XX:XX:XX:XX:XX  Set the MAC XX:XX:XX:XX:XX:XX

Granted this a CLI utility.

share|improve this answer

Install macchanger and have it run every time the network connects by using a udev rule. Create the following file:

## File name /etc/udev/rules.d/70-macchanger.rules
## Set Mac Address for Network Adapters
ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="/usr/bin/macchanger -m XX:XX:XX:XX:XX:XX %k"
ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*" RUN+="/usr/bin/macchanger -m XX:XX:XX:XX:XX:XX %k"

Replace XX:XX:XX:XX:XX:XX with the Mac Address you want. (Note: some addresses are invalid)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.