为了给服务器加速,打算安装开心版锐速。安装过程中提示网卡名称不是eth0,无法安装。网上找了很多教程都无法修改,最后发现了这个Linux shell脚本,运行即可成功修改。现将脚本分享如下
1 2 3 4 5 6 7 8 9 10 11 12 |
#/bin/bash mkdir ~/changename cp /etc/sysconfig/network-scripts/ifcfg-eno16777736 ~/changename cp /etc/default/grub ~/changename touch /etc/udev/rules.d/70-persistent-net.rules gethd=$(ip addr | grep ether | sed 's/^.*ether //g' | cut -d ' ' -f 1) mv /etc/sysconfig/network-scripts/ifcfg-eno16777736 /etc/sysconfig/network-scripts/ifcfg-eth0 sed -i 's/NAME.*$/NAME=eth0/' /etc/sysconfig/network-scripts/ifcfg-eth0 sed -i 's/swap/swap net.ifnames=0 biosdevname=0/g' /etc/default/grub grub2-mkconfig -o /boot/grub2/grub.cfg echo "SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATRR{address}=="$gethd",ATTR{type}=="1",KERNEL=="eth",NAME=="eth0"" >> /etc/udev/rules.d/70-persistent-net.rules reboot |
不错的文章,内容风生水起