如何将网卡名称改为eth0,可参考如下步骤即可完成修改。

编辑grub文件


# vim /etc/default/grub

在GRUB_CMDLINE_LINUX开头的行添加`net.ifnames=0 biosdevname=0`,修改完成如下所示


GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap net.ifnames=0 biosdevname=0 rhgb quiet"
GRUB_DISABLE_RECOVERY="true

重新生成grub配置文件


# grub2-mkconfig -o /boot/grub2/grub.cfg

进入网络配置文件路径,修改配置文件名


# cd /etc/sysconfig/network-scripts/
# mv ifcfg-ens33 ifcfg-eth0

编辑网卡配置文件


# vim ifcfg-eth0

将配置文件中的`ens33`改为`eth0`,如下图所示


TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="eth0"
UUID="3b9e7dbb-f551-4043-b332-74ca79ca393c"
DEVICE="eth0"
ONBOOT="yes"

查看网卡及驱动信息


# dmesg | grep -i eth0


# ethtool -i eth0
driver: e1000
version: 7.3.21-k8-NAPI
firmware-version: 
expansion-rom-version: 
bus-info: 0000:02:01.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

卸载网卡驱动


# modprobe -r e1000


# rmmod e1000

重新安装网卡驱动


# modprobe e1000

重启网络


systemctl restart network

此时查看网卡信息,ens33已经变为eht0


# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.15.137  netmask 255.255.255.0  broadcast 192.168.15.255
        inet6 fe80::fa45:a6c0:8355:5378  prefixlen 64  scopeid 0x20
        ether 00:0c:29:42:0f:46  txqueuelen 1000  (Ethernet)
        RX packets 88  bytes 6394 (6.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 69  bytes 9925 (9.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0