When i type the command sudo systemctl status systemd-networkd.socket
i have an error:
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.
We need to find a workaround so as not to use ioctl, ifconfig, route
, but choose netlink/rtnetlink for communication
between the userspace and the Linux kernel. Netlink allows you to test a large number of kernel subsystems - interfaces, routing, network packet filter.
If your are at a dead end and do not know what mistakes there are, then
fix first your need to find out: what your are
using network-manager
or systemd-networkd
?
Rtnetlink has some difficulty to work with the root directory so,
how it is currently being used. It is easier to use for a nearby car,
so that your do not stumble on it once again and your have no questions.
In Linux 2.2, an interface can have multiple IP addresses; they are
alternative device aliases.
Rtnetlink consists of the message types in addition to the standards netlink messages RTM_
in return NETLINK_
.
For use rtnetlink your need to install:
sudo apt install socket
Used socket with rtnetlink, commands for example:
sudo socket -p RTM_GETTCLASS -p network-manager -s | host localhost
output:
localhost has address 127.0.0.1
localhost has IPv6 address ::1
sudo socket -p RTM_GETTCLASS -p network-manager -s | host -aCdilrTvVw | /
output:
host 9.11.3-1ubuntu1.15-Ubuntu
Manual:
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