修改linux 网卡名称
1. 备份ifcfg-tns33
[root@jboss1 ~]# cd /etc/sysconfig/network-scripts/ [root@jboss1 network-scripts]# mv ifcfg-ens33 ifcfg-ens33.bak [root@jboss1 network-scripts]# cp ifcfg-ens33 ifcfg-eth0
2. 修改 ifcfg-eth0
3. 编辑/etc/default/grub并加入" net.ifnames=0 biosdevname=0 "同样是保存并退出
[root@jboss1 network-scripts]# cat /etc/default/grub 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="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet net.ifnames=0 biosdevname=0" GRUB_DISABLE_RECOVERY="true"
4. 运行命令" grub2-mkconfig -o /boot/grub2/grub.cfg "来重新生成GRUB配置并更新内核参数
[root@jboss1 network-scripts]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.10.0-1160.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-1160.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-0a41273bceaf46949803cae553f03af1 Found initrd image: /boot/initramfs-0-rescue-0a41273bceaf46949803cae553f03af1.img done
5. 重启