11

To Create a Fake Ethernet dummy Interface On Linux we First initialize the dummy interface driver using the below command: /sbin/modprobe dummy.
Then we Assign Ethernet Interface alias To Dummy Driver we just initialized above.

But it gives the following Fatal error saying: FATAL: Module dummy not found.

Also, at the path cd /sys/devices/virtual/net# , we can see that there are virtual interfaces present by the following names:
dummy0/ lo/ sit0/ tunl0/

ifconfig -a

dummy0:   Link encap:Ethernet  HWaddr aa:3a:a6:cd:91:2b    
          BROADCAST NOARP  MTU:1500  Metric:1  
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0  
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0   
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo:     Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0  
          inet6 addr: ::1/128 Scope:Host  
          UP LOOPBACK RUNNING  MTU:16436  Metric:1  
          RX packets:111 errors:0 dropped:0 overruns:0 frame:0  
          TX packets:111 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0   
          RX bytes:8303 (8.1 KiB)  TX bytes:8303 (8.1 KiB)

sit0:      Link encap:UNSPEC  HWaddr 00-00-00-00-FF-00-00-00-00-00-00-00-00-00-00-00    
          NOARP  MTU:1480  Metric:1  
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0  
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0   
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

tunl0:  Link encap:IPIP Tunnel  HWaddr   
          NOARP  MTU:1480  Metric:1  
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0  
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0   
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)  

So, the modprobe command is not able to load the kernel module.
How can we load a kernel module using modprobe or insmod to initialize a dummy interface driver?
Can we create multiple dummy interfaces on a single loaded module?

  • When you talked about Ethernet virtual interface.You didnt need to load any dummy module. You can create it using ifconfig command like eth0:1, eth0:2, etc. – supriady Jan 6 '17 at 6:32
  • You can set different IP address, subnet and gateway on Ethernet virtual interface using ifconfig command. Just add it on rc.local and loaded on the boot.You didnt need to create any ethernet virtual interface config files. – supriady Jan 6 '17 at 6:36
  • 1
    @supriady I am not asking about Virtual interfaces. I know we can assign virtual ip's to an interface using ifconfig like eth0:1 & so on but here the Mac h/w address will be same for each virtual interface created. My question is how to create multiple dummy interfaces like dummy0 shown above having a different H/w Mac address than the real interfaces. – Kushal Jan 6 '17 at 6:52
  • Just to be sure, you do realize that these interfaces will not be visible from outside the machine, right? – Julie Pelletier Jan 6 '17 at 7:18
  • Please add to the question the FULL output of the modprobe error and the output of uname -r – Rui F Ribeiro Jan 6 '17 at 10:34
12

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.

  • "the error message FATAL: Module dummy not found indicates that you may have a kernel where the dummy interface module is not enabled" => No, it may mean the dummy driver was not built as a module, but directly added to the kernel instead. Apparently a dummy0 interface exists on the OP's machine. Other than that, your answer is OK. – xhienne Jan 6 '17 at 9:41
  • 1
    @xhienne depends on your version of modprobe, but recent versions from kmod, at least, will know about builtins. Try it. E.g. modprobe unix and modprobe -r unix. – sourcejedi Mar 22 at 21:05
5

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
  • At least with the kernel 4.4.0, additional dummy interfaces can be added with ip link add dumdum type dummy. – Feuermurmel Mar 20 '17 at 16:00
  • @Feuermurmel Do you have an ideia if it works to add more than 2? – Rui F Ribeiro Mar 20 '17 at 16:14
  • It definitely does. Test for yourself: for i in {0..100}; do ip link add blubb-$i type dummy; done – Feuermurmel Mar 20 '17 at 16:17
  • @Feuermurmel Good news, thanks for the tip. You might want to add it as an additional answer. IMO both are pertinent as there are still lot of iOT devices that are stuck in lower kernel versions. – Rui F Ribeiro Mar 20 '17 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.