How to change the MAC address on a Red Hat Linux Server

  • Obtain root access
  • Log in with root privileges
  • Confirm current MAC address using “ifconfig”
  • Config Spoofed MAC address by adding the following configuration line to /etc/sysconfig/network-scripts/ifcfg-eth0

MACADDR=00:0a:0b:0c:0d:0e

  • Restart Network services
/etc/rc.d/init.d/network restart 
  • Confirm MAC address changed using “ifconfg”

See below for example output

[[email protected] /]# ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:EE:82:28

          inet addr:192.168.1.111  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feee:8228/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:344 errors:0 dropped:0 overruns:0 frame:0
          TX packets:162 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:60555 (59.1 KiB)  TX bytes:17201 (16.7 KiB)
          Interrupt:193 Base address:0x2000

lo Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:31616 errors:0 dropped:0 overruns:0 frame:0
          TX packets:31616 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6355805 (6.0 MiB)  TX bytes:6355805 (6.0 MiB)

[[email protected] ~]# cd /etc/sysconfig/network-scripts/ [[email protected] network-scripts]# vi ifcfg-eth0

DEVICE=eth0 ONBOOT=yes TYPE=Ethernet ETHTOOL_OPTS="autoneg on" BOOTPROTO=none IPADDR=192.168.1.111 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 MACADDR=00:01:02:03:04:05

[[email protected] network-scripts]# /etc/rc.d/init.d/network restart

Shutting down interface eth0: [ OK ] 
Shutting down loopback interface: [ OK ] 
Setting network parameters: [ OK ] 
Bringing up loopback interface: [ OK ] 
Bringing up interface eth0: [ OK ]

[[email protected] network-scripts]# ifconfig eth0 Link encap:Ethernet HWaddr 00:01:02:03:04:05

          inet addr:192.168.1.111  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::201:2ff:fe03:405/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:455 errors:0 dropped:0 overruns:0 frame:0
          TX packets:384 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:55523 (54.2 KiB)  TX bytes:45574 (44.5 KiB)
          Interrupt:193 Base address:0x2000

lo Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:67 errors:0 dropped:0 overruns:0 frame:0
          TX packets:67 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6228 (6.0 KiB)  TX bytes:6228 (6.0 KiB)
  • os/linux/mac.txt
  • Last modified: 2018/05/17 20:37
  • by gerardorourke