Change default network name (ens33) to old “eth0” on Ubuntu 18.04 / Ubuntu 16.04

By Raj Last updated May 18, 2018
11
 

Just after the Ubuntu installation, I came to know that the network interface name got changed to ens33 from old school eth0.

READ: Install Ubuntu 18.04 LTS (Bionic Beaver) on UEFI and Legacy BIOS System

READ: Install Ubuntu 16.04 LTS (Xenial Xerus) – Step by Step Guide with Screenshots

If you ever interested in changing interface names to old type ethX, here is the tutorial for you.

As you can see in the following command, my system is having a network adapter called ens33.

This is just the case of VMware environment, it may vary depends on the hardware but the steps to get back ethX will be the same.

$ ip a

1: lo: <loopback,up,lower_up> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: </loopback,up,lower_up>ens33: <broadcast,multicast,up,lower_up> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:05:a3:e2 brd ff:ff:ff:ff:ff:ff
    </broadcast,multicast,up,lower_up>inet 192.168.12.12/24 brd 192.168.12.255 scope global dynamic ens33
       valid_lft 1683sec preferred_lft 1683sec
    inet6 fe80::20c:29ff:fe05:a3e2/64 scope link
       valid_lft forever preferred_lft forever

From the dmesg command, you can see that the device got renamed during the system boot.

$ dmesg | grep -i eth

[    3.050064] e1000 0000:02:01.0 eth0: (PCI:66MHz:32-bit) 00:0c:29:05:a3:e2
[    3.050074] e1000 0000:02:01.0 eth0: Intel(R) PRO/1000 Network Connection
[    3.057410] e1000 0000:02:01.0 ens33: renamed from eth0

To get an ethX back, edit the grub file.

$ sudo nano /etc/default/grub

Look for “GRUB_CMDLINE_LINUX”  and add the following”net.ifnames=0 biosdevname=0“.

From:

GRUB_CMDLINE_LINUX=""

To:

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

Generate a new grub file using the following command.

$ sudo grub-mkconfig -o /boot/grub/grub.cfg

Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.4.0-15-generic
Found initrd image: /boot/initrd.img-4.4.0-15-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done

Edit the interface file and change the network device name so that you will have a DHCP or static IP address for ethX.

READ: Install and configure DHCP server on CentOS 7 / Ubuntu 16.04 / Debian 9

Assign IP Address

For Ubuntu 18.04

You can assign an IP address to the system using netplan – a new network configuration tool.

READ: How To Configure Static IP Address in Ubuntu 18.04 using Netplan

For Ubuntu 16.04 / Older

DHCP:

If your infrastructure has a DHCP server and you want to leverage that, then:

$ sudo nano /etc/network/interfaces

Update below lines in /etc/network/interfaces files so that the network card can get an IP address from DHCP server.

FROM:

auto ens33
iface ens33 inet dhcp

TO:

auto eth0
iface eth0 inet dhcp

Static:

If your infrastructure does not have a DHCP server, then you will need to configure a static IP address for all network interfaces on your Ubuntu machine.

$ sudo nano /etc/network/interfaces

From:

auto ens33
iface ens33 inet static
           address 192.168.12.12
           netmask 255.255.255.0
           dns-nameservers 192.168.12.2
           gateway 192.168.12.2

To:

auto eth0
iface eth0 inet static
           address 192.168.12.12
           netmask 255.255.255.0
           dns-nameservers 192.168.12.2
           gateway 192.168.12.2

Reboot your system.

$ sudo reboot

After the system reboot, just check whether you have an ethX back.

$ ip a
1: lo: <loopback,up,lower_up> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: </loopback,up,lower_up>eth0: <broadcast,multicast,up,lower_up> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:05:a3:e2 brd ff:ff:ff:ff:ff:ff
    </broadcast,multicast,up,lower_up>inet 192.168.12.12/24 brd 192.168.12.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe05:a3e2/64 scope link
       valid_lft forever preferred_lft forever

That’s All.

Change default network name (ens33) to old “eth0” on Ubuntu 18.04 / Ubuntu 16.04的更多相关文章

  1. JDK Environment Variable And Change default JDK

    Environment Variable : change(import) /etc/bashrc export JAVA_HOME=/software/jdk1.8.0 export PATH=$J ...

  2. linux 启动network后报错:device eth0 does not seem to be present, delaying initialization

    问题背景: 在vsphere client中部署ovf模板后启动linux 的network后提示:device eth0 does not seem to be present, delaying ...

  3. How to Change Default Web ADI Upload Parameters for FlexField Import / Validation

    How to Change Default Web ADI Upload Parameters for FlexField Import / Validation (文档 ID 553345.1) 转 ...

  4. [转]how can I change default errormessage for invalid price

    本文转自:http://forums.asp.net/t/1598262.aspx?how+can+I+change+default+errormessage+for+invalid+price I ...

  5. windows 10 change default program bug

    windows 10 change default program bug https://www.isumsoft.com/windows-10/how-to-change-or-set-defau ...

  6. Ubuntu 16.04没有/etc/default/rcS文件的UTC设置选项的问题解决

    继续上一篇文章介绍了CentOS的时钟设置:http://www.cnblogs.com/EasonJim/p/8111747.html,大致的知道了BIOS在Linux的时区设置. 而现在关心的问题 ...

  7. Debian 系统修改网卡ens33名称为 eth0

    1. 编辑文件 /etc/default/grub 修改下面的值 初始值 GRUB_CMDLINE_LINUX="" 修改后 GRUB_CMDLINE_LINUX="ne ...

  8. linux 修改centos7的网卡ens33修改为eth0

    Linux 操作系统的网卡设备的传统命名方式是 eth0.eth1.eth2等,而 CentOS7 提供了不同的命名规则,默认是基于固件.拓扑.位置信息来分配.这样做的优点是命名全自动的.可预知的,缺 ...

  9. 【Linux】将ens33修改为eth0 网卡方法

    1.编辑 grub 配置文件 vim /etc/sysconfig/grub # 其实是/etc/default/grub的软连接 # 为GRUB_CMDLINE_LINUX变量增加2个参数,添加的内 ...

随机推荐

  1. 无线模块 RXB12-315m TXB12-315M 应用

    近期有个产品用到这对模块,因为没有什么技术支持,就直接上机调试.測试结果为带障碍发射距离60米. 下面是应用的几个知识点: 1:编程操作.事实上比較简单,调制信号315M是模块自带的,不须要调制和解调 ...

  2. .NET本质论 类型基础

    类型概述 类型是CLR程序的生成块(building block). CLR类型(CLR type)是命名的可重用抽象体. CLR类型定义由零个或多个成员(member)组成.类型的成员控制类型如何使 ...

  3. 关于C# winform怎么调用webapi来获取到json数据

    C/S系统也可以和B/S系统一样实现“前后端分离”,那这样写winform就相当于纯粹的前端页面了,然后再单独部署一个webapi项目,通过api调用数据库进行数据的操作,有利于维护和数据安全性的提高 ...

  4. create a simple COM object

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAArsAAAGYCAIAAADN0b3QAAAgAElEQVR4nO29749c1b2nW/4Lzh8wUr

  5. mongo之 前后台创建索引 --noIndexBuildRetry

    在数据量超大的情形下,任何数据库系统在创建索引时都是一个耗时的大工程.MongoDB也不例外.因此,MongoDB索引的创建有两个选择,一个是前台方式,一个是后台方式.那这两种方式有什么差异呢,在创建 ...

  6. Spring 4 中重定向RedirectAttributes的使用

    RedirectAttributes 的使用 @RequestMapping(value = "/redirecttest", produces = "applicati ...

  7. 菜鸟如何学习vue

    作为一个前端菜鸟,最近开始接触和学习vue. 以前用到的是bootstrap前端框架. Bootstrap,来自 Twitter,是目前最受欢迎的前端框架. Bootstrap 是基于 HTML.CS ...

  8. Hadoop 目录分析及存储机制

    NameNode元数据目录分析 在第一次部署好Hadoop集群的时候,我们需要在NameNode(NN)节点上格式化磁盘: $HADOOP_HOME/bin/hdfs namenode -format ...

  9. Spring Cloud Eureka 服务发现与消费

    服务发现与消费,其服务发现的任务是由Eureka的客户端完成,而服务的消费任务由Ribbon.JerseyClient等完成,Ribbon是一个基于HTTP和TCP的客户端负载均衡器:使用Jersey ...

  10. nginx基于目录的映射:

    nginx基于目录的映射: location /wxchat/ { #proxy_redirect off; proxy_set_header Host $host; proxy_set_header ...