I have a Dell XPS 13 ultrabook which has a wifi nic, but no physical ethernet nic (wlan0, but no eth0). I need to create a virtual adapter for using Vagrant with NFS, but am finding that the typical ifup eth0:1... fails with ignoring unknown interface eth0:1=eth0:1. I also tried creating a virtual interface against wlan0, but received the same result.

How can I create a virtual interface on this machine with no physical interface?

  • First off, make sure that your driver that's being used by wlan0 supports aliasing. That's the other name that virtual interfaces goes by. See how via my A to this Q: unix.stackexchange.com/questions/108396/…. BTW you cannot make an alias against eth0 if you do not have that physical device. – slm Aug 27 '14 at 3:03
  • You can also add additional IPs using the ip command too: xmodulo.com/2013/02/… – slm Aug 27 '14 at 3:20

Setting up a dummy interface

If you want to create network interfaces, but lack a physical NIC to back it, you can use the dummy link type. You can read more about them here: iproute2 Wikipedia page.

Creating eth10

To make this interface you'd first need to make sure that you have the dummy kernel module loaded. You can do this like so:

$ sudo lsmod | grep dummy
$ sudo modprobe dummy
$ sudo lsmod | grep dummy
dummy                  12960  0 

With the driver now loaded you can create what ever dummy network interfaces you like:

$ sudo ip link add eth10 type dummy

NOTE: In older versions of ip you'd do the above like this, appears to have changed along the way. Keeping this here for reference purposes, but based on feedback via comments, the above works now.

$ sudo ip link set name eth10 dev dummy0

And confirm it:

$ ip link show eth10
6: eth10: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default 
    link/ether c6:ad:af:42:80:45 brd ff:ff:ff:ff:ff:ff

Changing the MAC

You can then change the MAC address if you like:

$ sudo ifconfig eth10 hw ether 00:22:22:ff:ff:ff
$ ip link show eth10
6: eth10: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default 
    link/ether 00:22:22:ff:ff:ff brd ff:ff:ff:ff:ff:ff

Creating an alias

You can then create aliases on top of eth10.

$ sudo ip addr add brd + dev eth10 label eth10:0

And confirm them like so:

$ ifconfig -a eth10
eth10: flags=130<BROADCAST,NOARP>  mtu 1500
        ether 00:22:22:ff:ff:ff  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

$ ifconfig -a eth10:0
eth10:0: flags=130<BROADCAST,NOARP>  mtu 1500
        inet  netmask  broadcast
        ether 00:22:22:ff:ff:ff  txqueuelen 0  (Ethernet)

Or using ip:

$ ip a | grep -w inet
    inet scope host lo
    inet brd scope global wlp3s0
    inet brd scope global virbr0
    inet brd scope global eth10:0

Removing all this?

If you want to unwind all this you can run these commands to do so:

$ sudo ip addr del brd + dev eth10 label eth10:0
$ sudo ip link delete eth10 type dummy
$ sudo rmmod dummy



You can create virtual interfaces using the iproute2 toolkit.

ip link add veth0 type veth peer name veth1

This will create 2 interfaces, veth0 and veth1. Think of them as 2 ends of a pipe. Any traffic sent into veth0 will come out veth1 and vice versa.

If you want the traffic to be routed, you can do:

sysctl -w net.ipv4.conf.veth0.forwarding=1

This will tell the kernel to forward traffic coming from veth0 (so use veth1 for the used endpoint).

Another option is to set up a bridge with veth0 and another interface. Then any traffic coming through the virtual interface will get routed out to the network as if your machine were simply acting as a switch.

There are many other things you can do with this traffic (masquerade it, redirect it, DNAT it, etc), but that depends on what you're trying to accomplish.

To tear it down:

ip link del veth0
  • Cool stuff, but not quite what I needed in this case (I really just needed a virtual interface so that a VM could mount an NFS share rather than using VBox file shares) – STW Aug 28 '14 at 3:17
  • How to set IP address veth0 in the example ? – MURATSPLAT Jun 7 '18 at 16:23

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.