首页 > 代码库 > centos7改网卡名

centos7改网卡名

1、INITIALNAME=`ls /etc/sysconfig/network-scripts/ifcfg-en*`

2、EXPECTNAME=ifcfg-eth0

3、sed -i ‘s/DEVICE.*/DEVICE=eth0‘ $INITIALNAME

4、mv $INITIALNAME /etc/sysconfig/network-scripts/$EXPECTNAME

5、sed -i ‘s/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0  /g‘ /etc/default/grub

6、grub2-mkconfig -o /boot/grub2/grub.cfg

7、echo "please reboot system"


centos7改网卡名