Howto reset network device after swapping disks from one PC to another

I had a problem with a very old Compaq PC not detecting the keyboard anymore. I used the PC as a local server, not a real problem, except that the BIOS didn't allow the PC to boot when the keyboard was not plugged in. One solution there might have been to use some USB keyboard (I didn't get a chance to try that - didn't have any USB keyboard lying around). Luckily enough, I happened to have a clone of this computer, so I just swapped the disks from one PC to the other, and booted. This one detected the keyboard without a problem and started booting Debian. Now the problem was that Debian (which was on the disk which I swapped from one PC to another, thus changing all the devices IDs and stuff) wouldn't find my network device (at least where I expected it to), so I was left with a working local server without network... pretty useless. So I called my resourceful brother (Jérôme), and he quickly explained to me that Debian's udev stored its NIC MAC address in /etc/udev/rules.d/*persistent-net*. Clearly, that was true. Then I didn't know how to get the real MAC (I could probably have found it in /proc/ somewhere), but the thing is that, he said, you can just delete the file, reboot, and Debian will rebuild it. So, one delete and reboot later, I had network on my local server! Thanks Jérôme!

Comments