Back to Top

Monday, September 05, 2011

Creating a non-MAC bound CentOS 6 machine

I was building VMs to be deployed with Vagrant / Virtualbox for our QAs and discovered that on new instantiations of the machine the networking interface wasn't coming up. The problem was that Virtualbox was assigning a random MAC address to the NIC (and rightly so, to avoid conflicts). I used the following steps to solve this:

  1. Remove the HWADDR line from /etc/sysconfig/network-scripts/ifcfg/eth0
  2. Delete the file /etc/udev/rules.d/70-persistent-net.rules (hat tip)

These two steps are specific to CentOS 6 (on 5.x the first step is sufficient). Also, the second if is recreated at the next boot, thus after rm-ing it, you should shut down the machine and package it (not start it again, or if you do, you should remove the file again).

1 comment:

  1. I've been building bootable usb sticks with persistent environments on them lately, and a similar thing happens with Debian-based distros such as Ubuntu and Backtrack. I just started putting a generic "dhclient" in /etc/rc.local, and it will auto-detect pretty much any wired NIC and go to town. elegant? Not really. Quick and works? Absolutely. YMMV on RHL-based distros, though.

    ReplyDelete