Renaming a Linux NIC interface

You may be wondering why this is even a topic of discussion. Well, certain Linux distros such as CentOS come with the main interface as eth0. For me, it’s not as big of a deal. The concern comes in when I am developing baselines and distributing them back into the community. The more I can do to ensure that things look the same across the distros, the better. In order to rename the interface, one can do the below.

1. Open a terminal and ensure you are Root.

2. Get the MAC and current listing of the interface. Be sure to make note of the MAC for a future step.

3. Open/create the file we will use to edit the interface.

4. Once the file is open, copy and paste the below (if its not already there). Put the MAC address of your system where it says “ATTR{address}==”. Input whatever you want the interface to be labeled as where it says “NAME=”.

5. Save and close the file.

6. Next disable the predictable naming rule. In order to do that, edit the /etc/default/grub file and add “net.ifnames=0″ to GRUB_CMDLINE_LINUX variable. You can do that by copying the below text which already has it in there.

7. Save and close the file.

8. Next, run the below command to regenerate the GRUB configuration file with updated kernel parameters.

9. Reboot the system.

10. Log back in and check that its change.

11. Verify settings after reboot.

12. Done!