设为首页 收藏本站
查看: 2335|回复: 0

[经验分享] CENTOS 7 udev:renamed network interface eth0 to eth1 eno16777736

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-8-3 08:51:46 | 显示全部楼层 |阅读模式
将这个/etc/udev/rules.d/70-persistent-net.rules删除,重启,网卡eth0成功启动,并重新生成/etc/udev/rules.d/70-persistent-net.rules文件。


[iyunv@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,如图所示:

1643479022221381.jpg

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

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

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


1.vim /etc/sysconfig/grub

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

1643479022221382.jpg

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

紧接着,执行如下命令:


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

效果如下:

1643479022221383.jpg

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

1643479022221384.jpg



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-93489-1-1.html 上篇帖子: Linux系统FTP文件传输服务 下篇帖子: CENTOS 7 dmesg interface network
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表