Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

2 Answers 2

up vote 21 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
2  
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 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

or

$ sudo service networking restart

From http://namhuy.net/1890/how-to-change-mac-address-on-ubuntu.html

share|improve this answer

Your Answer

 
discard

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.