如何解决centos7将网卡加入到网桥后Missing config file br-ex网卡无法正常启动问题
小编给大家分享一下如何解决centos7将网卡加入到网桥后Missing config file br-ex网卡无法正常启动问题,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
原来的/etc/sysconfig/network-scripts/ifcfg-ens2
[html] view plain copy
HWADDR=68:05:CA:11:XX:XX
TYPE=Ethernet
BOOTPROTO=none
NAME=ens2
UUID=bc723ed2-3196-491b-8e25-bf4a56a63c81
ONBOOT=yes
/var/log/message
[html] view plain copy
Nov 25 13:42:50 localhost network: Bringing up interface ens2: Error: either "dev" is duplicate, or "br-ex" is a garbage.
Nov 25 13:42:50 localhost network: cat: /sys/class/net/ens2: Is a directory
Nov 25 13:42:50 localhost network: cat: br-ex/ifindex: No such file or directory
Nov 25 13:42:50 localhost network: /etc/sysconfig/network-scripts/ifup-eth: line 273: 1000 + : syntax error: operand expected (error
token is "+ ")
Nov 25 13:42:50 localhost network: ERROR : [/etc/sysconfig/network-scripts/ifup-aliases] Missing config file br-ex.
Nov 25 13:42:50 localhost /etc/sysconfig/network-scripts/ifup-aliases: Missing config file br-ex.
网卡启动的脚本分别是
/etc/init.d/netwrok -> /usr/sbin/ifup -> /etc/sysconfig/network-scripts/network-functions
-> /etc/sysconfig/network-scripts/ifup-eth
通过跟踪各个变量发现问题是系统将DEVICE变量设置为了"ens2 br-ex2"
所以才会出现上述奇怪的log,而正确的DEVICE应该就为"ens2"
主要原因是在ifcfg-ens2 文件中没有DEVICE参数,network-functions 会根据mac地址找设备,但br-ex的Mac地址和ens2相同,所以得到的DEVICE就是错误。
解决办法就是增加DEVICE参数,修改后的/etc/sysconfig/network-scripts/ifcfg-ens2 如下
[html] view plain copy
DEVICE=ens2
看完了这篇文章,相信你对"如何解决centos7将网卡加入到网桥后Missing config file br-ex网卡无法正常启动问题"有了一定的了解,如果想了解更多相关知识,欢迎关注行业资讯频道,感谢各位的阅读!