Networking is one of the most important things a computer can do, since it's no so useful on its own.


Networking under Linux is powerful, but managed by a set of wildly different tools, with different capabilities and with very different interfaces.

To handle this, systemd introduced networkd(8) to provide a common interface to all the network configuration, and is becoming a standard way of doing this across the different distributions.

At the time of writing, networkd(8) is intended to be a replacement for static network config in the form of the Debian-derived interfaces(5) file, or the Red Hat-derived ifcfg(5), rather than the dynamic network config managed by NetworkManager or connman.

However, you can do some form of dynamic network configuration by putting files in /etc/systemd/network and restarting networkd(8) by running systemctl restart systemd-networkd.service.

You can configure networks by adding a file, or create virtual network devices (such as bridges) with a systemd.netdev(5) file.

This is normally the domain of the system administrator, but systemd ships a few default rules to make networking with containers launched with [systemd-networkd(1)][] work better.

systemd ships a rule for containers to use DHCP on network interfaces named hostN, to get their IP address. And ships a rule such that the other end of these host-only interfaces provide a DHCP server, and use NAT to allow containers to speak to the internet.


DHCP isn't the whole story though, as you need names to usefully access the internet, so systemd has some support for DNS.

resolved(8) provides per-interface DNS hostname resolution. This is an improtant improvement over the current state of Linux networking, because network interfaces are a lot more dynamic than they used to be.

It is not unusual to be connected to multiple networks, especially if you need to use a VPN to talk to machines that are not allowed to connect to the internet.

If name resolution is not handled per-interface, then you need to flush the DNS cache to avoid having entries that are only relevant to networks you are no longer connected to.

resolved(8) is only indirectly used, via the standard name lookup procedure specified in the "hosts" line in the nsswitch.conf(5) file, by adding "resolve".

resolved(8) doesn't normally need further configuration, as name resolution is typically per-network configuration, and this network configuration is usually shared by a DHCP server.

However, if this is not reliable, then the name servers can be configured per-interface in a file, or system-wide in the [resolved.conf(5)][] configuration file.