ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Debian change network interface name from ens0s3 to eth0

2021-04-10 22:33:43  阅读:434  来源: 互联网

标签:sudo name grub Interface ens0s3 system network interface eth0


Debian 10 / Debian 9 uses a consistent and predictable device name for network interfaces. This predictable device naming helps us to locate network interfaces where it is connected like whether it is attached to onboard or external.

If you ever interested in changing interface name to eth0, then this is the tutorial for you.

Current Network Interface Name

Use the ip a command to see the network interfaces.

ip a

Interface Name Before Disabling Consistent Device NamingInterface Name Before Disabling Consistent Device Naming

As you can see in the below output of ip a command, my Debian system is having a network adapter called enp0s3.

This is just the case of VirtualBox and it may vary depends on your system hardware (In the case of VMware, it will be ens33) but the procedure to get the ethX back will be the same.

You can confirm that the Ethernet device got renamed during the system boot by using the dmesg command.

sudo dmesg | grep -i eth

Kernel renamed eth0Kernel renamed eth0

Disable Consistent Interface Device Naming

To regain the ethX back, edit the grub file.

sudo nano /etc/default/grub

Look for GRUB_CMDLINE_LINUX line and add net.ifnames=0 biosdevname=0.

FROM:

GRUB_CMDLINE_LINUX=""

TO:

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

Edit GRUB ParameterEdit GRUB Parameter

Generate a new grub configuration file using the grub-mkconfig command.

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

Generate GRUB ConfigurationGenerate GRUB Configuration

Update Network Interface Configurations

Network Manager

If your system uses NetworkManager for network configuration, then you do not have to modify any settings. You can go ahead and reboot the system.

sudo reboot

Interfaces File

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

DHCP

If your machine is on a DHCP network, then,

sudo nano /etc/network/interfaces

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

FROM:

 

ADVERTISEMENT

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 may need to configure a static IP address for the network interface.

sudo nano /etc/network/interfaces

FROM:

auto ens33
iface ens33 inet static
           address 192.168.0.10
           netmask 255.255.255.0
           dns-nameservers 192.168.0.1
           gateway 192.168.0.1

TO:

auto eth0
iface eth0 inet static
           address 192.168.0.10
           netmask 255.255.255.0
           dns-nameservers 192.168.0.1
           gateway 192.168.0.1

Reboot your system.

sudo reboot

Verify Network Interface Name

After the system reboot, go and check whether you have got the eth0 back.

ip a

Interface Name After Disabling Consistent Interface Device NamingInterface Name After Disabling Consistent Interface Device Naming

Conclusion

That’s All. Please drop your feedbacks in the comments section.

标签:sudo,name,grub,Interface,ens0s3,system,network,interface,eth0
来源: https://www.cnblogs.com/raohu/p/14642347.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有