Configuring Dummy Interfaces in systemd-networkd¶
Dummys are functionally identical to loopbacks (read more), though we're allowed to create more than one. Like a loopback, a dummy interface does not require a physical connection, and the addresses associated with the interface won't go up and down based on link status. A dummy interface can also be configured with one or more IP addresses (just like a physical interface) and it can be bound to a client or server socket, responding to network requests received at the configured addresses.
We will use dummy interfaces to extend our network virtually for the purpose of labs and to provide logical separation between multiple services hosted on a single physical node.
Creating the Interface¶
networkd supports various software-defined interface types, including dummy interfaces. Just like physical interfaces, you can view or modify the state of a dummy interface using standard commands like ip link
and ip address
. The following example demonstrates how to create and configure a dummy interface with these commands:
ip link add dev dmz0 type dummy
ip addr add dev dmz0 10.10.10.10/32
While ip link
and ip address
can make non-persistent changes to network devices, these changes will not be restored after shutting down or rebooting the operating system. In order to create a persistent dummy interface on a system running networkd, the ip link
settings should be translated into a .netdev
file that is loaded from the networkd configuration directory (typically /etc/systemd/network). In addition to providing a name for the interface, the parameter Kind=dummy
instructs networkd to add a dummy interface. As shown below, Layer-3 configuration for this interface is defined separately in a .network
configuration file.