Sometimes we need a virtual network interface for testing purposes—without requiring physical hardware. A dummy interface can help with tasks like simulating network configurations or testing firewall rules. Having a dummy interface is handy for a variety of network experiments and tests. Here’s how we can easily create one that persists across reboots using NetworkManager’s command-line tool (nmcli).
Run the following command to add a new dummy interface called dummy0:
sudo nmcli connection add type dummy ifname dummy0 con-name dummy0
Set a static IPv4 and IPv6 address to the interface:
sudo nmcli connection modify dummy0 ipv4.addresses 10.10.10.10/24 ipv4.method manual
sudo nmcli connection modify dummy0 ipv6.addresses 2001:db8::10/64 ipv6.method manual
Activate the connection:
sudo nmcli connection up dummy0
After setup, we can confirm that dummy0 is up and configured:
ip a show dummy0
Typical output:
4: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
link/ether 3a:9d:f3:a4:b4:66 brd ff:ff:ff:ff:ff:ff
inet 10.10.10.10/24 brd 10.10.10.255 scope global noprefixroute dummy0
valid_lft forever preferred_lft forever
inet6 2001:db8::10/64 scope global noprefixroute
valid_lft forever preferred_lft forever
inet6 fe80::d224:a78b:6aa6:e6b/64 scope link noprefixroute
valid_lft forever preferred_lft forever