How To Change Your Network MAC Hardware Address In Linux


There are very few reasons why you may ever need to change your MAC network address, but if necessary, it is easy to change it in Linux.


WHAT IS A MAC ADDRESS?

A MAC (Media Access Control) address is a unique number given to a hardware network card when it is manufactured. Ideally, when manufacturers work together, each MAC number is used only once, so the MAC that comes with your computer network card(s) should not exist anywhere else or on any other computers.

You may normally see MAC address values printed on labels attached to network cards, or on labels attached to computers if they are built on the main circuit boards.

Using Linux, you can see what your current MAC address value is by starting a command line console shell and then running the ifconfig command. This is what it can look like:

1.

2.







3.
4.
 
[you@genesis ~]$ su
Password: ********
[root@genesis you]# ifconfig
eth0 Link encap:Ethernet  HWaddr 01:23:45:67:89:AB
    inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0 
    UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
    RX packets:24 errors:0 dropped:0 overruns:0 frame:0
    TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:2329 (2.2 KiB)  TX bytes:6808 (6.6 KiB)
[root@genesis you]# exit
[you@genesis ~]$ exit

If you are unfamiliar with the command-line, here is an explanation of the commands shown above:

  1. su - The ifconfig command can only modify the MAC in Root Super User mode, so, first you need to run su (Some Linux distros require that you use sudo su) to change from a normal user to a Root Super User.

  2. ifconfig - List the available ethernet connections for your computer. In this example, we have only one ethernet port named "eth0" and the MAC hardware address is "01:23:45:67:89:AB". Some computers, such as laptop computers or servers, may have more than one ethernet port.

  3. exit - You can exit Root Super User mode if you are done.

  4. exit - You can exit the command-line console shell if you are done.

You should notice that the MAC address should match labels printed on your network card or on your computer.

On Windows, you use the ipconfig command to see what the network address is. It should match the value printed on a MAC Address label on your network card or computer.

1.













 
 
C:\>ipconfig /all

Ethernet adapter Local Area Connection:

        Description . . . . . . . . . . . : My Network Adapter Card  
	Physical Address. . . . . . . . . : 01-23-45-67-89-AB
	Dhcp Enabled. . . . . . . . . . . : Yes
	Autoconfiguration Enabled . . . . : Yes
	IP Address. . . . . . . . . . . . : 192.168.1.100
	Subnet Mask . . . . . . . . . . . : 255.255.255.0
	Default Gateway . . . . . . . . . : 192.168.1.1
	Lease Obtained. . . . . . . . . . : July 1, 2012 12:00:00 PM
	Lease Expires . . . . . . . . . . : July 4, 2012 12:00:00 PM

C:\>

Here is an explanation of the command shown above:

  1. ipconfig /all - This command shows details about your ethernet port(s) and configurations if they are active and running. In this example, the MAC address is "01-23-45-67-89-AB".

If you want to know more details about MAC addresses, you can go look at wikipedia.


CHANGING YOUR MAC ADDRESS

Changing a MAC Address value takes very few steps to accomplish as can be seen in the steps shown below.

1.

2.







3.
4.
5.







6.
7.
 
[you@genesis ~]$ su
Password: ********
[root@genesis you]# ifconfig
eth0 Link encap:Ethernet  HWaddr 01:23:45:67:89:AB
    inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0 
    UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
    RX packets:24 errors:0 dropped:0 overruns:0 frame:0
    TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:2329 (2.2 KiB)  TX bytes:6808 (6.6 KiB)
[root@genesis you]# ifconfig eth0 down hw ether 01:23:45:67:89:ac
[root@genesis you]# ifconfig eth0 up
[root@genesis you]# ifconfig
eth0 Link encap:Ethernet  HWaddr 01:23:45:67:89:AC
    inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
    UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
    RX packets:24 errors:0 dropped:0 overruns:0 frame:0
    TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:2329 (2.2 KiB)  TX bytes:6808 (6.6 KiB)
[root@genesis you]# exit
[you@genesis ~]$ exit

Here is an explanation of the commands shown above for changing your MAC address:

  1. su - The ifconfig command can only modify the MAC in Root Super User mode, so, first you need to run su (Some Linux distros require that you use sudo su).

  2. ifconfig - This step is optional. List the available ethernet connections for your computer. In this example, we have only one ethernet port named "eth0" and the MAC hardware address is "01:23:45:67:89:AB". Some computers, such as laptop computers or servers, may have more than one ethernet port.

  3. ifconfig eth0 down hw ether XX:XX:XX:XX:XX:XX - Turn-off the ethernet port before you modify the MAC address value. Then modify the ethernet MAC address to a new value. For this example, we modify "eth0" to be "01:23:45:67:89:ac".

  4. ifconfig eth0 up - Turn-on the ethernet port now that it contains a new MAC address value.
    NOTE: Some connections, such as wireless, will need to have a link re-established after you bring the ethernet connection back up.

  5. ifconfig - This step is also optional. Show your modified MAC address.

  6. exit - You can exit Root Super User mode if you are done.

  7. exit - You can exit the command-line console shell if you are done.


Links To Sections Of This Page
Top Of Page What Is A MAC? Change A MAC

Other Pages On This Web Site
Home Page Backup With Tar Disk Image Backup BOINC On Linux
android.rules For adb Server Remove Spaces In File Remove Duplicate Files Java On Linux
Win At Roulette Ship Arcade PicDis Disassembler


Copyright© 2000..2017 Joe's Cat Website counter