21.1 C
Texas
Mel K
LInux Guru and Technical Writer

Change default network name (ens33) to “eth0” in Centos7/RHEL7

RHEL 7 came with new feature called “consistent network device naming“.This feature change the name of network interfaces on a system in order to make locating and differentiating the interfaces easier.

Traditionally, network interfaces in Linux are enumerated as eth[0123…], but these names do not necessarily correspond to actual labels on the chassis. Modern server platforms with multiple network adapters can encounter non-deterministic and counter-intuitive naming of these interfaces. This affects both network adapters embedded on the motherboard (Lan-on-Motherboard, or LOM) and add-in (single and multiport) adapters.
Let show you how to  Change default network name (ens33) to “eth0” in Centos7 or RHEL7

The below procedure disables “consistent network device naming” and renames interfaces.

The default config is like this :

- Advertisement -

and  Should be changed to: add the string bellow the the config

net.ifnames=0 biosdevname=0

 

test the new configuration to see if no mistake has been made:

Run first : grub2-mkconfig to see if no mistake has been made

[root@osradar-com ~]# grub2-mkconfig

Then

[root@osradar-com ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-5a816247fa35410a9ee4234442a188c0
Found initrd image: /boot/initramfs-0-rescue-5a816247fa35410a9ee4234442a188c0.img
done

Copy the old  configuraton

cp /etc/sysconfig/network-scripts/ifcfg-ens33 /etc/sysconfig/network-scripts/ifcfg-eth0

edit /etc/sysconfig/network-scripts/ifcfg-eth0  to

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="eth0"
UUID="84cad80a-0c42-4540-90c6-9209735e8ea8"
DEVICE="eth0"
ONBOOT="yes"

save  and  exit

Reboot the machine

shutdown -r now

Ping form Another  machione

#:\>ping 192.168.65.132

Pinging 192.168.65.132 with 32 bytes of data:
Reply from 192.168.65.132: bytes=32 time=1ms TTL=64
Reply from 192.168.65.132: bytes=32 time=4ms TTL=64
Reply from 192.168.65.132: bytes=32 time=4ms TTL=64
Ping statistics for 192.168.65.132:
Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 4ms, Average = 3ms

Enjoy

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

3 COMMENTS

  1. In the RHEL official page says: “Do not disable consistent network device naming because it allows the system using ethX style names, where X is a unique number corresponding to a specific interface and may have different names of network interfaces during the boot process.”

    Are you sure about your tutorial? Please your help.
    Thanks in advance.
    Regards
    Jose Cruz

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article