CentOS 7.2修改网卡名称
Posted Keep Moving
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 7.2修改网卡名称相关的知识,希望对你有一定的参考价值。
#!/bin/bash #Centos7.2修改网卡名称ens33为eth0 #2017/05/19 if [ -f /etc/sysconfig/grub ];then cp /etc/sysconfig/grub ./grub.conf sed -i ‘/GRUB_CMDLINE_LINUX/s/"$/ net.ifnames=0 biosdevname=0&/‘ ./grub.conf cat grub.conf > /etc/sysconfig/grub rm -f grub.conf fi if [ $? == 0 ];then grub2-mkconfig -o /boot/grub2/grub.cfg else exit 1 fi sleep 1 mv /etc/sysconfig/network-scripts/ifcfg-ens33 /etc/sysconfig/network-scripts/ifcfg-eth0 if [ -f /etc/sysconfig/network-scripts/ifcfg-eth0 ];then sed -i ‘/^NAME/s/.*/NAME=eth0/;/^DEVICE/s/.*/DEVICE=eth0/‘ /etc/sysconfig/network-scripts/ifcfg-eth0 else exit 1 fi [ $? == 0 ] && reboot || exit 1
以上是关于CentOS 7.2修改网卡名称的主要内容,如果未能解决你的问题,请参考以下文章