首先我要声明,我是一名 Linux 菜鸟。我刚刚在闲置的旧戴尔 Inspiron n411z 上安装了 Lubuntu 20.04 LTS。这台机器运行良好,但我正在排除一些小故障。
问题:尽管我没有插入任何设备,但我看到以太网端口周围有令人困惑的活动。
我一直看到每隔几分钟就会弹出“有线以太网连接已断开”的通知。我从来没有将任何东西连接到该端口,所以这很令人困惑。我能够在系统托盘中的 nm-tray 上找到一个禁用通知的设置,所以我在那里处理了这个问题。
然而,即使我的 Wi-Fi 连接正常,我仍然会偶尔看到系统托盘中的连接指示器继续旋转。
我决定进行调查并阅读更多内容。我找到了 systemctl 和 journalctl 等命令来收集更多信息。以下是我目前所知道的:
kp@voltron:$ journalctl -g enp4s0 -f
-- Logs begin at Thu 2020-06-18 20:28:13 PDT. --
Jun 24 23:05:17 voltron NetworkManager[3013]: <info> [1593065117.1037] device (enp4s0): state change: ip-config -> unavailable (reason 'carrier-changed', sys-iface-state: 'managed')
Jun 24 23:05:17 voltron NetworkManager[3013]: <info> [1593065117.1205] dhcp4 (enp4s0): canceled DHCP transaction
Jun 24 23:05:17 voltron NetworkManager[3013]: <info> [1593065117.1207] dhcp4 (enp4s0): state changed unknown -> done
Jun 24 23:05:17 voltron avahi-daemon[785]: Withdrawing address record for fe80::46ef:88c2:a128:b655 on enp4s0.
Jun 24 23:05:17 voltron avahi-daemon[785]: Leaving mDNS multicast group on interface enp4s0.IPv6 with address fe80::46ef:88c2:a128:b655.
Jun 24 23:05:17 voltron avahi-daemon[785]: Interface enp4s0.IPv6 no longer relevant for mDNS.
Jun 24 23:06:25 voltron NetworkManager[3013]: <info> [1593065185.5390] device (enp4s0): carrier: link connected
Jun 24 23:06:25 voltron kernel: atl1c 0000:04:00.0: atl1c: enp4s0 NIC Link is Up<100 Mbps Full Duplex>
Jun 24 23:06:25 voltron NetworkManager[3013]: <info> [1593065185.5407] device (enp4s0): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface-state: 'managed')
Jun 24 23:06:25 voltron NetworkManager[3013]: <info> [1593065185.5484] device (enp4s0): Activation: starting connection 'Wired connection 1' (d818283c-4769-35fd-80ae-e60b60978a85)
Jun 24 23:06:25 voltron avahi-daemon[785]: Joining mDNS multicast group on interface enp4s0.IPv6 with address fe80::46ef:88c2:a128:b655.
Jun 24 23:06:25 voltron NetworkManager[3013]: <info> [1593065185.5487] device (enp4s0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Jun 24 23:06:25 voltron avahi-daemon[785]: New relevant interface enp4s0.IPv6 for mDNS.
Jun 24 23:06:25 voltron NetworkManager[3013]: <info> [1593065185.5499] device (enp4s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Jun 24 23:06:25 voltron avahi-daemon[785]: Registering new address record for fe80::46ef:88c2:a128:b655 on enp4s0.*.
Jun 24 23:06:25 voltron NetworkManager[3013]: <info> [1593065185.5534] device (enp4s0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Jun 24 23:06:25 voltron NetworkManager[3013]: <info> [1593065185.5543] dhcp4 (enp4s0): activation: beginning transaction (timeout in 45 seconds)
Jun 24 23:06:31 voltron kernel: atl1c 0000:04:00.0: atl1c: enp4s0 NIC Link is Up<100 Mbps Full Duplex>
Jun 24 23:06:42 voltron kernel: atl1c 0000:04:00.0: atl1c: enp4s0 NIC Link is Up<100 Mbps Full Duplex>
Jun 24 23:06:45 voltron kernel: atl1c 0000:04:00.0: atl1c: enp4s0 NIC Link is Down
Jun 24 23:06:51 voltron NetworkManager[3013]: <info> [1593065211.0982] device (enp4s0): state change: ip-config -> unavailable (reason 'carrier-changed', sys-iface-state: 'managed')
Jun 24 23:06:51 voltron NetworkManager[3013]: <info> [1593065211.1125] dhcp4 (enp4s0): canceled DHCP transaction
Jun 24 23:06:51 voltron NetworkManager[3013]: <info> [1593065211.1127] dhcp4 (enp4s0): state changed unknown -> done
Jun 24 23:06:51 voltron avahi-daemon[785]: Withdrawing address record for fe80::46ef:88c2:a128:b655 on enp4s0.
Jun 24 23:06:51 voltron avahi-daemon[785]: Leaving mDNS multicast group on interface enp4s0.IPv6 with address fe80::46ef:88c2:a128:b655.
Jun 24 23:06:51 voltron avahi-daemon[785]: Interface enp4s0.IPv6 no longer relevant for mDNS.
Jun 24 23:07:53 voltron kernel: atl1c 0000:04:00.0: atl1c: enp4s0 NIC Link is Up<100 Mbps Full Duplex>
Jun 24 23:07:53 voltron NetworkManager[3013]: <info> [1593065273.4533] device (enp4s0): carrier: link connected
Jun 24 23:07:53 voltron NetworkManager[3013]: <info> [1593065273.4537] device (enp4s0): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface-state: 'managed')
Jun 24 23:07:53 voltron NetworkManager[3013]: <info> [1593065273.4608] device (enp4s0): Activation: starting connection 'Wired connection 1' (d818283c-4769-35fd-80ae-e60b60978a85)
Jun 24 23:07:53 voltron NetworkManager[3013]: <info> [1593065273.4610] device (enp4s0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Jun 24 23:07:53 voltron NetworkManager[3013]: <info> [1593065273.4616] device (enp4s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Jun 24 23:07:53 voltron NetworkManager[3013]: <info> [1593065273.4644] device (enp4s0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Jun 24 23:07:53 voltron NetworkManager[3013]: <info> [1593065273.4698] dhcp4 (enp4s0): activation: beginning transaction (timeout in 45 seconds)
Jun 24 23:07:53 voltron avahi-daemon[785]: Joining mDNS multicast group on interface enp4s0.IPv6 with address fe80::46ef:88c2:a128:b655.
Jun 24 23:07:53 voltron avahi-daemon[785]: New relevant interface enp4s0.IPv6 for mDNS.
Jun 24 23:07:53 voltron avahi-daemon[785]: Registering new address record for fe80::46ef:88c2:a128:b655 on enp4s0.*.
Jun 24 23:07:57 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 3 (xid=0xac0ae07d)
Jun 24 23:07:59 voltron kernel: atl1c 0000:04:00.0: atl1c: enp4s0 NIC Link is Up<100 Mbps Full Duplex>
Jun 24 23:08:00 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 7 (xid=0xac0ae07d)
Jun 24 23:08:06 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 3 (xid=0x40845655)
Jun 24 23:08:06 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 3 (xid=0x19ff7a4d)
Jun 24 23:08:07 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 11 (xid=0xac0ae07d)
Jun 24 23:08:09 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 6 (xid=0x40845655)
Jun 24 23:08:09 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 5 (xid=0x19ff7a4d)
Jun 24 23:08:14 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 10 (xid=0x19ff7a4d)
Jun 24 23:08:15 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 12 (xid=0x40845655)
Jun 24 23:08:18 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 15 (xid=0xac0ae07d)
Jun 24 23:08:24 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 15 (xid=0x19ff7a4d)
Jun 24 23:08:27 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 17 (xid=0x40845655)
Jun 24 23:08:33 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 8 (xid=0xac0ae07d)
Jun 24 23:08:38 voltron NetworkManager[3013]: <warn> [1593065318.8418] dhcp4 (enp4s0): request timed out
Jun 24 23:08:38 voltron NetworkManager[3013]: <info> [1593065318.8419] dhcp4 (enp4s0): state changed unknown -> timeout
Jun 24 23:08:38 voltron NetworkManager[3013]: <info> [1593065318.8421] device (enp4s0): state change: ip-config -> failed (reason 'ip-config-unavailable', sys-iface-state: 'managed')
Jun 24 23:08:38 voltron NetworkManager[3013]: <warn> [1593065318.8462] device (enp4s0): Activation: failed for connection 'Wired connection 1'
Jun 24 23:08:38 voltron NetworkManager[3013]: <info> [1593065318.8469] device (enp4s0): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
Jun 24 23:08:38 voltron avahi-daemon[785]: Withdrawing address record for fe80::46ef:88c2:a128:b655 on enp4s0.
Jun 24 23:08:38 voltron avahi-daemon[785]: Leaving mDNS multicast group on interface enp4s0.IPv6 with address fe80::46ef:88c2:a128:b655.
Jun 24 23:08:38 voltron avahi-daemon[785]: Interface enp4s0.IPv6 no longer relevant for mDNS.
Jun 24 23:08:38 voltron NetworkManager[3013]: <info> [1593065318.8724] dhcp4 (enp4s0): canceled DHCP transaction
Jun 24 23:08:38 voltron NetworkManager[3013]: <info> [1593065318.8725] dhcp4 (enp4s0): state changed timeout -> done
Jun 24 23:08:38 voltron NetworkManager[3013]: <info> [1593065318.8769] device (enp4s0): state change: disconnected -> unavailable (reason 'carrier-changed', sys-iface-state: 'managed')
Jun 24 23:08:39 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 16 (xid=0x19ff7a4d)
Jun 24 23:08:41 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 20 (xid=0xac0ae07d)
Jun 24 23:08:44 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 11 (xid=0x40845655)
Jun 24 23:08:55 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 17 (xid=0x19ff7a4d)
Jun 24 23:08:55 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 14 (xid=0x40845655)
Jun 24 23:09:01 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 12 (xid=0xac0ae07d)
Jun 24 23:09:09 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 18 (xid=0x40845655)
Jun 24 23:09:12 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 17 (xid=0x19ff7a4d)
Jun 24 23:09:13 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 13 (xid=0xac0ae07d)
Jun 24 23:09:26 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 20 (xid=0xac0ae07d)
Jun 24 23:09:27 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 9 (xid=0x40845655)
Jun 24 23:09:29 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 16 (xid=0x19ff7a4d)
Jun 24 23:09:36 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 9 (xid=0x40845655)
Jun 24 23:09:45 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 18 (xid=0x40845655)
Jun 24 23:09:45 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 14 (xid=0x19ff7a4d)
Jun 24 23:09:46 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 11 (xid=0xac0ae07d)
Jun 24 23:09:57 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 14 (xid=0xac0ae07d)
Jun 24 23:09:59 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 21 (xid=0x19ff7a4d)
Jun 24 23:10:03 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 10 (xid=0x40845655)
Jun 24 23:10:11 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 13 (xid=0xac0ae07d)
Jun 24 23:10:13 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 10 (xid=0x40845655)
Jun 24 23:10:20 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 16 (xid=0x19ff7a4d)
Jun 24 23:10:23 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 14 (xid=0x40845655)
Jun 24 23:10:24 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 7 (xid=0xac0ae07d)
Jun 24 23:10:31 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 11 (xid=0xac0ae07d)
Jun 24 23:10:36 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 16 (xid=0x19ff7a4d)
Jun 24 23:10:37 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 11 (xid=0x40845655)
Jun 24 23:10:42 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 7 (xid=0xac0ae07d)
Jun 24 23:10:48 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 14 (xid=0x40845655)
Jun 24 23:10:49 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 14 (xid=0xac0ae07d)
Jun 24 23:10:52 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 11 (xid=0x19ff7a4d)
Jun 24 23:11:00 voltron kernel: atl1c 0000:04:00.0: atl1c: enp4s0 NIC Link is Up<100 Mbps Full Duplex>
Jun 24 23:11:00 voltron kernel: IPv6: ADDRCONF(NETDEV_CHANGE): enp4s0: link becomes ready
Jun 24 23:11:00 voltron NetworkManager[3013]: <info> [1593065460.6898] device (enp4s0): carrier: link connected
Jun 24 23:11:00 voltron NetworkManager[3013]: <info> [1593065460.6903] device (enp4s0): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface-state: 'managed')
Jun 24 23:11:00 voltron NetworkManager[3013]: <info> [1593065460.6974] device (enp4s0): Activation: starting connection 'Wired connection 1' (d818283c-4769-35fd-80ae-e60b60978a85)
Jun 24 23:11:00 voltron NetworkManager[3013]: <info> [1593065460.6976] device (enp4s0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Jun 24 23:11:00 voltron NetworkManager[3013]: <info> [1593065460.6982] device (enp4s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Jun 24 23:11:00 voltron NetworkManager[3013]: <info> [1593065460.7012] device (enp4s0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Jun 24 23:11:00 voltron NetworkManager[3013]: <info> [1593065460.7017] dhcp4 (enp4s0): activation: beginning transaction (timeout in 45 seconds)
Jun 24 23:11:00 voltron avahi-daemon[785]: Joining mDNS multicast group on interface enp4s0.IPv6 with address fe80::46ef:88c2:a128:b655.
Jun 24 23:11:00 voltron avahi-daemon[785]: New relevant interface enp4s0.IPv6 for mDNS.
Jun 24 23:11:00 voltron avahi-daemon[785]: Registering new address record for fe80::46ef:88c2:a128:b655 on enp4s0.*.
Jun 24 23:11:02 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 19 (xid=0x40845655)
Jun 24 23:11:03 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 7 (xid=0xac0ae07d)
Jun 24 23:11:03 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 20 (xid=0x19ff7a4d)
Jun 24 23:11:10 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 12 (xid=0xac0ae07d)
Jun 24 23:11:21 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 21 (xid=0x40845655)
Jun 24 23:11:22 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 18 (xid=0xac0ae07d)
Jun 24 23:11:23 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 19 (xid=0x19ff7a4d)
Jun 24 23:11:40 voltron dhclient[3060]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 9 (xid=0xac0ae07d)
Jun 24 23:11:42 voltron dhclient[2536]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 17 (xid=0x19ff7a4d)
Jun 24 23:11:42 voltron dhclient[2851]: DHCPDISCOVER on enp4s0 to 255.255.255.255 port 67 interval 16 (xid=0x40845655)
Jun 24 23:11:45 voltron NetworkManager[3013]: <warn> [1593065505.8405] dhcp4 (enp4s0): request timed out
Jun 24 23:11:45 voltron NetworkManager[3013]: <info> [1593065505.8406] dhcp4 (enp4s0): state changed unknown -> timeout
Jun 24 23:11:45 voltron NetworkManager[3013]: <info> [1593065505.8408] device (enp4s0): state change: ip-config -> failed (reason 'ip-config-unavailable', sys-iface-state: 'managed')
Jun 24 23:11:45 voltron NetworkManager[3013]: <warn> [1593065505.8456] device (enp4s0): Activation: failed for connection 'Wired connection 1'
Jun 24 23:11:45 voltron NetworkManager[3013]: <info> [1593065505.8462] device (enp4s0): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
Jun 24 23:11:45 voltron avahi-daemon[785]: Withdrawing address record for fe80::46ef:88c2:a128:b655 on enp4s0.
Jun 24 23:11:45 voltron avahi-daemon[785]: Leaving mDNS multicast group on interface enp4s0.IPv6 with address fe80::46ef:88c2:a128:b655.
Jun 24 23:11:45 voltron avahi-daemon[785]: Interface enp4s0.IPv6 no longer relevant for mDNS.
Jun 24 23:11:45 voltron NetworkManager[3013]: <info> [1593065505.8725] dhcp4 (enp4s0): canceled DHCP transaction
Jun 24 23:11:45 voltron NetworkManager[3013]: <info> [1593065505.8725] dhcp4 (enp4s0): state changed timeout -> done
Jun 24 23:11:45 voltron NetworkManager[3013]: <info> [1593065505.8784] device (enp4s0): state change: disconnected -> unavailable (reason 'carrier-changed', sys-iface-state: 'managed')
为什么有这么多进程与我的以太网端口 (enp4s0) 交互?当没有任何东西连接到端口时,如何让这些服务停止这样做?
我希望以上日志足够有用,以便有人能给我指点。任何帮助我都会很感激,
谢谢你!
答案1
我花了一些时间进行探索,我认为我找到了解决问题的方法。
阅读此主题中用户 wilkinsmr 的评论对我帮助很大: https://gist.github.com/mohamadaliakbari/1cb9400984094541581fff07143e1c9d
我同时运行了 systemd-networkd.service 和 NetworkManager,据我所知,我实际上只需要其中一个服务来管理我的网络。我大致了解 NetworkManager 适用于桌面,而 systemd-networkd 适用于服务器。
接下来我意识到 NetworkManager 上的 dhcp 出了问题。我知道 NetworkManager 使用自己的内部 dhcp 服务器,我通过检查确认了这一点:
NetworkManager --print-config
果然我看到了:
dhcp=internal
我按照 wilkinsmr 的建议修改了 /etc/NetworkManager/NetworkManager.conf,并将 dhclient 配置为默认
#/etc/NetworkManager/NetworkManager.conf
[main]
dhcp=dhclient
我不确定为什么将其保留为“内部”会给我带来问题。但是,一旦我更改了这一点,我继续禁用“systemd-networkd.service”并重新启动,从那时起我的 NetworkManager 就一直运行良好。
我可以确认它确实使用 dhclient 作为 dhcp。
我使用 PiHole 在我的家庭网络中屏蔽广告,并将其配置为我的默认 dhcp 服务器。我想知道 NetworkManager 的内部 dhcp 是否与 PiHole DHCP 配合使用存在任何问题。不过目前,我的问题已经解决。