Changing MAC "permanently"?

Magnamuz

New Member
Joined
Apr 18, 2018
Messages
1
Reaction score
1
Credits
0
I have an Ubuntu 14 and have to change the MAC address but with:
Code:
sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
sudo ifconfig eth0 up

it changes back when I restart (or power goes off and starts itself back). Is there an easy way to change it permanently by console?
 


atanere

Well-Known Member
Joined
Apr 6, 2017
Messages
2,628
Reaction score
2,775
Credits
41
HI @Magnamuz, and welcome. At the bottom of this page, it gives this info that may help you:

On Debian, Ubuntu, and similar systems, place the following in the appropriate section of /etc/network/interfaces (within an iface stanza, e.g., right after the gateway line) so that the MAC address is set when the network device is started:
Code:
hwaddress ether 02:01:02:03:04:08  #with your own mac address, of course

You will probably have to edit the /etc/network/interfaces as root (or using sudo). Save the file and reboot to see if it works.

Good luck!
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
7,493
Reaction score
6,342
Credits
26,454
Just a note on the above "sleepless beastie" reference (& nice find, Capta :)) for The Viewers - where it says

Code:
sudo service networking restart

... if you are using a version of Ubuntu from 15.10 on, systemd replaced the upstart init process, and you would use

Code:
sudo systemctl restart networking

... note the syntax. The OP should be OK with it, as he is using 14.04 'Trusty Tahr'.

And welcome to linux.org @Magnamuz :D

Chris Turner
wizardfromoz
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Top