CentOS not retrieving IP via DHCP

I downloaded CentOS 5.2 Minimal Installation v1.3 pre-made VMWare virtual machine. After I upgraded CentOS from 5.2 to 5.4 (yum upgrade), my network connection stopped working because it wasn’t getting a dhcp address. Turns out my ifcfg-eth0 file had the wrong “HDADDR”.

Luckily the solution was easy:

  1. Run ifconfig eth0
  2. Make note of the “HWaddr” from it’s output. You’re looking for a hex value that looks something like: 00:0c:29:72:46:d6
  3. Edit /etc/sysconfig/network-scripts/ifcfg-eth0 and make sure the HWADDR in that file is the same as the HWaddr from the ifconfig command

That solved the problem for me