修改网卡名称

修改网卡名称

1.编辑网卡信息

cd  /etc/sysconfig/network-scripts/     #进入网卡目录
mv  ifcfg-ens33  ifcfg-eth0       #修改网卡名称
vi   ifcfg-eth0                      #修改NAME与DEVICE为eth0

2.修改grup文件

cat /etc/sysconfig/grub #编辑内核信息

GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb net.ifnames=0 biosdevname=0 quiet"       #修改项
GRUB_DISABLE_RECOVERY="true"

grub2-mkconfig -o /boot/grub2/grub.cfg #生成启动菜单

[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-957.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-767d9ae2040e4e78a6558b526cd34946
Found initrd image: /boot/initramfs-0-rescue-767d9ae2040e4e78a6558b526cd34946.img
done

3.验证是否成功

reboot #重启系统生效
ip a #检查网卡信息

2: eth0:  mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

安装前修改

安装系统时 选择 install按tab键 并在命令行末尾写入net.ifnames=0 biosdevname=0按回车安装系统,进入系统后验视。

image.png

你可能感兴趣的:(修改网卡名称)