You can either do it manually (Working with MAC Addresses) or use a package called macchanger (GNU MAC Changer).
To manually change your MAC address, for example, for eth0, you do the following:
- Code: Select all
sudo vim /etc/network/interfaces
And then you add following line to end of interface being configured (eth0 in this example):
- Code: Select all
hwaddress xx:xx:xx:xx:xx:xx
where xx:xx:xx:xx:xx:xx is the MAC address.
So now your interfaces file may look like this:
- Code: Select all
auto eth0 static
iface eth0 inet static
address 10.10.10.5
netmask 255.255.255.0
gateway 10.10.10.1
broadcast 10.10.10.255
hwaddress ether 01:02:03:04:05:06
CentOS
Open the file of the network interface you want to modify and remove HWADDR line and add MACADDR.
For example, if you want to explicitly specify a MAC address for eth0, you do the following:
- Code: Select all
vi /etc/sysconfig/network-scripts/ifcfg-eth0
So now your ifcfg-eth0 file may look like:
- Code: Select all
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
DHCP_HOSTNAME=localhost.localdomain
IPADDR=10.10.1.5
NETMASK=255.255.255.0
GATEWAY=10.10.1.1
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
MACADDR=01:02:03:04:05:06