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

时间:2022-09-25 11:07:00

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

Change default network name (ens33) to old “eth0” on Ubuntu 18.04 / Ubuntu 16.04By 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&comma; 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 &sol; Validation

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

  4. &lbrack;转&rsqb;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&period;04没有&sol;etc&sol;default&sol;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. 【 HDU 1255】 覆盖的面积(矩阵面积交,线段树,扫描法)

    [题目] 覆盖的面积 Problem Description 给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积. Input 输入数据的第一行是一个正整数T(1<=T<=100 ...

  2. HDU 2722 Here We Go&lpar;relians&rpar; Again (spfa)

    Here We Go(relians) Again Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/ ...

  3. 浅析vue2&period;0的diff算法

    一.前言 如果不了解virtual dom,要理解diff的过程是比较困难的. 虚拟dom对应的是真实dom, 使用document.CreateElement 和 document.CreateTe ...

  4. JAVA进阶18

    间歇性混吃等死,持续性踌躇满志系列-------------第18天 1.飞机游戏小项目 ①创建窗口 package cn.xfj.game; import javax.swing.*; import ...

  5. 源码包安装maven

    含有的命令:cd,tar,mv,vim,sourc,mvnpv [root@ycj ~]# cd /usr/local/src/ //切换路径 [root@ycj src]# wget http:// ...

  6. 新发现:排序算法时间复杂度只有O&lpar;3n&rpar;,命名为&quot&semi;wgw&quot&semi;排序法

    思路:首先在待排序数组i[]中找出最大的值,以(最大值+1)的大小创建一个空数组kk[],然后遍历待排序数组i[]中的值n,其值n对应数组kk[]中的第n个元素加1.最后再把数组kk[]排好序的值赋回 ...

  7. 在windows server 2012&sol;2016上,任务管理器性能页面增加磁盘监控的办法

    从windows server 2012开始,微软修改了任务管理器的显示方式,图像化看起来更直观了,但是可惜的是,默认情况下,2012和2016均只显示CPU/内存/网络三个资源监视,没有重要的磁盘, ...

  8. info AI drive

    Who we look for Here at comma, we don't care about the source of your education or your traditional ...

  9. Linux终端多用户通信实用命令

    一  命令 1.1 write 该命令将当前终端(源)输入的字符拷贝至目标用户的终端,从而发送消息给系统中某个用户.用法如下: #write <user> <msg> [Ctr ...

  10. 2013ACM-ICPC杭州赛区全国邀请赛——Random Walk

    pid=4579" style="background-color:rgb(51,255,51)">题目链接 题意: n个点.依照题中给的公式能够求出随意两个点转移 ...