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,649
Reaction score
2,797
Credits
175
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
8,641
Reaction score
7,598
Credits
35,382
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
 
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com

Members online


Top