Debian – How to know what network interface devices the Linux kernel recognises

debiannetworking

I have been working with Debian Linux under a virtual machine (VirtualBox) and have noticed that, with the present virtual machine configuration, the EtherNet device that was configured in /etc/network/interfaces during the install was eth2 (I have generally expected eth0, eth1, etc.). I have also noticed that there don't seem to be any ethX device files in the /dev directory. This all has led me to wonder how, in a configuration where network capable devices are automatically detected, it is possible to know the names that the kernel assigns to those devices. I assume that there is something in the /proc file system but, so far, I have been unable to see anything particular.

Best Answer

You can see all networking devices by running:

ifconfig -a

Another trick to debugging the ethernet drivers is to look at dmesg:

dmesg|less

You will see each driver loading and creating ethernet devices.

You mention your ethernet device changing to eth2. Did you copy or move the VM? Typically when you make a copy of a VM it will re-create the MAC address so as to not conflict with the former copy. If this happens udev will assign the "new card" another eth* device and save the previous device for the "missing" card. These rules are stored in:

/etc/udev/rules.d/

Typically in a file called ##-persistant-net.rules. You can safely remove the assignments stored in this file and reboot to have the ethernet devices reassigned.