18

CentOS 5.5

One of my CenTOS systems recently booted with the following error:

"Bringing up interface eth0: Device eth0 has difference MAC address than expected. ignoring."

When I run ifconfig -a there's no entry for eth0 and I'm reasonably certain that the static HWADDR entry in /etc/sysconfig/network-scripts/ifcfg-eth0 is incorrect.

Are there alternate ways for definitively determining what the correct MAC addresses are via the command-line? I was wondering if perhaps lspci could help? I don't have hwinfo available.

4 Answers 4

14

if there is no entry in ifconfig -a... that means the device is not detected in the machine... (either due to missing driver support or bad/mis-identified hardware) check dmesg to confirm that "eth0" is detected by the system at all. You can also lspci to list all devices attached to the system... and look for unknown devices and/or your ethernet controller.

3
  • +1 TheCompWiz. This was very helpful to me. Thank you!
    – Anthony
    Feb 9, 2013 at 1:18
  • lspci -vvv gives you lots of extra information.
    – Oly Dungey
    Jan 31, 2017 at 8:48
  • lspci can be useful... unless it's a usb-ethernet adapter... lsusb works for usb... I was trying to keep the answer generic.
    – TheCompWiz
    Feb 8, 2017 at 19:54
14

for CentOS 7:

ip a

in my box, the MAC comes after 'link/ether'

ex:

link/ether cc:10:ee:5f:d8:aa

13

You can use:

For all interfaces:

cat /sys/class/net/*/address

For ethernet0 interface:

cat /sys/class/net/eth0/address

Extracted from: http://www.sysadmit.com/2018/01/linux-saber-direccion-mac.html

4

The other answers above are good for a working interface, but if you're trying to find the MAC to configure a new interface--e.g. you swap the NIC--Dwight's answer is the key. Thanks Dwight!

You mentioned ifcfg-eth0 value being incorrect--I also had that problem because I replaced the motherboard. I did the:

cat /sys/class/net/eth0/address

command and used the output to:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

and change the HWADDR value, and after running ifup eth0, the interface began working.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .