#修改配置文件
修改/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 rhgb quiet net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY="true"
-----------------------------------------------------------------------------------------------------
#重新加载启动文件
[10:02:43 root@c7-1-54 ~]#grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-1160.2.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.2.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1062.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1062.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-e1907a610d33424bb69986a49dd78bda
Found initrd image: /boot/initramfs-0-rescue-e1907a610d33424bb69986a49dd78bda.img
done
#重启
[10:03:22 root@c7-1-54 ~]#shutdown -r 0
Shutdown scheduled for Mon 2021-04-05 10:03:33 EDT, use 'shutdown -c' to cancel.
[10:03:33 root@c7-1-54 ~]#Connection closing...Socket close.
Connection closed by foreign host.
Disconnected from remote host(C7-1) at 22:03:33.
Type `help' to learn how to use Xshell prompt.
[C:\~]$
#修改原网卡信息
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
NAME=ens33 #//修改为eth0
UUID="943372be-a3bf-441d-9aa5-0d56aae0e480"
DEVICE=ens33 #//修改为eth0
ONBOOT="yes"
IPADDR="10.0.0.125"
PREFIX="24"
GATEWAY="10.0.0.2"
DNS1="223.5.5.5"
#重启网络即可
systemctl restart network
虚拟机修改网卡为eth0
admin·发布于 2024-03-06·74 次阅读