码迷,mamicode.com
首页 > Web开发 > 详细

CENTOS 7 udev:renamed network interface eth0 to eth1 eno16777736

时间:2015-08-02 23:37:53      阅读:779      评论:0      收藏:0      [点我收藏+]

标签:character   network   interface   address   names   

将这个/etc/udev/rules.d/70-persistent-net.rules删除,重启,网卡eth0成功启动,并重新生成/etc/udev/rules.d/70-persistent-net.rules文件。



[root@localhost rules.d]# cat 70-persistent-ipoib.rules

# This is a sample udev rules file that demonstrates how to get udev to

# set the name of IPoIB interfaces to whatever you wish.  There is a

# 16 character limit on network device names though, so don‘t go too nuts

#

# Important items to note: ATTR{type}=="32" is IPoIB interfaces, and the

# ATTR{address} match must start with ?* and only reference the last 8

# bytes of the address or else the address might not match on any given

# start of the IPoIB stack

#

# Note: as of rhel7, udev is case sensitive on the address field match

# and all addresses need to be in lower case.

#

# ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{type}=="32", ATTR{address}=="?*00:02:c9:03:00:31:78:f2", NAME="mlx4_ib3"











上次装archlinux时把整个win都给删掉了,现在觉得还是略有些不方便,所以格盘重新安装了win7,然后准备再次安装arch
不过下载了最新镜像后,安装一路没问题,重启后顺利进入系统,不过wifi-menu提示找不到wlan0
ip link set wlan0 up也提示interface wlan0 not found
dmesg|grep -i wlan0后发现一句systemd-udevd:renamed network interface wlan0 to wl8s0
按wl8s0操作,没有问题,可以up。。。
不过,为啥会被改成这个奇葩名字呢?dmesg发现eth0也被改了一个名字
还有/etc/udev/下的文件夹都是空的,rule.d里边也是空的,正常吗?
网上的类似的办法都是修改rule.d的配置,而且接口名字也只是wlan0被改成了wlan1,但没有出现wl8s0这种奇葩(准确的名字记不得了,不过大致是这几个字母)



邮件列表原文:
Since 197 was just tagged and there still seems to be some confusion, here‘s an FAQ: *** What happens after installing systemd 197?
For existing installs: Nothing happens, and this is strictly opt-in. A post_upgrade() message will mention the feature and add a dummy file called /etc/udev/rules.d/80-net-name-slot.rules to mask the new rule which performs the renaming.
If you wish to opt-in, remove this dummy file. Next reboot, the rule will take effect. For new installs: You are opted-in to this change. The post_install() will do nothing to mask the rule.
If you wish to opt out, you can do 1 of 2 things: 
1) mask the rule: ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
2) provide your own udev rule that applies a NAME to the interface. As long as this rule is ordered lexically before 80-net-name-slot.rules, then the upstream rule will have no effect. For example, providing a file called 70-net-naming.rules will trump 80-net-name-slot.rules.



首先,先编辑网卡的配置文件 vi /etc/sysconfig/network-scripts/ifcfg-eno16777736 将里面的NAME项修改为eth0

然后,禁用该可预测命名规则。对于这一点,你可以在启动时传递“net.ifnames=0 biosdevname=0 ”的内核参数。这是通过编辑/etc/default/grub并加入“net.ifnames=0 biosdevname=0 ”到GRUBCMDLINELINUX变量来实现的。

运行命令grub2-mkconfig -o /boot/grub2/grub.cfg 来重新生成GRUB配置并更新内核参数。

其实到第5步的时候,重启在ifconfig查看应该就已经生效了,根据Centos 官方WIKI的FAQ中得知,如果你有多个接口,并且想要控制其设备名,而不是让内核以它自己的方式命名,创建,/etc/udev/rules.d/XXX-net.rules规则是必要的!那么这里我们也创建好规则吧。


注意:以前系统的net规则名称是70-persistent-net.rules,这里我也按照这个名字定义规则!



Linux系统版本:CentOS_7(64位)

一、前言:

今天又从Centos 6.5装回了Centos 7,毕竟还是要顺应潮流嘛。安装完成之后,发现发现CentOS 7默认的网卡名称是eno16777736,如图所示:

技术分享

像我这种有轻微强迫症的人看到这个名字总感觉不爽,于是偏要把eno16777736改成以前版本的eth0,那就开始吧。

二、修改CentOS 7的网卡名称:

输入如下命令,进入对应目录,编辑文件:

view sourceprint?

1.vim /etc/sysconfig/grub

然后,往这个文件中添加“net.ifnames=0 biosdevname=0”内容,如下图所示:技术分享

上图中,红框部分是我所添加的内容(注意它的位置)。

紧接着,执行如下命令:

view sourceprint?

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

效果如下:

技术分享

然后,重启系统后查看网卡名称:

技术分享








本文出自 “vincent” 博客,谢绝转载!

CENTOS 7 udev:renamed network interface eth0 to eth1 eno16777736

标签:character   network   interface   address   names   

原文地址:http://qiu521119.blog.51cto.com/1575387/1681018

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!