Quantcast
Channel: CodeSection,代码区,Linux操作系统:Ubuntu_Centos_Debian - CodeSec
Viewing all articles
Browse latest Browse all 11063

把CentOS 7.x网卡名称eno16777736改为eth0

$
0
0

把CentOS 7.x网卡名称eno16777736改为eth0

CentOS 7.x系统中网卡命名规则被重新定义,可能会是”eno167777xx”等,下面我们把网卡名称改为eth0这种。

一、cd /etc/sysconfig/network-scripts/ #进入网卡配置目录

mv eno16777736 ifcfg-eth0 #修改名称

vi eth0 #编辑

NAME=eth0 #修改

DEVICE=eth0 #修改

:wq! #保持退出

二、vi /etc/sysconfig/grub #编辑

在”GRUB_CMDLINE_linux“变量中添加一句” net.ifnames=0 biosdevname=0 “

:wq! #保存退出


把CentOS 7.x网卡名称eno16777736改为eth0

三、运行命令:grub2-mkconfig -o /boot/grub2/grub.cfg #重新生成grub配置并更新内核参数

四、添加udev的规则

在”/etc/udev/rules.d“目录中创建一个网卡规则”70-persistent-net.rules“,并写入下面的语句:

SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="00:0c:29:dc:dd:ad",ATTR{type}=="1" ,KERNEL=="eth*",NAME="eth0"

#ATTR{address}=="00:0c:29:dc:dd:ad"是网卡的MAC地址

cd /etc/udev/rules.d

vi 70-persistent-net.rules #添加

SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="00:0c:29:dc:dd:ad",ATTR{type}=="1" ,KERNEL=="eth*",NAME="eth0"

:wq! #保存退出


把CentOS 7.x网卡名称eno16777736改为eth0

shutdown -r now #重启系统


把CentOS 7.x网卡名称eno16777736改为eth0

网卡已经更改为eth0

至此,CentOS 7.x网卡名称eno16777736已经改为eth0。


把CentOS 7.x网卡名称eno16777736改为eth0

Viewing all articles
Browse latest Browse all 11063