0

In this tutorial we will see how to change the MAC (Media Access Control) address of a network device under Ubuntu 12.04/11.10 or older. Let's suppose your internet provider is allowing only internet connections with pre-configured MAC addresses. You will be unable to connect to the Internet if you buy a new wireless/wired network device because it uses a different MAC address. So, this tutorial will be very helpful for this situation.

Getting Started


To check your current MAC address (es) for connected wired/wireless network devices under Ubuntu, run this command:

sudo ifconfig -a


A MAC address is a combination of 12 hexadecimal digits and letters. You can generate a random MAC address with this command from the terminal:

openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'

Let's now start our tutorial. You need first to stop your network manager (wired or wireless connection) with this command:

sudo service network-manager stop

To change the current MAC address, run this command:

sudo ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx

Replace xx:xx:xx:xx:xx:xx with your own MAC address. Here is an example:

sudo ifconfig eth0 hw ether 32:43:21:ea:bd:40

"eth0" (eth1, eth2, etc.) is the network interface for a wired connection. If you are connecting to the internet over a wireless connection, then replace it with "wlan0" (wlan1, wlan2, etc.). Your command will be as follows:

sudo ifconfig wlan0 hw ether xx:xx:xx:xx:xx:xx

Next, restart your network manager with this command:

sudo service network-manager restart

Now check again your network interfaces to see if the new MAC address (es) is well enabled:

sudo ifconfig -a

Note: This tip is also workable on Ubuntu 11.04/10.10 or older.

Post a Comment

 
Top