Is there a way to get only the name of physical ethernet interface(i.e not virtual ethernet interface)?
To give a bit of background, I'm trying to get a few SBCs(RPi 3) to write their IP addresses to a DataBase. But since the names of the physical ethernet interface on different SBCs is not usually same, I'm finding it hard to get their IP addresses.
One way I could think of solving this is to give all the SBCs ethernet interface a common name like eth0. But this method feels a bit clunky. So, is there any other alternative to get only the name of physical ethernet interface?
Linux – How to get only the name of the physical ethernet interface
linuxnetwork-interfacenetworking
Best Answer
You can tell which interfaces are virtual via
which gives you this output:
From there, you could grep to filter only non-virtual interfaces:
Another option is to use this small script, adapted from this answer, which prints the name of all interfaces which do not have a MAC address of 00:00:00:00:00:00 i.e. physical: