Centos7环境将网卡地址修改为eth0
#!/bin/bash #1. 修改grub配置文件 sed -i.bak 's/quiet/quiet net.ifnames=0 biosdevname=0/g' /etc/default/grub #/etc/sysconfig/grub与/etc/default/grub路径内容一样 #sed -i.bak 's/quiet/quiet net.ifnames=0 biosdevname=0/g' /etc/sysconfig/grub #2. 重新生成grub配置文件 grub2-mkconfig -o /boot/grub2/grub.cfg #3. 修改网卡配置 mv /etc/sysconfig/network-scripts/ifcfg-e* /etc/sysconfig/network-scripts/ifcfg-eth0 cat >/etc/sysconfig/network-scripts/ifcfg-eth0 << EOF DEVICE=eth0 ONBOOT=yes BOOTPROTO=dhcp TYPE=Ethernet IPADDR= NETMASK= GATEWAY= DNS1= DNS2= EOF #4. 重启系统 init 6