Thursday 28 May 2015

CentOS 7 Change Network Interface Name From Enp* To Eth0

CentOS 7 Change Network Interface Name From Enp* To Eth0



Step1# issue the ifconfig command to check the current network interface information, type:

    ifconfig

Step2# edit “/etc/sysconfig/grub” configuration file using “vi” command:

    vi /etc/sysconfig/grub  then searching for “GRUB_CMDLINE_LINUX” line  and appending the following content “net.ifnames=0 biosdevname=0“,

    GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto  vconsole.keymap=us rhgb quiet net.ifnames=0 biosdevname=0"

Step3# Using “grub2-mkconfig” command to re-generate a new grub configuration file, type:

     grub2-mkconfig  -o /boot/grub2/grub.cfg

Output:

    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64
    Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.img
    Warning: Please don't use old title `CentOS Linux, with Linux 3.10.0-123.el7.x86_64' for GRUB_DEFAULT, use `Advanced options for CentOS Linux CentOS Linux, with Linux 3.10.0-123.el7.x86_64' (for versions before 2.00) or `gnulinux-advanced-dbedd8fa-5d86-4ea0-8551-8444a48cd44f nulinux-3.10.0-123.el7.x86_64-advanced-dbedd8fa-5d86-4ea0-8551-8444a48cd44f' (for 2.00 or later)
    Found linux image: /boot/vmlinuz-0-rescue-3303e35a730a41e3b4e99b544acea205
    Found initrd image: /boot/initramfs-0-rescue-3303e35a730a41e3b4e99b544acea205.img
    done

Step4#   Rename “Enp0s3” network file using”mv”command, type:

    mv /etc/sysconfig/network-scripts/ifcfg-enps03  /etc/sysconfig/network-scripts/ifcfg-eth0

Step5#
Edit “/etc/sysconfig/network-scripts/ifcfg-eth0 ” configuration file and set the value of “Name” field to “eth0″.

    vi /etc/sysconfig/network-scripts/ifcfg-eth0

    TYPE=Ethernet
    BOOTPROTO=dhcp
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_FAILURE_FATAL=no
    NAME=eth0  
    UUID=5ae10208-855b-41af-99e7-0673d3792d15
    ONBOOT=yes
    HWADDR=00:0C:29:C7:25:AE
    PEERDNS=yes
    PEERROUTES=yes
    IPV6_PEERDNS=yes
    IPV6_PEERROUTES=yes

Step6# reboot system, after rebooting system, using “ifconfig” command check network interface information again.


Thats it......!!!

2 comments: