Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides
https://forum.ivorde.com/

Linux How to change hardware MAC address of an interface
https://forum.ivorde.com/linux-how-to-change-hardware-mac-address-of-an-interface-t994.html
Page 1 of 1

Author:  debuser [ Sat Dec 03, 2011 9:18 pm ]
Post subject:  Linux How to change hardware MAC address of an interface

The mac address is also referred to as physical address and it is used in Ethernet network via ARP and DHCP to map a layer 3 IPv4 address.

Change interface mac address in Linux


To change the mac address of an interface in Linux, the interface needs to be brought down first, otherwise a "device or resource busy" error will occur. This can be done if logged in via ssh to an interface not serving the ssh traffic (otherwise reachability will be lost) or if connected through a console port.

Code:
root@server:~# ip a l eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:16:3e:3a:0a:1a brd ff:ff:ff:ff:ff:ff
    inet6 fe80::216:3eff:fe3a:a1a/64 scope link
       valid_lft forever preferred_lft forever

root@server:~# ifconfig eth0 hw ether '00:16:3e:3a:0a:1b'
SIOCSIFHWADDR: Device or resource busy - you may need to down the interface
root@server:~# ifconfig eth0 down
root@server:~# ifconfig eth0 hw ether '00:16:3e:3a:0a:1b'
root@server:~# ifconfig eth0 up
root@server:~# ip a l eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:16:3e:3a:0a:1b brd ff:ff:ff:ff:ff:ff
    inet6 fe80::216:3eff:fe3a:a1b/64 scope link
       valid_lft forever preferred_lft forever

Author:  Zettie49 [ Tue Dec 06, 2011 6:26 am ]
Post subject:  Re: Linux How to change hardware MAC address of an interface

I am wondering how to change the MAC address of my ethernet adaptor(eth0) under Linux. Since the LAN's IP address need register in my college, and I want to use my laptop in Lab. I think the way to do it is to change my MAC to the Lab computer's.


Waiting for your help

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/