centos 7修改网卡名为 eth0

一键脚本

mv /etc/sysconfig/network-scripts/ifcfg-en* /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/NAME=\(.*\)/NAME=eth0/' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/DEVICE=\(.*\)/DEVICE=eth0/' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/rhgb/net.ifnames=0 biosdevname=0 rhgb/' /etc/sysconfig/grub
grub2-mkconfig -o /boot/grub2/grub.cfg
systemctl disable NetworkManager
systemctl stop NetworkManager
reboot

你可能感兴趣的:(centos 7修改网卡名为 eth0)