{"id":6627,"date":"2017-04-12T21:31:37","date_gmt":"2017-04-12T13:31:37","guid":{"rendered":"http:\/\/rmohan.com\/?p=6627"},"modified":"2017-04-12T21:31:37","modified_gmt":"2017-04-12T13:31:37","slug":"rhel-7-centos-7-use-classic-eth0-style-device","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6627","title":{"rendered":"RHEL 7 \/ CENTOS 7 USE CLASSIC ETH0 STYLE DEVICE"},"content":{"rendered":"<h3>WHY WAS IT CHANGED ?<\/h3>\n<p>Red Hat Enterprise Linux 7 introduced a new scheme\u00a0for naming network devices called \u201cConsistent Device Naming\u201d. It\u2019s called Consistent Device Naming because previously the name\u00a0of the devices [eth0,eth1,eth2] was completely dependant upon the order the kernel detected them as it booted. In certain circumstances,\u00a0such as adding new devices to an existing system, the naming scheme could become unreliable.<\/p>\n<h3>FURTHER READING<\/h3>\n<p>The official Red Hat 7 Documentation on consistent device naming can be found <a href=\"https:\/\/access.redhat.com\/documentation\/en-US\/Red_Hat_Enterprise_Linux\/7\/html\/Networking_Guide\/ch-Consistent_Network_Device_Naming.html\" target=\"_blank\">here<\/a>.<\/p>\n<h3>WHAT DOES THE NEW SCHEME LOOK LIKE ?<\/h3>\n<pre># <strong>ip link show<\/strong>\r\n1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT\r\n link\/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\r\n2: <strong>eno16777736<\/strong>: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000\r\n link\/ether 00:0c:29:89:1b:2e brd ff:ff:ff:ff:ff:ff<\/pre>\n<h3>HOW DO I CHANGE IT BACK TO ETH[0-9] STYLE NAMING ?<\/h3>\n<p>In summary we need to<\/p>\n<ul>\n<li>Add extra parameters to the kernel configuration<\/li>\n<li>Add this to the boot configuration<\/li>\n<li>Restart the machine<\/li>\n<li>Move the existing interfaces to the new scheme<\/li>\n<li>Restart the network service<\/li>\n<\/ul>\n<h3>ADD EXTRA PARAMETERS TO THE KERNEL CONFIGURATION<\/h3>\n<p>Modify the grub bootloader to pass some extra parameters to the kernel at boot time. The kernel will then use these options to decide which naming scheme to use.<\/p>\n<p>First we backup and edit the grub configuration file.<\/p>\n<pre># <strong>cp \/etc\/default\/grub \/etc\/default\/<span class=\"skimlinks-unlinked\">grub.bak<\/span><\/strong><\/pre>\n<p>Then we can safely edit the\u00a0grub configuration file<\/p>\n<pre># <strong>vim\u00a0\/etc\/default\/grub<\/strong><\/pre>\n<p>The config file will look similar to the following<\/p>\n<pre>GRUB_TIMEOUT=5\r\nGRUB_DISTRIBUTOR=\"$(sed 's, release .*$,,g' \/etc\/system-release)\"\r\nGRUB_DEFAULT=saved\r\nGRUB_DISABLE_SUBMENU=true\r\nGRUB_TERMINAL_OUTPUT=\"console\"\r\n<strong>GRUB_CMDLINE_LINUX<\/strong>=\"crashkernel=auto <span class=\"skimlinks-unlinked\">rd.lvm.lv=rhel\/root<\/span> <span class=\"skimlinks-unlinked\">rd.lvm.lv=rhel\/swap<\/span> rhgb quiet \"\r\nGRUB_DISABLE_RECOVERY=\"true\"<\/pre>\n<p>The line that starts \u201cGRUB_CMDLINE_LINUX\u201d needs to have some extra paramters added.<\/p>\n<p>The extra parameters are<\/p>\n<pre>biosdevname=0 net.ifnames=0<\/pre>\n<p>So the final file looks like<\/p>\n<pre>GRUB_TIMEOUT=5\r\nGRUB_DISTRIBUTOR=\"$(sed 's, release .*$,,g' \/etc\/system-release)\"\r\nGRUB_DEFAULT=saved\r\nGRUB_DISABLE_SUBMENU=true\r\nGRUB_TERMINAL_OUTPUT=\"console\"\r\nGRUB_CMDLINE_LINUX=\"crashkernel=auto <span class=\"skimlinks-unlinked\">rd.lvm.lv=rhel\/root<\/span> <span class=\"skimlinks-unlinked\">rd.lvm.lv=rhel\/swap<\/span> rhgb quiet <strong>biosdevname=0 net.ifnames=0<\/strong> \"\r\nGRUB_DISABLE_RECOVERY=\"true\"<\/pre>\n<h3>ADD THIS TO THE BOOT CONFIGURATION<\/h3>\n<p>If you are using a UEFI system then rebuild grub with this command<\/p>\n<pre class=\"screen\">#\u00a0<strong><code class=\"command\">grub2-mkconfig -o \/boot\/efi\/EFI\/redhat\/grub.cfg<\/code><\/strong><\/pre>\n<p class=\"screen\">Otherwise use the following<\/p>\n<pre class=\"screen\"># <strong>grub2-mkconfig -o \/boot\/grub2\/<span class=\"skimlinks-unlinked\">grub.cfg<\/span>\r\n<\/strong>Generating grub configuration file ...\r\nFound linux image: \/boot\/vmlinuz-3.10.0-327.el7.x86_64\r\nFound initrd image: \/boot\/initramfs-3.10.0-327.el7.x86_64.img\r\nFound linux image: \/boot\/vmlinuz-0-rescue-3c913eca0eab4ebcb6da402e03553776\r\nFound initrd image: \/boot\/initramfs-0-rescue-3c913eca0eab4ebcb6da402e03553776.img\r\ndone<\/pre>\n<h3>RESTART THE MACHINE<\/h3>\n<p>Now we will restart the host, and the new naming scheme will take effect on reboot.<\/p>\n<pre># <strong>shutdown -r now<\/strong><\/pre>\n<h3>MOVE THE EXISTING INTERFACES TO THE NEW SCHEME<\/h3>\n<p>It\u2019s possible\u00a0you may now need to reconfigure your network interface.<\/p>\n<p>Here you can see the network interface is up, however there is no IP information associated with the new device name.<\/p>\n<pre># <strong>ip link<\/strong>\r\n1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT\r\n link\/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\r\n2: eth0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000\r\n link\/ether 00:0c:29:89:1b:2e brd ff:ff:ff:ff:ff:ff<\/pre>\n<p>For this example we will assume i\u2019m not using NetworkManager. Therefore I\u2019ll be editing the network configuration files in \/etc\/sysconfig\/network-scripts directly.<\/p>\n<p>Change into the network scripts directory.<\/p>\n<pre># <strong>cd\u00a0\/etc\/sysconfig\/network-scripts\/<\/strong><\/pre>\n<p>Rename the old interface configuration file to new scheme<\/p>\n<pre># <strong>mv ifcfg-eno16777736 ifcfg-eth0<\/strong><\/pre>\n<p>Update the contents of the configuration file to use the new scheme<\/p>\n<pre># <strong>sed -i 's\/eno16777736\/eth0\/' ifcfg-eth0\r\n\r\nmv ifcfg-eno16777736 ifcfg-eth0\r\nvi \/etc\/udev\/rules.d\/90-eno-fix.rules\r\n# This file was automatically generated on systemd update\r\nSUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{address}==\"00:0c:29:9e:8f:95\", NAME=\"eno16777736\"\r\n\r\n# This file was automatically generated on systemd update\r\nSUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{address}==\"00:0c:29:9e:8f:95\", NAME=\"eth0\"\r\n<\/strong>\r\n\r\n<\/pre>\n<h3>RESTART THE NETWORK SERVICE<\/h3>\n<p>Finally restart the network service so the changes take effect.<\/p>\n<pre># <strong>systemctl restart network<\/strong><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>WHY WAS IT CHANGED ? <\/p>\n<p>Red Hat Enterprise Linux 7 introduced a new scheme for naming network devices called \u201cConsistent Device Naming\u201d. It\u2019s called Consistent Device Naming because previously the name of the devices [eth0,eth1,eth2] was completely dependant upon the order the kernel detected them as it booted. In certain circumstances, such as adding new [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6627"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6627"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6627\/revisions"}],"predecessor-version":[{"id":6628,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6627\/revisions\/6628"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}