How can we create multiple dummy interfaces on Linux?

The usual way to add several dummy interfaces is to use iproute2:

# ip link add dummy0 type dummy
# ip link add dummy1 type dummy
# ip link list
...
5: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 22:4e:84:26:c5:98 brd ff:ff:ff:ff:ff:ff
6: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 9e:3e:48:b5:d5:1d brd ff:ff:ff:ff:ff:ff

But the error message FATAL: Module dummy not found indicates that you may have a kernel where the dummy interface module is not enabled, so make sure to check your kernel configuration, and recompile the kernel if necessary.


To create dummy interfaces upon boot, I advise adding to /etc/modules

dummy

Beware the module dummyonly allows two dummy interfaces by default before kernel 4.4.x( correct version to be verified).

If you need more, you have also to create either a /etc/modprobe.d/local or /etc/modprobe.d/dummy.conf defining the parameter numdummies with the number of dummy interfaces you desire:

options dummy numdummies=4 

As per @Feuermurmel comments, in newer kernels, you add more dummy interfaces, besides the two one created by default, using the command:

sudo ip link add dummyX type dummy