#!/bin/bash
DEFAULTNAME=`ls /etc/sysconfig/network-scripts/ifcfg-en*`
EXPECTNAME=ifcfg-eth0
sed -i 's/DEVICE.*/DEVICE=eth0/g' $DEFAULTNAME
sed -i 's/ONBOOT.*/ONBOOT=yes/g' $DEFAULTNAME
mv $INITIALNAME /etc/sysconfig/network-scripts/$EXPECTNAME
sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0 /g' /etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg
echo "please reboot system"
转载于:https://blog.51cto.com/mustafayin/1944867