Skip to main content

Configuring Wired Network Interface to Rename as eth0

Navigation bar

After installing Debian 12.9.0, the network interface name might be something like enP3p49s0 on the first boot. This naming convention can be cumbersome to work with. You can change the interface name to eth0 by following the steps below.

Note: GRUB configuration is for X86 devices only.


Check the Current Network Interface Name​

Use the following command to check the current network interface name:

root@Debian:~$ ip addr 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

2: enP3p49s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

Modify the GRUB Configuration​

  1. Edit the GRUB configuration file:

    vim /etc/default/grub
  2. Add net.ifnames=0 biosdevname=0 to the GRUB_CMDLINE_LINUX line:

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

Modify the Network Interface Configuration File​

Edit the network interfaces file vim /etc/network/interfaces to configure a dynamic or static IP.

Dynamic IP Configuration​

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
iface eth0 inet6 auto

Static IP Configuration (You can add eth1, eth2, etc., for multiple interfaces)​

allow-hotplug eth1
iface eth1 inet static
address 192.168.1.2
gateway 192.168.1.1
netmask 255.255.255.0
dns-nameservers 192.168.1.1

Apply the Configuration and Reboot​

Execute the following commands to apply the configuration:

grub-mkconfig -o /boot/grub/grub.cfg
update-grub
reboot

Verify the Configuration​

After rebooting, use the following command to verify that the network interface name has been changed to eth0:

root@Debian:~$ ip addr 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000

Now you can use it conveniently!

AI Translation Notice

This page was translated into English by AI and is provided for reference only. The original document is written in Chinese. If there is any discrepancy, the Chinese version prevails.

本页英文内容由 AI 自动翻译生成,仅供参考;原文为中文,如有差异请以中文原文为准。

查看中文原文 / View the Chinese original →