Glen Turner (vk5tu) wrote,
Glen Turner

Replacing NIC card in Debian traditional networking

Before you replace the hardware edit /etc/udev/rules.d/70-persistent-net.rules. Find the line containing the interface name you are replacing, such as NAME="eth0". Within that line alter the ATTR{address} clause from the current NIC's MAC address to the new NIC's address.

If the interface uses DHCP then remove knowledge of the DHCP lease by removing /var/lib/dhcp/dhclient.NAME.leases.

Now power down, disconnect the power lead, change the NIC card, and re-power.

If you forget to edit 70-persistent-net.rules beforehand all is not lost, you'll simply need to tidy the file up to combine the old and new NIC device entries. Alternatively, if your care factor is low then echo -n > /etc/udev/rules.d/70-persistent-net.rules, reboot, and let the file be rebuilt; of course the order of allocation of NICs to interface names might change.

Follow a similar process when using a VM and changing from emulating a NIC card to using the faster virtio adapter. Or when cloning a VM and assigning new random MAC addresses.

Tags: linux, raspberrypi
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.