首页 > 其他 > 详细

RHEL/CentOS7 修改网卡为eth0

时间:2017-10-09 12:54:49      阅读:216      评论:0      收藏:0      [点我收藏+]


首先将网卡配置文件重命名为eth0

[root@www ~]# cd /etc/sysconfig/network-scripts
[root@www ~]# mv /ifcfg-eno 16777736 ifcfg-eth0

然后编辑修改后的网卡配置文件

vim /ifcfg-eth0

将NAME参数修改为与网卡文件相同的名字

技术分享


接下来禁用网卡命名规则。此功能通过/etc/default/grub文件来控制,要禁用此次功能,在文件中加入"net.ifnames=0  biosdevname=0"即可。

技术分享



添加udev网卡规则(可不做)

在/etc/udev/rules.d目录中创建一个网卡规则70-persistent-net.rules文件。在文件中写入以下参数:SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="需要修改名称的网卡MAC地址",ATTR{type}=="1" ,KERNEL=="eth*",NAME="eth0"


技术分享


执行grub2-mkconfig  -o  /boot/grub2/grub.cfg命令生成更新grub配置参数。

[root@www ~]# grub2-mkconfig  -o  /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-c17f90bf14ca4afc94a2eebcb70f624d
Found initrd image: /boot/initramfs-0-rescue-c17f90bf14ca4afc94a2eebcb70f624d.img
done


重启系统验证


技术分享








出现虚拟网卡是因为安装时启用了 libvirtd 服务后生成的

关闭方法

virsh net-list

名称               状态     自动开始  持久
---------------------------------------------------------

default              active    yes

virsh net-destroy default

virsh net-undefine default

systemctl restart libvirtd.service


本文出自 “PooV的博客” 博客,请务必保留此出处http://xyhms.blog.51cto.com/12505169/1970831

RHEL/CentOS7 修改网卡为eth0

原文:http://xyhms.blog.51cto.com/12505169/1970831

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!