Can I create a virtual ethernet interface named eth0?

Sure. You can create a tap device fairly easily, either with tunctl (from uml-utilities, at least on Debian):

# tunctl -t eth0
Set 'eth0' persistent and owned by uid 0
# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr a6:9b:fe:d8:d9:5e  
          BROADCAST MULTICAST  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:500 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Or with ip:

# ip tuntap add dev eth0 mode tap
# ip link ls dev eth0
7: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 500
    link/ether 0e:55:9b:6f:57:6c brd ff:ff:ff:ff:ff:ff

Probably you should prefer the second method, as ip is preferred network tool on Linux, and you likely already have it installed.

Also, both of these are creating the tap device with a—I'd guess—random local MAC, you can set the MAC to a fixed value in any of the normal ways.


You can also set udev rules to give your network cards the names you want:

https://wiki.archlinux.org/index.php/Network_Configuration#Change_device_name

Of course, you should NOT tell udev to call them eth0, eth1, etc. What does Maple do if you only have a wifi card?


I'm looking at a very similar issue with a computer with no wired network card at all. This solution looks like a good one: http://jms.id.au/wiki/FakeEth0

Basically, the idea is to create/modify a few files to create a dummy interface:

In /etc/modules-load.d/dummy.conf add:

# load dummy interface module
dummy

In /etc/udev/rules.d/70-persistent-net.rules add:

SUBSYSTEM=="net", KERNEL=="dummy0", NAME="eth0"

Then in /etc/network/interfaces add:

iface eth0 inet static
    hwaddress DE:AD:BE:EF:CA:FE

You should be able to do a modprobe dummy at this point and check to make sure the interface was set up correctly. It may not set the mac address if you use modprobe instead of rebooting; in that case do ip link set dev eth0 address de:ad:be:ef:ca:fe.