您现在的位置是:首页 >技术杂谈 >linux-centos7网卡ens33丢失导致网络问题网站首页技术杂谈
linux-centos7网卡ens33丢失导致网络问题
简介linux-centos7网卡ens33丢失导致网络问题
问题:centos7开机出现问题无法连接网络,之前正常。
执行 ifconfig 显示没有ens33网卡,但是同样的其他虚拟机却是正常状态:
[root@hadoop108 ~]# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 11496 bytes 900336 (879.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11496 bytes 900336 (879.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:71:26:9e txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
查看ip link
[root@hadoop108 ~]# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens33: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 00:0c:29:f2:ae:65 brd ff:ff:ff:ff:ff:ff
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
link/ether 52:54:00:71:26:9e brd ff:ff:ff:ff:ff:ff
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN mode DEFAULT group default qlen 1000
link/ether 52:54:00:71:26:9e brd ff:ff:ff:ff:ff:ff
显示ens33网卡为DOWN状态,
查看网络状态:
[root@hadoop108 ~]# systemctl status network.service
● network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since 三 2023-05-24 09:16:00 CST; 31s ago
Docs: man:systemd-sysv-generator(8)
Process: 9720 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
5月 24 09:16:00 hadoop108 network[9720]: RTNETLINK answers: File exists
5月 24 09:16:00 hadoop108 network[9720]: RTNETLINK answers: File exists
5月 24 09:16:00 hadoop108 network[9720]: RTNETLINK answers: File exists
5月 24 09:16:00 hadoop108 network[9720]: RTNETLINK answers: File exists
5月 24 09:16:00 hadoop108 network[9720]: RTNETLINK answers: File exists
5月 24 09:16:00 hadoop108 network[9720]: RTNETLINK answers: File exists
5月 24 09:16:00 hadoop108 systemd[1]: network.service: control process exited, code=exited status=1
5月 24 09:16:00 hadoop108 systemd[1]: Failed to start LSB: Bring up/down networking.
5月 24 09:16:00 hadoop108 systemd[1]: Unit network.service entered failed state.
5月 24 09:16:00 hadoop108 systemd[1]: network.service failed.
重启网卡
[root@hadoop108 ~]# systemctl restart network
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
[root@hadoop108 ~]# journalctl -xe
5月 24 09:41:01 hadoop108 NetworkManager[685]: <info> [1684892461.3726] audit: op="con
5月 24 09:41:01 hadoop108 network[5872]: 正在打开接口 ens33: 错误:连接激活失败:No su
5月 24 09:41:01 hadoop108 network[5872]: [失败]
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 systemd[1]: network.service: control process exited, code=exi
5月 24 09:41:01 hadoop108 systemd[1]: Failed to start LSB: Bring up/down networking.
-- Subject: Unit network.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit network.service has failed.
--
-- The result is failed.
5月 24 09:41:01 hadoop108 systemd[1]: Unit network.service entered failed state.
5月 24 09:41:01 hadoop108 systemd[1]: network.service failed.
5月 24 09:41:01 hadoop108 polkitd[616]: Unregistered Authentication Agent for unix-proc
查看日志:
5月 24 09:41:01 hadoop108 NetworkManager[685]: <info> [1684892461.3726] audit: op="connection-activate" uuid="b90d3d59-d742-45b5-ba56-f5b47644b948" name="ens33" result="fail" reason="No suitable device found fo
5月 24 09:41:01 hadoop108 network[5872]: 正在打开接口 ens33: 错误:连接激活失败:No suitable device found for this connection (device lo not available because device is strictly unmanaged).
5月 24 09:41:01 hadoop108 network[5872]: [失败]
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 network[5872]: RTNETLINK answers: File exists
5月 24 09:41:01 hadoop108 systemd[1]: network.service: control process exited, code=exited status=1
5月 24 09:41:01 hadoop108 systemd[1]: Failed to start LSB: Bring up/down networking.
-- Subject: Unit network.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit network.service has failed.
--
-- The result is failed.
5月 24 09:41:01 hadoop108 systemd[1]: Unit network.service entered failed state.
5月 24 09:41:01 hadoop108 systemd[1]: network.service failed.
5月 24 09:41:01 hadoop108 polkitd[616]: Unregistered Authentication Agent for unix-process:5866:54555 (system bus name :1.120, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale zh_CN.UTF-8) (di
~
~
尝试启动ens33网络接口失败:
[root@hadoop108 ~]# ifup ens33
错误:连接激活失败:No suitable device found for this connection (device lo not available because device is strictly unmanaged).
问题总结:vm虚拟机下其他centos7是正常的,单台centos7网络异常,不是由于windows中VMware net相关服务导致的,是单台centos7的问题导致。确保配置文件(/etc/sysconfig/network-scripts/ifcfg-ens33)正常的情况下,可以尝试以下方法:
- 将
NetworkManager
服务从系统启动时的运行级别中移除,以防止它在系统启动时自动运行,手动配置网络连接[root@hadoop108 ~]# chkconfig NetworkManager off 注意:正在将请求转发到“systemctl disable NetworkManager.service”。 Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service. Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service. Removed symlink /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service.
- 将
network
服务在系统启动时自动运行[root@hadoop108 ~]# chkconfig network on
- 停止正在运行的
NetworkManager
服务[root@hadoop108 ~]# service NetworkManager stop Redirecting to /bin/systemctl stop NetworkManager.service
- 启动
network
服务[root@hadoop108 ~]# service network start Starting network (via systemctl): [ 确定 ]
- 测试网络连接正常
[root@hadoop108 ~]# ifconfig | grep ens33 ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 [root@hadoop108 ~]# ping www.baidu.com -c 3 PING www.a.shifen.com (110.242.68.3) 56(84) bytes of data. 64 bytes from 110.242.68.3 (110.242.68.3): icmp_seq=1 ttl=128 time=53.6 ms 64 bytes from 110.242.68.3 (110.242.68.3): icmp_seq=2 ttl=128 time=53.6 ms 64 bytes from 110.242.68.3 (110.242.68.3): icmp_seq=3 ttl=128 time=53.2 ms --- www.a.shifen.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 3124ms rtt min/avg/max/mdev = 53.200/53.494/53.675/0.282 ms
风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。