How to change the MAC Address on CentOS 8 Print

  • Linux, Centos 8, AlmaLinux, MAC Address, Server, Configuration
  • 1

If you don’t want to expose your device MAC address while connecting to Public WIFI’s or maybe the firewall or router blocked the specific MAC address, changing of MAC address to access internet service without being exposing the original MAC address. Changing of MAC address is also known as MAC Spoofing or FAKE address. In this tutorial, we will learn how to change the MAC address in CentOS8.

Find the MAC Address on CentOS

To find out the MAC address or hardware address of a network interface, open the terminal and use anyone of the following command.

# ip link show


# ifconfig | grep ether


These commands will display the hardware address of your network interface card. Sample output is attached below for reference.

ether [MACADDRESS] txqueuelen 1000 (Ethernet)

Changing the MAC Address

We can do this in two methods. Please be careful not to change your mac address with the live network card. If you do this, it will disconnect your network connection. Use this method with an additional network card.

Method 2: using the network configuration file

You can also change the MAC address from the configuration file, for this open up the configuration file of that specific interface.

# sudo vim /etc/sysconfig/network-scripts/ifcfg-ens33

Now find the line MACADDR or HWADDR and change it's Mac Address to your virtual Mac, if there is no line of MACADDR or HWADDR you can add this line MACADDR="00:00:00:00:00"

Exit and save the configuration file and restart the network, using the following command.

# sudo systemctl restart network


Again, verify the new MAC address.


In this tutorial, we learned how to change the MAC address of a network card using two different methods and after changing we also verify that new MAC address.

Was this answer helpful?

« Back