systemd-networkd.socket 失败。有什么办法吗?

systemd-networkd.socket 失败。有什么办法吗?

我的服务器上的 Internet 连接有问题。我无法使用 Filezilla 或 Webmin,因为我的 systemd-networkd.socket 似乎有问题。你能帮助我吗?这是我的输出:

$ 系统控制

systemd-networkd.socket 加载失败

$ systemctl status systemd-networkd.socket

已加载:已加载(/lib/systemd/system/systemd-networkd.socket;已启用;供应商预设:已启用)

活动:失败(结果:service-start-limit-hit)

另外,我收到以下消息:

1 月 20 日 16:34:21 exampleserver systemd[1]:systemd-networkd.socket: 套接字服务 systemd-networkd.service 已活动,拒绝。

无法监听网络服务 Netlink 套接字

答案1

在 ubuntu 20.04 上,您可以打开应用程序 systemd-manager。然后单击顶部栏中的“服务”按钮,将打开一个下拉菜单。您需要选择“套接字”选项。左侧面板将显示套接字服务列表,您可以在那里找到服务名称为“systemd-networkd”。针对该服务,必须有两个绿色勾号。如果没有,请选择该服务并单击顶部栏中的“启用”按钮,然后单击“启动”按钮(绿色按钮)以启动该服务。这将使左侧面板中针对该服务的两个绿色勾号。

在此处输入图片描述

答案2

当我输入命令时sudo systemctl status systemd-networkd.socket出现错误:

systemd-networkd.socket: Socket service systemd-networkd.service already active, refusing.
systemd[1]: Failed to listen on Network Service Netlink Socket.
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

我们需要找到一种解决方法,以便不使用ioctl, ifconfig, route,而是选择 netlink/rtnetlink 来进行用户空间和 Linux 内核之间的通信。Netlink 允许您测试大量内核子系统 - 接口、路由、网络数据包过滤器。

  • 如果你走进死胡同,不知道有什么错误,那么首先解决你需要找出的问题:你正在使用什么network-managersystemd-networkd

  • Rtnetlink 在处理根目录时有些困难,因此,它目前是如何使用的。对于附近的汽车来说,它更容易使用,这样你就不会再遇到它,也不会有疑问。

  • 在 Linux 2.2 中,一个接口可以有多个 IP 地址;它们是备用的设备别名。

  • RTM_Rtnetlink 除了包含标准的 netlink 消息之外,还包含其他消息类型NETLINK_

要使用 rtnetlink,您需要安装

sudo apt install socket

使用 rtnetlink 套接字和命令例如

  • sudo socket -p RTM_GETTCLASS -p network-manager -s | host localhost

输出:

localhost has address 127.0.0.1
localhost has IPv6 address ::1
  • sudo socket -p RTM_GETTCLASS -p network-manager -s | host -aCdilrTvVw | /

输出:

host 9.11.3-1ubuntu1.15-Ubuntu

手动的:

https://man7.org/linux/man-pages/man7/rtnetlink.7.html

https://man7.org/linux/man-pages/man7/netlink.7.html

rtnetlink, NETLINK_ROUTE - Linux IPv4 routing socket.

RTM_NEWLINK, RTM_DELLINK, RTM_GETLINK - create, delete or get information about specific network interface.
RTM_NEWADDR, RTM_DELADDR, RTM_GETADDR - add, remove or get address information, the IP associated with the interface.
RTM_NEWROUTE, RTM_DELROUTE, RTM_GETROUTE - create, delete, or get information about a network route.
RTM_NEWNEIGH, RTM_DELNEIGH, RTM_GETNEIGH - add, remove or get information about a record, made by a neighboring machine (for example, an ARP entry).
RTM_NEWRULE, RTM_DELRULE, RTM_GETRULE - add, remove or get a rule routing.
RTM_NEWQDISC, RTM_DELQDISC, RTM_GETQDISC - add, remove or get a shipping method package to the queue.
RTM_NEWTCLASS, RTM_DELTCLASS, RTM_GETTCLASS - add, remove or get traffic class. 
RTM_NEWTFILTER, RTM_DELTFILTER, RTM_GETTFILTER - add, remove or get information about a filter traffic.
RTMGRP_LINK - this group receives notifications about changes in network interfaces (interface was removed, added, down, up)
RTMGRP_IPV4_IFADDR - this group receives notifications about changes in IPv4 interface addresses (the address has been added or removed)
RTMGRP_IPV6_IFADDR - this group receives notifications about changes in IPv6 interface addresses (the address has been added or removed)
RTMGRP_IPV4_ROUTE - this group receives notification of changes in the routing table for IPv4 addresses
RTMGRP_IPV6_ROUTE - this group receives notification of changes in the routing table for IPv6 addresses 
NETLINK_ROUTE - receive notifications about changes to the routing table and network interfaces, can also be used to change all the parameters of the above objects.
NETLINK_USERSOCK - reserved for defining custom protocols.
NETLINK_FIREWALL - used to transfer IPv4 packets from the network filter to the user level
NETLINK_INET_DIAG - monitoring inet sockets
NETLINK_NFLOG - network/packet filter ULOG
NETLINK_SELINUX - receive notifications from the Selinux system
NETLINK_NETFILTER - working with the network filter subsystem
NETLINK_KOBJECT_UEVENT - receive kernel messages

相关内容