blog.up-link.ro android bsd linux unix & open-source world

26Apr/101

How To Change MAC Address in Linux, BSD, Unix

WP Greet Box icon
Hello there! If you are new here, you might want to subscribe to the RSS feed or subscribe via E-mail for updates on this topic.

Media Access Control address (MAC address) is a unique identifier assigned to most network adapters or network interface cards (NICs) by the manufacturer for identification, and used in the Media Access Control protocol sub-layer. If assigned by the manufacturer, a MAC address usually encodes the manufacturer's registered identification number. It may also be known as an Ethernet Hardware Address (EHA), hardware address, adapter address, or physical address.

1. Change MAC Address in Linux ( CentOS, Debian, Fedora, RHEL, Slackware, SuSE, Ubuntu )

# ifconfig [interface name] down
# ifconfig [interface name] hw ether [new MAC address]
# ifconfig [interface name] up

Example:

# ifconfig eth0 down
# ifconfig eth0 hw ether 1A:2B:3C:4D:5E:6F
# ifconfig eth0 up

2. Change MAC Address in FreeBSD

# ifconfig [interface name] down
# ifconfig [interface name] ether [new MAC address]
# ifconfig [interface name] up

Example:

# ifconfig xl0 down
# ifconfig xl0 ether 1A:2B:3C:4D:5E:6F
# ifconfig xl0 up

3. Change MAC address in HP-UX

Under HP-UX, you can change the MAC address in SAM by selecting Networking and Communications, then selecting the interface, then Action, Modify, Advanced Options. HP-UX refers to the MAC address as the "station address".

4. Change MAC address in IBM AIX

Set the physical MAC address for NIC.
# chdev -l ent0 -a
alt_addr=<new mac addr> -P

Use the new MAC address.
use_alt_addr=yes -P

# reboot

5. Change MAC address in Mac OS X

Since Mac OS X 10.4.x (Darwin 8.x) onwards, the MAC address of wired Ethernet interface can be altered in Apple Mac OS X in a fashion similar to the FreeBSD/OpenBSD method.

# sudo ifconfig [interface name] down
# sudo ifconfig [interface name] ether 1A:2B:3C:4D:5E:6F
# sudo ifconfig [interface name] up

or

# sudo ifconfig [interface name] lladdr aa:bb:cc:dd:ee:ff (for Mac OS X 10.5 Leopard)

Example:

# sudo ifconfig en0 down
# sudo ifconfig en0 ether 1A:2B:3C:4D:5E:6F
# sudo ifconfig en0 up

or

# sudo ifconfig en0 down
# sudo ifconfig en0 lladdr 1A:2B:3C:4D:5E:6F
# sudo ifconfig en0 up

6. Change MAC address in OpenBSD

# ifconfig [interface name] down
# ifconfig [interface name] lladdr [new MAC address]
# ifconfig [interface name] up

Example:

# ifconfig bge1 down
# ifconfig bge1 lladdr 1A:2B:3C:4D:5E:6F
# ifconfig bge1 up

7. Change MAC address in Solaris

# ifconfig [interface name] down
# ifconfig [interface name] ether [new MAC address]
# ifconfig [interface name] up

Example:

# ifconfig hme0 down
# ifconfig hme0 ether 1A:2B:3C:4D:5E:6F
# ifconfig hme0 up

Print This Post Print This Post
Comments (1) Trackbacks (0)
  1. Thank you for sharing your knowledge. Now that I changed my MAC address in Mac OS X, I see in my terminal promt a new instance of my computer with the prefix ~computer as this: myuser-computer:~myuser$ and shows in my network a new computer even though I changed back the MAC address. Is there a command to put things back where they were before? Thanks again!


Leave a comment


*

No trackbacks yet.