centos7 change default interface name to eth0

#!/bin/bash

DEFAULTNAME=`ls /etc/sysconfig/network-scripts/ifcfg-en*`

EXPECTNAME=ifcfg-eth0

sed -i ‘s/DEVICE.*/DEVICE=eth0/g‘ $DEFAULTNAME

sed -i ‘s/ONBOOT.*/ONBOOT=yes/g‘ $DEFAULTNAME

mv $INITIALNAME /etc/sysconfig/network-scripts/$EXPECTNAME

sed -i ‘s/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0 /g‘ /etc/default/grub

grub2-mkconfig -o /boot/grub2/grub.cfg

echo "please reboot system"

时间: 2024-10-26 11:42:10

centos7 change default interface name to eth0的相关文章

Centos7.4 修改网卡名称为eth0

Centos7.4 修改网卡名称为eth0 ################################################# #修改网卡配置[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33原NAME=ens33DEVICE=ens33NAME=eth0DEVICE=eth0 #重命名网卡名称[[email protected] ~]# mv /etc/sysconfig/network-s

JDK Environment Variable And Change default JDK

Environment Variable : change(import) /etc/bashrc export JAVA_HOME=/software/jdk1.8.0 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar save and exit. Change default JDK: update-alternatives --install 

How to Change Default Location for Outlook Data File (PST & OST)

Is there a way to change the default location of new .pst file when create a new e-mail account in Outlook? Different versions of Outlook use different default locations to store pst files. In this tutorial we'll show you how to change default locati

[转]how can I change default errormessage for invalid price

本文转自:http://forums.asp.net/t/1598262.aspx?how+can+I+change+default+errormessage+for+invalid+price I have: [Required(ErrorMessage = "Price is required.")] public decimal price { get; set; } How can I change default message for invalid price - I w

Error: Default interface methods are only supported starting with Android N (--min-api 24): java.io.InputStream org.apache.poi.sl.usermodel.ObjectShape.readObjectData()

项目运行的时候,如果报错 Error: Default interface methods are only supported starting with Android N (--min-api 24): java.io.InputStream org.apache.poi.sl.usermodel.ObjectShape.readObjectData() 解决方案: 在app的build.gradle文件中添加以下代码 apply plugin: 'com.android.applicat

8、D8: Default interface methods are only supported starting with Android N (--min-api 24): void

1.错误信息 升级完 Android N 后,有些项目运行起来报错信息大致如下: Default interface methods are only supported starting with Android N (--min-api 24): void android.arch.lifecycle.DefaultLifecycleObserver.onCreate(android.arch.lifecycle.LifecycleOwner) Message{kind=ERROR, tex

CentOS7修改默认网卡名称为eth0

CentOS7默认的网卡名称是和设备名称是随机的,如果要修改网卡名称以eth开头,有两种方式 第一种方式 这种方式适合在安装操作系统的时候进行设置, 点击 Tab,打开kernel启动选项, 增加内核参数:net.ifnames=0 biosdevname=0 输入完成之后回车正常安装操作系统就好了. 第二种方式 修改网卡配置文件中的DEVICE=参数的关于eth0 [[email protected] ~]# cd /etc/sysconfig/network-scripts/[[email 

Centos7 安装之后没有IP,eth0网卡的问题的解决

vmware安装的centos7中没有出现eth0网卡,也没有ip,不能上网,输入ifconfig后如下图 解决办法 1.编辑网卡的配置文件 vi /etc/sysconfig/network-scripts/ifcfg-ens33 将里面的NAME和DEVICE项修改为eth02.重命名网卡配置文件ifcfg-ens33为ifcfg-eth03.编辑/etc/default/grub并加入"net.ifnames=0 biosdevname=0 "到GRUBCMDLINELINUX变

CentOS7系统下修改网卡为eth0

编辑网卡信息 [[email protected]~]# cd /etc/sysconfig/network-scripts/  #进入网卡目录 [[email protected]]# mv ifcfg-eno16777728 ifcfg-eth0  #重命名网卡名称 [[email protected]]# cat ifcfg-eth0  #编辑网卡信息 TYPE=Ethernet BOOTPROTO=static DEFROUTE=yes PEERDNS=yes PEERROUTES=ye