#!/bin/bash
grep -oq "net.ifnames=0" /etc/default/grub
if [[ $? -eq "0" ]];then
grub2-mkconfig -o /boot/grub2/grub.cfg
echo it is ok
else
echo "测试失败,请检查该服务器"
fi
mac_address=`ip a|grep ether|tr -s " " |cut -d " " -f3`
sed -i "s#00:0c:29:ab:2b:51#${mac_address}#g" /etc/udev/rules.d/10-network.rules
read -p "Enter Your IP: " ip
sed -i "s#192.168.10.10#192.168.10.${ip}#g" /etc/sysconfig/network-scripts/ifcfg-eth0
#now_ip=`ip a|egrep -o "[0-9.]{7,15}"|awk 'NR==2'`
#echo "Your ip is ${now_ip} now!
echo "Rebbot after 5s"
for i in {5..1}; do
echo "$i"
sleep 1
done
echo "Reboot Now!"
reboot